Skip to content

Latest commit

 

History

History
51 lines (50 loc) · 1.93 KB

README.md

File metadata and controls

51 lines (50 loc) · 1.93 KB

Pokemon-Collection

General Info

Webservice for collecting pokemon cards. Build with Spring MVC and Thymeleaf.

Table of contents

Technologies

Java 11, Spring Boot, Spring MVC, Thymeleaf, Spring Security, H2 database, Rest Template.

Setup

Thanks to Spring Boot service is ready to deploy. Nothing to corfigurate.

Features

You can register new account, create game avatar, login and logout. Server downloads cards from Pokemon TCG Api and saves them in database. You can view all cards and spend coins for card packs or buy new coins. Card pack contains 5 random cards. Purchased cards will be saved in database and attached to pokemon's trainer.

Screenshots

Examples

Example 1

TrainerService validates comming data structure and if aceptect builds valid trainer object and save it to database.

 public void addTrainer(TrainerDTO trainerDTO){
        validateUserHasNoTrainer();
        validateName(trainerDTO.getName());
        Trainer trainer = new Trainer(
                trainerDTO.getName(),
                trainerDTO.getType(),
                loginService.getLoggerUserMail());
        
        trainerRepository.save(trainer);
    }

Example 2

Spring Security configuration. Blocks most of pages if not logget user and shows custom login page.

 protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
        http.headers().disable();
        http.authorizeRequests()
                .antMatchers("/").permitAll()
                .antMatchers("/console").permitAll()
                .antMatchers("/register").permitAll()
                .antMatchers("/all-cards").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .permitAll();
    }