├── .idea └── .gitignore ├── files ├── logo.png └── SOLID Pokemon.postman_collection.json ├── solid-bad ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jjeanjacques │ │ │ │ └── solidbad │ │ │ │ ├── exception │ │ │ │ ├── NotFoundPokemon.java │ │ │ │ ├── InvalidTraining.java │ │ │ │ ├── UnreachablePokemon.java │ │ │ │ ├── UnsupportedOperation.java │ │ │ │ └── InvalidBusinessTransaction.java │ │ │ │ ├── enums │ │ │ │ └── TypePokemon.java │ │ │ │ ├── controller │ │ │ │ ├── dto │ │ │ │ │ ├── TrainingDTO.java │ │ │ │ │ ├── ReportDTO.java │ │ │ │ │ ├── PaymentResponseDTO.java │ │ │ │ │ ├── PaymentLoanResponseDTO.java │ │ │ │ │ ├── ReportCatchDTO.java │ │ │ │ │ ├── ItemMarketDTO.java │ │ │ │ │ ├── PaymentDTO.java │ │ │ │ │ └── PokemonDTO.java │ │ │ │ ├── TrainingController.java │ │ │ │ ├── ReportController.java │ │ │ │ ├── MarketController.java │ │ │ │ ├── PokedexController.java │ │ │ │ └── PaymentController.java │ │ │ │ ├── SolidBadApplication.java │ │ │ │ ├── interfaces │ │ │ │ └── Payment.java │ │ │ │ ├── config │ │ │ │ └── MapperConfig.java │ │ │ │ ├── domain │ │ │ │ ├── UltraBall.java │ │ │ │ ├── Item.java │ │ │ │ ├── Pokeball.java │ │ │ │ └── MasterBall.java │ │ │ │ ├── entity │ │ │ │ └── Pokemon.java │ │ │ │ └── service │ │ │ │ ├── WalletService.java │ │ │ │ ├── LoanService.java │ │ │ │ ├── MarketService.java │ │ │ │ ├── TrainingService.java │ │ │ │ └── PokedexService.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── sql │ │ │ └── populate-database.sql │ └── test │ │ └── java │ │ └── com │ │ └── jjeanjacques │ │ └── solid │ │ └── SolidApplicationTests.java ├── .gitignore ├── pom.xml ├── mvnw.cmd └── mvnw ├── solid-good ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── jjeanjacques │ │ │ │ └── solidgood │ │ │ │ ├── exception │ │ │ │ ├── InvalidTraining.java │ │ │ │ ├── NotFoundPokemon.java │ │ │ │ └── InvalidBusinessTransaction.java │ │ │ │ ├── service │ │ │ │ ├── Payment.java │ │ │ │ ├── Wallet.java │ │ │ │ ├── Loan.java │ │ │ │ ├── TrainingService.java │ │ │ │ ├── ReportService.java │ │ │ │ ├── impl │ │ │ │ │ ├── training │ │ │ │ │ │ ├── TrainingValidation.java │ │ │ │ │ │ ├── ValidatePokemonPowerLimit.java │ │ │ │ │ │ └── ValidateDateLastWorkout.java │ │ │ │ │ ├── WalletService.java │ │ │ │ │ ├── MarketServiceImpl.java │ │ │ │ │ ├── LoanService.java │ │ │ │ │ ├── TrainingServiceImpl.java │ │ │ │ │ ├── ReportServiceImpl.java │ │ │ │ │ └── PokedexServiceImpl.java │ │ │ │ ├── MarketService.java │ │ │ │ └── PokedexService.java │ │ │ │ ├── enums │ │ │ │ ├── TypePokemon.java │ │ │ │ ├── ItemRareEnum.java │ │ │ │ └── ItemEnum.java │ │ │ │ ├── controller │ │ │ │ ├── dto │ │ │ │ │ ├── TrainingDTO.java │ │ │ │ │ ├── PaymentResponseDTO.java │ │ │ │ │ ├── PaymentLoanResponseDTO.java │ │ │ │ │ ├── ReportCatchDTO.java │ │ │ │ │ ├── ItemMarketDTO.java │ │ │ │ │ ├── PaymentDTO.java │ │ │ │ │ ├── ItemRareMarketDTO.java │ │ │ │ │ ├── ReportDTO.java │ │ │ │ │ └── PokemonDTO.java │ │ │ │ ├── ReportController.java │ │ │ │ ├── PokedexController.java │ │ │ │ ├── MarketController.java │ │ │ │ ├── PaymentController.java │ │ │ │ └── TrainingController.java │ │ │ │ ├── SolidGoodApplication.java │ │ │ │ ├── repository │ │ │ │ ├── dto │ │ │ │ │ └── PowerTypeContract.java │ │ │ │ ├── PokemonRepository.java │ │ │ │ └── ReportRepository.java │ │ │ │ ├── config │ │ │ │ └── MapperConfig.java │ │ │ │ ├── domain │ │ │ │ ├── MasterBall.java │ │ │ │ ├── UltraBall.java │ │ │ │ ├── Item.java │ │ │ │ ├── ItemRare.java │ │ │ │ └── Pokeball.java │ │ │ │ └── entity │ │ │ │ └── Pokemon.java │ │ └── resources │ │ │ ├── application.yml │ │ │ └── sql │ │ │ └── populate-database.sql │ └── test │ │ └── java │ │ └── com │ │ └── jjeanjacques │ │ └── solid │ │ └── SolidApplicationTests.java ├── .gitignore ├── pom.xml ├── mvnw.cmd └── mvnw ├── pom.xml ├── LICENSE └── README.md /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /files/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjeanjacques10/solid/HEAD/files/logo.png -------------------------------------------------------------------------------- /solid-bad/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjeanjacques10/solid/HEAD/solid-bad/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /solid-good/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjeanjacques10/solid/HEAD/solid-good/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /solid-bad/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/exception/NotFoundPokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.exception; 2 | 3 | public class NotFoundPokemon extends RuntimeException { 4 | 5 | public NotFoundPokemon(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /solid-good/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/exception/InvalidTraining.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.exception; 2 | 3 | public class InvalidTraining extends RuntimeException { 4 | 5 | public InvalidTraining(String message) { 6 | super(message); 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/exception/UnreachablePokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.exception; 2 | 3 | public class UnreachablePokemon extends RuntimeException { 4 | public UnreachablePokemon(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/exception/UnsupportedOperation.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.exception; 2 | 3 | public class UnsupportedOperation extends RuntimeException { 4 | public UnsupportedOperation(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/exception/InvalidTraining.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.exception; 2 | 3 | public class InvalidTraining extends RuntimeException { 4 | 5 | public InvalidTraining(String message) { 6 | super(message); 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/exception/NotFoundPokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.exception; 2 | 3 | public class NotFoundPokemon extends RuntimeException { 4 | 5 | public NotFoundPokemon(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/enums/TypePokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.enums; 2 | 3 | public enum TypePokemon { 4 | 5 | GRASS, 6 | FIRE, 7 | NORMAL, 8 | POISON, 9 | ELECTRIC, 10 | FAIRY, 11 | GROUND, 12 | WATER, 13 | BUG 14 | 15 | } 16 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/Payment.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | 5 | import java.util.List; 6 | 7 | public interface Payment { 8 | boolean status(); 9 | List getItems(); 10 | } -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/exception/InvalidBusinessTransaction.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.exception; 2 | 3 | public class InvalidBusinessTransaction extends RuntimeException { 4 | 5 | public InvalidBusinessTransaction(String message) { 6 | super(message); 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/enums/TypePokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.enums; 2 | 3 | public enum TypePokemon { 4 | 5 | GRASS, 6 | FIRE, 7 | NORMAL, 8 | POISON, 9 | ELECTRIC, 10 | FAIRY, 11 | GROUND, 12 | WATER, 13 | BUG 14 | 15 | } 16 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/exception/InvalidBusinessTransaction.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.exception; 2 | 3 | public class InvalidBusinessTransaction extends RuntimeException { 4 | 5 | public InvalidBusinessTransaction(String message) { 6 | super(message); 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/Wallet.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | 5 | import java.util.List; 6 | 7 | public interface Wallet extends Payment { 8 | void initiatePayments(List items); 9 | } 10 | -------------------------------------------------------------------------------- /solid-bad/src/test/java/com/jjeanjacques/solid/SolidApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solid; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SolidApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /solid-good/src/test/java/com/jjeanjacques/solid/SolidApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solid; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SolidApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/Loan.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | 5 | import java.util.List; 6 | 7 | public interface Loan extends Payment { 8 | void intiateLoanSettlement(List items); 9 | List initiateRePayment(); 10 | } 11 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/TrainingDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | 8 | @Data 9 | @Builder 10 | public class TrainingDTO { 11 | 12 | private float intension; 13 | private LocalDateTime date; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/TrainingDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | 8 | @Data 9 | @Builder 10 | public class TrainingDTO { 11 | 12 | private float intension; 13 | private LocalDateTime date; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/TrainingService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | 6 | public interface TrainingService { 7 | 8 | PokemonDTO trainPokemon(PokemonDTO pokemon, TrainingDTO training); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/ReportService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.ReportCatchDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.ReportDTO; 5 | 6 | public interface ReportService { 7 | 8 | ReportDTO printReport(int month, int year) ; 9 | ReportCatchDTO showCatch(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/ReportDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | @Data 10 | @Builder 11 | public class ReportDTO { 12 | 13 | private Integer total; 14 | private Integer power; 15 | private LocalDateTime createdAt; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/training/TrainingValidation.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl.training; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | 6 | public interface TrainingValidation { 7 | 8 | void valid(PokemonDTO pokemon, TrainingDTO training); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/MarketService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.enums.ItemEnum; 4 | import com.jjeanjacques.solidgood.enums.ItemRareEnum; 5 | 6 | public interface MarketService { 7 | 8 | String buy(ItemEnum item); 9 | 10 | String sell(ItemEnum item); 11 | 12 | String sell(ItemRareEnum item); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/PaymentResponseDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class PaymentResponseDTO { 12 | 13 | private List items; 14 | private boolean status; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/PaymentLoanResponseDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class PaymentLoanResponseDTO { 12 | 13 | private List items; 14 | private boolean status; 15 | } 16 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/PaymentResponseDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class PaymentResponseDTO { 12 | 13 | private List items; 14 | private boolean status; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/SolidBadApplication.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SolidBadApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SolidBadApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/PaymentLoanResponseDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class PaymentLoanResponseDTO { 12 | 13 | private List items; 14 | private boolean status; 15 | } 16 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/ReportCatchDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class ReportCatchDTO { 12 | 13 | private int total; 14 | private LocalDateTime createdAt; 15 | private List pokemon; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/SolidGoodApplication.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SolidGoodApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SolidGoodApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/ItemMarketDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @Builder 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class ItemMarketDTO { 13 | 14 | private String item; 15 | private String action; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/ReportCatchDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | import java.time.LocalDateTime; 7 | import java.util.List; 8 | 9 | @Data 10 | @Builder 11 | public class ReportCatchDTO { 12 | 13 | private int total; 14 | private LocalDateTime createdAt; 15 | private List pokemon; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/interfaces/Payment.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.interfaces; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | 5 | import java.util.List; 6 | 7 | public interface Payment { 8 | void initiatePayments(List items); 9 | boolean status(); 10 | List getItems(); 11 | 12 | void initiateLoanSettlement(List items); 13 | List initiateRePayment(); 14 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/repository/dto/PowerTypeContract.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.repository.dto; 2 | 3 | import com.jjeanjacques.solidgood.enums.TypePokemon; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class PowerTypeContract { 12 | 13 | private TypePokemon type; 14 | private Long value; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/enums/ItemRareEnum.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.enums; 2 | 3 | import com.jjeanjacques.solidgood.domain.*; 4 | 5 | import java.math.BigDecimal; 6 | 7 | public enum ItemRareEnum { 8 | 9 | MASTERBALL { 10 | public ItemRare get() { 11 | return new MasterBall(BigDecimal.valueOf(10000.00), "location"); 12 | } 13 | }; 14 | 15 | public ItemRare get() { 16 | return null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/config/MapperConfig.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.config; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class MapperConfig { 9 | 10 | @Bean 11 | public ModelMapper modelMapper() { 12 | ModelMapper modelMapper = new ModelMapper(); 13 | return modelMapper; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/PaymentDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class PaymentDTO { 16 | 17 | private List items; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/ItemMarketDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.enums.ItemEnum; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public class ItemMarketDTO { 14 | 15 | private ItemEnum item; 16 | private String action; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /solid-bad/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | h2.console.enabled: true 3 | datasource: 4 | driver-class-name: org.h2.Driver 5 | username: sa 6 | password: password 7 | url: jdbc:h2:mem:mydb 8 | jpa: 9 | defer-datasource-initialization: true 10 | properties.hibernate.format_sql: true 11 | generate-ddl: true 12 | hibernate.ddl.auto: create 13 | database-platform: org.hibernate.dialect.H2Dialect 14 | properties.hibernate.hbm2ddl.import_files: sql/populate-database.sql -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/config/MapperConfig.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.config; 2 | 3 | import org.modelmapper.ModelMapper; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | @Configuration 8 | public class MapperConfig { 9 | 10 | @Bean 11 | public ModelMapper modelMapper() { 12 | ModelMapper modelMapper = new ModelMapper(); 13 | return modelMapper; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/PaymentDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @Builder 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | public class PaymentDTO { 16 | 17 | private List items; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /solid-good/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | h2.console.enabled: true 3 | datasource: 4 | driver-class-name: org.h2.Driver 5 | username: sa 6 | password: password 7 | url: jdbc:h2:mem:mydb 8 | jpa: 9 | defer-datasource-initialization: true 10 | properties.hibernate.format_sql: true 11 | generate-ddl: true 12 | hibernate.ddl.auto: create 13 | database-platform: org.hibernate.dialect.H2Dialect 14 | properties.hibernate.hbm2ddl.import_files: sql/populate-database.sql -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/ItemRareMarketDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.enums.ItemRareEnum; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | @Data 10 | @Builder 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public class ItemRareMarketDTO { 14 | 15 | private ItemRareEnum item; 16 | private String action; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/repository/PokemonRepository.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.repository; 2 | 3 | import com.jjeanjacques.solidgood.entity.Pokemon; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface PokemonRepository extends JpaRepository { 11 | 12 | List findAll(); 13 | 14 | Pokemon findByNameContaining(String name); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /solid-bad/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /solid-good/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/ReportDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.jjeanjacques.solidgood.repository.dto.PowerTypeContract; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | import java.util.List; 9 | 10 | @Data 11 | @Builder 12 | public class ReportDTO { 13 | 14 | private Integer total; 15 | private Integer power; 16 | private List categories; 17 | private LocalDateTime createdAt; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/domain/UltraBall.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.domain; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class UltraBall extends Item { 6 | 7 | public UltraBall(BigDecimal value) { 8 | super(value); 9 | } 10 | 11 | @Override 12 | public String buyItem() { 13 | return "You bought this Ultraball for $" + getValue(); 14 | } 15 | 16 | @Override 17 | public String sellItem() { 18 | return "You received $" + getValue() + ", it's very usefully and powerfully"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/domain/MasterBall.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.domain; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class MasterBall extends ItemRare { 6 | 7 | public MasterBall(BigDecimal value, String location) { 8 | super(value, location); 9 | } 10 | 11 | @Override 12 | public String sellItem() { 13 | return "You received $" + getValue() + ", it's a rare ball"; 14 | } 15 | 16 | @Override 17 | public String getLocation() { 18 | return super.getLocation(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/domain/UltraBall.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.domain; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class UltraBall extends Item { 6 | 7 | public UltraBall(BigDecimal value) { 8 | super(value); 9 | } 10 | 11 | @Override 12 | public String buyItem() { 13 | return "You bought this Ultraball for $" + getValue(); 14 | } 15 | 16 | @Override 17 | public String sellItem() { 18 | return "You received $" + getValue() + ", it's very usefully and powerfully"; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/PokedexService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.List; 7 | 8 | @Service 9 | public interface PokedexService { 10 | 11 | void calculateTotalSum(); 12 | List getAllPokemon(); 13 | PokemonDTO getPokemon(String name); 14 | PokemonDTO getPokemon(Long id); 15 | Long addPokemon(PokemonDTO pokemonDTO); 16 | void deletePokemon(Long id); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/domain/Item.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.domain; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public abstract class Item { 13 | 14 | private BigDecimal value; 15 | 16 | public String buyItem() { 17 | return "You bought this item for $" + value; 18 | } 19 | 20 | public String sellItem() { 21 | return "You received $" + value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/domain/Item.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.domain; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public abstract class Item { 13 | 14 | private BigDecimal value; 15 | 16 | public String buyItem() { 17 | return "You bought this item for $" + value; 18 | } 19 | 20 | public String sellItem() { 21 | return "You received $" + value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/domain/ItemRare.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.domain; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.math.BigDecimal; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public abstract class ItemRare { 13 | 14 | private BigDecimal value; 15 | private String location; 16 | 17 | public String getLocation() { 18 | return "Location of rare item: " + location; 19 | } 20 | 21 | public String sellItem() { 22 | return "You received $" + value; 23 | } 24 | } -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/domain/Pokeball.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.domain; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | public class Pokeball extends Item { 11 | 12 | public Pokeball(BigDecimal value) { 13 | super(value); 14 | } 15 | 16 | @Override 17 | public String buyItem() { 18 | return "You bought this Pokeball for $" + getValue(); 19 | } 20 | 21 | @Override 22 | public String sellItem() { 23 | return "You received $" + getValue() + ", it's very usefully"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/domain/Pokeball.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.domain; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import java.math.BigDecimal; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | public class Pokeball extends Item { 11 | 12 | public Pokeball(BigDecimal value) { 13 | super(value); 14 | } 15 | 16 | @Override 17 | public String buyItem() { 18 | return "You bought this Pokeball for $" + getValue(); 19 | } 20 | 21 | @Override 22 | public String sellItem() { 23 | return "You received $" + getValue() + ", it's very usefully"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/training/ValidatePokemonPowerLimit.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl.training; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidgood.exception.InvalidTraining; 6 | 7 | public class ValidatePokemonPowerLimit implements TrainingValidation { 8 | 9 | @Override 10 | public void valid(PokemonDTO pokemon, TrainingDTO training) { 11 | if (pokemon.getAttack() > 1000) 12 | throw new InvalidTraining("Pokemon attack cannot be greater than 1000"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/domain/MasterBall.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.domain; 2 | 3 | import com.jjeanjacques.solidbad.exception.InvalidBusinessTransaction; 4 | 5 | import java.math.BigDecimal; 6 | 7 | public class MasterBall extends Item { 8 | 9 | public MasterBall(BigDecimal value) { 10 | super(value); 11 | } 12 | 13 | @Override 14 | public String buyItem() { 15 | // You can't buy a MasterBall 16 | throw new InvalidBusinessTransaction("It's impossible buy this item"); 17 | } 18 | 19 | @Override 20 | public String sellItem() { 21 | return "You received $" + getValue() + ", it's a rare ball"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/enums/ItemEnum.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.enums; 2 | 3 | import com.jjeanjacques.solidgood.domain.Item; 4 | import com.jjeanjacques.solidgood.domain.Pokeball; 5 | import com.jjeanjacques.solidgood.domain.UltraBall; 6 | 7 | import java.math.BigDecimal; 8 | 9 | public enum ItemEnum { 10 | 11 | POKEBALL { 12 | public Item get() { 13 | return new Pokeball(BigDecimal.valueOf(10.00)); 14 | } 15 | }, 16 | ULTRABALL { 17 | public Item get() { 18 | return new UltraBall(BigDecimal.valueOf(1000.00)); 19 | } 20 | }; 21 | 22 | public Item get() { 23 | return null; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.jjeanjacques 8 | solid 9 | pom 10 | 1.0-SNAPSHOT 11 | 12 | solid-good 13 | solid-bad 14 | 15 | 16 | 17 | 13 18 | 13 19 | 20 | 21 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/training/ValidateDateLastWorkout.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl.training; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidgood.exception.InvalidTraining; 6 | 7 | import java.time.temporal.ChronoUnit; 8 | 9 | public class ValidateDateLastWorkout implements TrainingValidation { 10 | 11 | @Override 12 | public void valid(PokemonDTO pokemon, TrainingDTO training) { 13 | if (pokemon.getLastWorkout() != null) { 14 | var hoursBetweenDates = ChronoUnit.HOURS.between(pokemon.getLastWorkout(), training.getDate()); 15 | if (hoursBetweenDates < 8) 16 | throw new InvalidTraining("Your pokemon is tired, wait 8 hours"); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/WalletService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | import com.jjeanjacques.solidgood.service.Wallet; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Service 11 | public class WalletService implements Wallet { 12 | 13 | private List items; 14 | 15 | public WalletService() { 16 | this.items = new ArrayList<>(); 17 | } 18 | 19 | @Override 20 | public void initiatePayments(List items) { 21 | this.items.addAll(items); 22 | } 23 | 24 | @Override 25 | public boolean status() { 26 | return !this.items.isEmpty(); 27 | } 28 | 29 | @Override 30 | public List getItems() { 31 | return this.items; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/MarketServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.enums.ItemEnum; 4 | import com.jjeanjacques.solidgood.enums.ItemRareEnum; 5 | import com.jjeanjacques.solidgood.service.MarketService; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class MarketServiceImpl implements MarketService { 10 | 11 | @Override 12 | public String buy(ItemEnum item) { 13 | var itemSelected = item.get(); 14 | return itemSelected.buyItem(); 15 | } 16 | 17 | @Override 18 | public String sell(ItemEnum item) { 19 | var itemSelected = item.get(); 20 | return itemSelected.sellItem(); 21 | } 22 | 23 | @Override 24 | public String sell(ItemRareEnum item) { 25 | var itemSelected = item.get(); 26 | return itemSelected.sellItem(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/dto/PokemonDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | import javax.validation.constraints.NotNull; 10 | import java.time.LocalDateTime; 11 | 12 | @Data 13 | @Builder 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class PokemonDTO { 17 | 18 | private Long id; 19 | 20 | @NotNull 21 | private String name; 22 | private String description; 23 | private int hp; 24 | private int attack; 25 | private int defense; 26 | private int speed; 27 | private int total; 28 | @JsonProperty("image_url") 29 | private String imageUrl; 30 | @JsonProperty("captured_at") 31 | private LocalDateTime capturedAt; 32 | @JsonProperty("last_workout") 33 | private LocalDateTime lastWorkout; 34 | } 35 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/dto/PokemonDTO.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.jjeanjacques.solidgood.enums.TypePokemon; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import javax.validation.constraints.NotNull; 11 | import java.time.LocalDateTime; 12 | 13 | @Data 14 | @Builder 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | public class PokemonDTO { 18 | 19 | private Long id; 20 | 21 | @NotNull 22 | private String name; 23 | private String description; 24 | private int hp; 25 | private int attack; 26 | private int defense; 27 | private int speed; 28 | private int total; 29 | private TypePokemon type; 30 | @JsonProperty("image_url") 31 | private String imageUrl; 32 | @JsonProperty("captured_at") 33 | private LocalDateTime capturedAt; 34 | @JsonProperty("last_workout") 35 | private LocalDateTime lastWorkout; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/LoanService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.domain.Pokeball; 4 | import com.jjeanjacques.solidgood.service.Loan; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | @Service 11 | public class LoanService implements Loan { 12 | private List items; 13 | 14 | public LoanService() { 15 | this.items = new ArrayList<>(); 16 | } 17 | 18 | @Override 19 | public boolean status() { 20 | return !this.items.isEmpty(); 21 | } 22 | 23 | @Override 24 | public List getItems() { 25 | return this.items; 26 | } 27 | 28 | @Override 29 | public void intiateLoanSettlement(List items) { 30 | this.items.addAll(items); 31 | } 32 | 33 | @Override 34 | public List initiateRePayment() { 35 | var tmpItems = this.items; 36 | this.items.removeAll(this.items); 37 | return tmpItems; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2022 Scott Chacon and others 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/TrainingController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidbad.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidbad.service.PokedexService; 6 | import com.jjeanjacques.solidbad.service.TrainingService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | @RestController 12 | @RequestMapping("/training") 13 | public class TrainingController { 14 | 15 | @Autowired 16 | private PokedexService pokedexService; 17 | 18 | @Autowired 19 | private TrainingService trainingService; 20 | 21 | @PostMapping("/{id}") 22 | public ResponseEntity training(@PathVariable Long id, 23 | @RequestBody TrainingDTO trainingDTO) { 24 | var pokemon = pokedexService.getPokemon(id); 25 | var pokemonTrained = trainingService.trainPokemon(pokemon, trainingDTO); 26 | return ResponseEntity.ok(pokemonTrained); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/ReportController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.ReportCatchDTO; 4 | import com.jjeanjacques.solidbad.controller.dto.ReportDTO; 5 | import com.jjeanjacques.solidbad.service.PokedexService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @RestController 13 | @RequestMapping("/report") 14 | public class ReportController { 15 | 16 | @Autowired 17 | PokedexService pokedexService; 18 | 19 | @GetMapping("/catch") 20 | public ResponseEntity catchReport() { 21 | var report = pokedexService.showCatch(); 22 | return ResponseEntity.ok(report); 23 | } 24 | 25 | @GetMapping("/{year}/{month}") 26 | public ResponseEntity printReport() { 27 | var report = pokedexService.printReport(); 28 | return ResponseEntity.ok(report); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/entity/Pokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.entity; 2 | 3 | import com.jjeanjacques.solidbad.enums.TypePokemon; 4 | import lombok.*; 5 | 6 | import javax.persistence.*; 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | @Entity 11 | @Getter 12 | @Setter 13 | @Builder 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "Pokemon") 17 | public class Pokemon implements Serializable { 18 | private static final long serialVersionUID = 1L; 19 | 20 | @Id 21 | @GeneratedValue(strategy = GenerationType.IDENTITY) 22 | private Long id; 23 | 24 | private String name; 25 | 26 | @Column(columnDefinition = "TEXT") 27 | private String description; 28 | private int hp; 29 | private int attack; 30 | private int defense; 31 | private int speed; 32 | private int total; 33 | 34 | @Enumerated(EnumType.STRING) 35 | private TypePokemon type; 36 | 37 | @Column(name = "image_url", columnDefinition = "TEXT") 38 | private String imageUrl; 39 | 40 | @Column(name = "captured_at") 41 | private LocalDateTime capturedAt; 42 | 43 | @Column(name = "last_workout") 44 | private LocalDateTime lastWorkout; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/entity/Pokemon.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.entity; 2 | 3 | import com.jjeanjacques.solidgood.enums.TypePokemon; 4 | import lombok.*; 5 | 6 | import javax.persistence.*; 7 | import java.io.Serializable; 8 | import java.time.LocalDateTime; 9 | 10 | @Entity 11 | @Getter 12 | @Setter 13 | @Builder 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "Pokemon") 17 | public class Pokemon implements Serializable { 18 | private static final long serialVersionUID = 1L; 19 | 20 | @Id 21 | @GeneratedValue(strategy = GenerationType.IDENTITY) 22 | private Long id; 23 | 24 | private String name; 25 | 26 | @Column(columnDefinition = "TEXT") 27 | private String description; 28 | private int hp; 29 | private int attack; 30 | private int defense; 31 | private int speed; 32 | private int total; 33 | 34 | @Enumerated(EnumType.STRING) 35 | private TypePokemon type; 36 | 37 | @Column(name = "image_url", columnDefinition = "TEXT") 38 | private String imageUrl; 39 | 40 | @Column(name = "captured_at") 41 | private LocalDateTime capturedAt; 42 | 43 | @Column(name = "last_workout") 44 | private LocalDateTime lastWorkout; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/service/WalletService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.service; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | import com.jjeanjacques.solidbad.exception.UnsupportedOperation; 5 | import com.jjeanjacques.solidbad.interfaces.Payment; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @Service 12 | public class WalletService implements Payment { 13 | 14 | private List items; 15 | 16 | public WalletService() { 17 | this.items = new ArrayList<>(); 18 | } 19 | 20 | @Override 21 | public void initiatePayments(List items) { 22 | this.items.addAll(items); 23 | } 24 | 25 | @Override 26 | public boolean status() { 27 | return !this.items.isEmpty(); 28 | } 29 | 30 | @Override 31 | public List getItems() { 32 | return this.items; 33 | } 34 | 35 | @Override 36 | public void initiateLoanSettlement(List items) { 37 | throw new UnsupportedOperation("This is not a loan payment"); 38 | } 39 | 40 | @Override 41 | public List initiateRePayment() { 42 | throw new UnsupportedOperation("This is not a loan payment"); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/MarketController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.ItemMarketDTO; 4 | import com.jjeanjacques.solidbad.service.MarketService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.PostMapping; 8 | import org.springframework.web.bind.annotation.RequestBody; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @RestController 13 | @RequestMapping("/market") 14 | public class MarketController { 15 | 16 | @Autowired 17 | private MarketService marketService; 18 | 19 | @PostMapping 20 | public ResponseEntity buyItem(@RequestBody ItemMarketDTO itemMarketDTO) { 21 | var response = "Select valid action"; 22 | if ("buy".equalsIgnoreCase(itemMarketDTO.getAction())) { 23 | response = marketService.buy(itemMarketDTO.getItem()); 24 | } else if ("sell".equalsIgnoreCase(itemMarketDTO.getAction())) { 25 | response = marketService.sell(itemMarketDTO.getItem()); 26 | } 27 | return ResponseEntity.ok(response); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/repository/ReportRepository.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.repository; 2 | 3 | import com.jjeanjacques.solidgood.entity.Pokemon; 4 | import com.jjeanjacques.solidgood.repository.dto.PowerTypeContract; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.List; 10 | 11 | @Repository 12 | public interface ReportRepository extends JpaRepository { 13 | 14 | @Query("SELECT COUNT(p) FROM Pokemon p WHERE year(p.capturedAt) = :year AND month(p.capturedAt) = :month") 15 | Integer totalPokemon(int year, int month); 16 | 17 | @Query("SELECT COUNT(p) FROM Pokemon p") 18 | Integer totalPokemon(); 19 | 20 | @Query("SELECT SUM(p.attack) FROM Pokemon p WHERE year(p.capturedAt) = :year AND month(p.capturedAt) = :month") 21 | Integer totalPowerPokemon(int year, int month); 22 | 23 | @Query("SELECT new com.jjeanjacques.solidgood.repository.dto.PowerTypeContract(p.type, sum(p.attack)) FROM Pokemon p " + 24 | "WHERE year(p.capturedAt) = :year AND month(p.capturedAt) = :month " + 25 | "GROUP BY p.type") 26 | List getAttackByType(int year, int month); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/service/LoanService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.service; 2 | 3 | import com.jjeanjacques.solidbad.domain.Pokeball; 4 | import com.jjeanjacques.solidbad.exception.UnsupportedOperation; 5 | import com.jjeanjacques.solidbad.interfaces.Payment; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @Service 12 | public class LoanService implements Payment { 13 | private List items; 14 | 15 | public LoanService() { 16 | this.items = new ArrayList<>(); 17 | } 18 | 19 | @Override 20 | public void initiatePayments(List items) { 21 | throw new UnsupportedOperation("This is not a wallet payment"); 22 | } 23 | 24 | @Override 25 | public boolean status() { 26 | return !this.items.isEmpty(); 27 | } 28 | 29 | @Override 30 | public List getItems() { 31 | return this.items; 32 | } 33 | 34 | @Override 35 | public void initiateLoanSettlement(List items) { 36 | this.items.addAll(items); 37 | } 38 | 39 | @Override 40 | public List initiateRePayment() { 41 | var tmpItems = this.items; 42 | this.items.removeAll(this.items); 43 | return tmpItems; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/ReportController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.ReportCatchDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.ReportDTO; 5 | import com.jjeanjacques.solidgood.service.ReportService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | @RequestMapping("/report") 15 | public class ReportController { 16 | 17 | @Autowired 18 | private ReportService reportService; 19 | 20 | @GetMapping("/catch") 21 | public ResponseEntity catchReport() { 22 | var report = reportService.showCatch(); 23 | return ResponseEntity.ok(report); 24 | } 25 | 26 | @GetMapping("/{year}/{month}") 27 | public ResponseEntity printReport(@PathVariable int year, @PathVariable int month) { 28 | var report = reportService.printReport(year, month); 29 | return ResponseEntity.ok(report); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/PokedexController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidbad.service.PokedexService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | @RestController 10 | @RequestMapping("/pokedex") 11 | public class PokedexController { 12 | 13 | @Autowired 14 | PokedexService pokedexService; 15 | 16 | @GetMapping("/pokemon") 17 | public ResponseEntity getAll(@RequestParam(required = false) String name) { 18 | if (name != null) { 19 | return ResponseEntity.ok(pokedexService.getPokemon(name)); 20 | } 21 | return ResponseEntity.ok(pokedexService.getAllPokemon()); 22 | } 23 | 24 | @DeleteMapping("/pokemon") 25 | public ResponseEntity delete(@PathVariable Long id) { 26 | pokedexService.deletePokemon(id); 27 | return ResponseEntity.ok("Pokemon id [" + id + "] deleted"); 28 | } 29 | 30 | @PostMapping("/pokemon") 31 | public ResponseEntity create(@RequestBody PokemonDTO pokemonDTO) { 32 | var id = pokedexService.addPokemon(pokemonDTO); 33 | return ResponseEntity.ok("Pokemon id [" + id + "] created"); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/PokedexController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.service.PokedexService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | @RestController 10 | @RequestMapping("/pokedex") 11 | public class PokedexController { 12 | 13 | @Autowired 14 | private PokedexService pokedexService; 15 | 16 | @GetMapping("/pokemon") 17 | public ResponseEntity getAll(@RequestParam(required = false) String name) { 18 | if (name != null) { 19 | return ResponseEntity.ok(pokedexService.getPokemon(name)); 20 | } 21 | return ResponseEntity.ok(pokedexService.getAllPokemon()); 22 | } 23 | 24 | @DeleteMapping("/pokemon") 25 | public ResponseEntity delete(@PathVariable Long id) { 26 | pokedexService.deletePokemon(id); 27 | return ResponseEntity.ok("Pokemon id [" + id + "] deleted"); 28 | } 29 | 30 | @PostMapping("/pokemon") 31 | public ResponseEntity create(@RequestBody PokemonDTO pokemonDTO) { 32 | var id = pokedexService.addPokemon(pokemonDTO); 33 | return ResponseEntity.ok("Pokemon id [" + id + "] created"); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/service/MarketService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.service; 2 | 3 | import com.jjeanjacques.solidbad.domain.Item; 4 | import com.jjeanjacques.solidbad.domain.MasterBall; 5 | import com.jjeanjacques.solidbad.domain.Pokeball; 6 | import com.jjeanjacques.solidbad.domain.UltraBall; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.math.BigDecimal; 10 | 11 | @Service 12 | public class MarketService { 13 | 14 | public String buy(String item) { 15 | Item itemSelected = new Pokeball(BigDecimal.TEN); 16 | switch (item.toUpperCase()) { 17 | case "POKEBALL": 18 | itemSelected = new Pokeball(BigDecimal.TEN); 19 | break; 20 | case "MASTERBALL": 21 | itemSelected = new MasterBall(BigDecimal.valueOf(1000.0)); 22 | break; 23 | case "ULTRABALL": 24 | itemSelected = new UltraBall(BigDecimal.valueOf(1000.0)); 25 | break; 26 | } 27 | return itemSelected.buyItem(); 28 | } 29 | 30 | public String sell(String item) { 31 | Item itemSelected = new Pokeball(BigDecimal.TEN); 32 | switch (item) { 33 | case "POKEBALL": 34 | itemSelected = new Pokeball(BigDecimal.TEN); 35 | case "MASTERBALL": 36 | itemSelected = new MasterBall(BigDecimal.valueOf(1000.0)); 37 | case "ULTRABALL": 38 | itemSelected = new UltraBall(BigDecimal.valueOf(1000.0)); 39 | } 40 | return itemSelected.sellItem(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/MarketController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.ItemMarketDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.ItemRareMarketDTO; 5 | import com.jjeanjacques.solidgood.service.MarketService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.PostMapping; 9 | import org.springframework.web.bind.annotation.RequestBody; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | @RequestMapping("/market") 15 | public class MarketController { 16 | 17 | @Autowired 18 | private MarketService marketService; 19 | 20 | @PostMapping 21 | public ResponseEntity buyItem(@RequestBody ItemMarketDTO itemMarketDTO) { 22 | var response = "Select valid action"; 23 | if ("buy".equalsIgnoreCase(itemMarketDTO.getAction())) { 24 | response = marketService.buy(itemMarketDTO.getItem()); 25 | } else if ("sell".equalsIgnoreCase(itemMarketDTO.getAction())) { 26 | response = marketService.sell(itemMarketDTO.getItem()); 27 | } 28 | return ResponseEntity.ok(response); 29 | } 30 | 31 | @PostMapping("/rare") 32 | public ResponseEntity sellRareItem(@RequestBody ItemRareMarketDTO itemRareMarketDTO) { 33 | var response = marketService.sell(itemRareMarketDTO.getItem()); 34 | return ResponseEntity.ok(response); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

SOLID Geek

3 | 4 |
5 | 6 | Projeto desenvolvido para explicar os conceitos do SOLID e Orientação a Objetos. Neste repositório temos uma aplicação 7 | desenvolvida utilizando as melhores práticas ([solid-good](./solid-good)) e outra com exemplos de como não deve ser 8 | feito ([solid-bad](./solid-bad)). Apresentação realizada no TDC Connections 2022! 9 | 10 | ``"A verdadeira prova de um bom código é o quão fácil é mudá-lo" - Martin Fowler `` 11 | 12 | ## Tecnologias 13 | 14 | - Java 11 15 | - Spring Framework 16 | - H2 Database 17 | 18 | ## Princípios 19 | 20 | - **S:** Single-responsiblity Principle (SRP) 21 | - **O:** Open-closed Principle (OSP) 22 | - **L:** Liskov Substitution Principle (LSP) 23 | - **I:** Interface Segregation Principle (ISP) 24 | - **D:** Dependency Inversion Principle (DIP) 25 | 26 | ## Funcionalidades 27 | 28 | - Pokedex 29 | - Create 30 | - Read 31 | - Relatório 32 | - Geral 33 | - Pokemons Capturados 34 | - Loja 35 | - Compra de Itens 36 | - Venda de Itens 37 | - Treinamento 38 | - Treino 39 | - Payment 40 | - Fluxo de Pagamento de Pokeballs 41 | 42 | ## Artigo 43 | 44 | Os princípios implementados neste projeto foram explicados no seguinte artigo: 45 | 46 | https://jjeanjacques10.medium.com/tornando-seu-c%C3%B3digo-mais-solid-fabc10ce7ca3 47 | 48 | ## Collections 49 | 50 | Os endpoints podem ser encontrados no arquivo [SOLID Pokemon.postman_collection.json](/files/SOLID%20Pokemon.postman_collection.json) 51 | 52 | ## License 53 | 54 | Distribuido sobre a licença MIT. Veja o arquivo [`LICENSE`](LICENSE) para mais informações. 55 | 56 | --- 57 | Desenvolvido por [Jean J. Barros](https://github.com/jjeanjacques10/) -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/service/TrainingService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.service; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidbad.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidbad.entity.Pokemon; 6 | import com.jjeanjacques.solidbad.exception.InvalidTraining; 7 | import org.modelmapper.ModelMapper; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.time.LocalDateTime; 12 | import java.time.temporal.ChronoUnit; 13 | 14 | @Service 15 | public class TrainingService { 16 | 17 | @Autowired 18 | PokedexService pokedexService; 19 | 20 | @Autowired 21 | ModelMapper modelMapper; 22 | 23 | public PokemonDTO trainPokemon(PokemonDTO pokemon, TrainingDTO training) { 24 | if (pokemon.getLastWorkout() != null) { 25 | var hoursBetweenDates = ChronoUnit.HOURS.between(pokemon.getLastWorkout(), LocalDateTime.now()); 26 | if (hoursBetweenDates < 8) { 27 | throw new InvalidTraining("Your pokemon is tired, wait 8 hours"); 28 | } 29 | } 30 | 31 | if (pokemon.getAttack() > 1000) { 32 | throw new InvalidTraining("Pokemon attack cannot be greater than 1000"); 33 | } 34 | 35 | int newAttack = Math.round(pokemon.getAttack() + (pokemon.getAttack() * (training.getIntension() / 100))); 36 | int newDefense = Math.round(pokemon.getDefense() + (pokemon.getDefense() * (training.getIntension() / 100))); 37 | pokemon.setAttack(newAttack); 38 | pokemon.setDefense(newDefense); 39 | pokemon.setLastWorkout(LocalDateTime.now()); 40 | pokedexService.update(modelMapper.map(pokemon, Pokemon.class)); 41 | return pokemon; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/PaymentController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PaymentDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.PaymentLoanResponseDTO; 5 | import com.jjeanjacques.solidgood.controller.dto.PaymentResponseDTO; 6 | import com.jjeanjacques.solidgood.service.Loan; 7 | import com.jjeanjacques.solidgood.service.Wallet; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | @RestController 16 | @RequestMapping("/payment") 17 | public class PaymentController { 18 | 19 | @Autowired 20 | Wallet wallet; 21 | 22 | @Autowired 23 | Loan loan; 24 | 25 | @PostMapping("/wallet") 26 | public ResponseEntity wallet(@RequestBody PaymentDTO paymentDTO) { 27 | wallet.initiatePayments(paymentDTO.getItems()); 28 | 29 | var paymentResponse = PaymentResponseDTO.builder() 30 | .status(wallet.status()) 31 | .items(wallet.getItems()) 32 | .build(); 33 | 34 | return ResponseEntity.ok(paymentResponse); 35 | } 36 | 37 | @PostMapping("/loan") 38 | public ResponseEntity loan(@RequestBody PaymentDTO paymentDTO) { 39 | loan.intiateLoanSettlement(paymentDTO.getItems()); 40 | 41 | var paymentResponse = PaymentLoanResponseDTO.builder() 42 | .status(loan.status()) 43 | .items(loan.getItems()) 44 | .build(); 45 | 46 | return ResponseEntity.ok(paymentResponse); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/controller/PaymentController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.controller; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.PaymentDTO; 4 | import com.jjeanjacques.solidbad.controller.dto.PaymentLoanResponseDTO; 5 | import com.jjeanjacques.solidbad.controller.dto.PaymentResponseDTO; 6 | import com.jjeanjacques.solidbad.interfaces.Payment; 7 | import com.jjeanjacques.solidbad.service.LoanService; 8 | import com.jjeanjacques.solidbad.service.WalletService; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | @RestController 16 | @RequestMapping("/payment") 17 | public class PaymentController { 18 | 19 | Payment payment; 20 | 21 | @PostMapping("/wallet") 22 | public ResponseEntity wallet(@RequestBody PaymentDTO paymentDTO) { 23 | payment = new WalletService(); 24 | payment.initiatePayments(paymentDTO.getItems()); 25 | 26 | var paymentResponse = PaymentResponseDTO.builder() 27 | .status(payment.status()) 28 | .items(payment.getItems()) 29 | .build(); 30 | 31 | return ResponseEntity.ok(paymentResponse); 32 | } 33 | 34 | @PostMapping("/loan") 35 | public ResponseEntity loan(@RequestBody PaymentDTO paymentDTO) { 36 | payment = new LoanService(); 37 | payment.initiateLoanSettlement(paymentDTO.getItems()); 38 | 39 | var paymentResponse = PaymentLoanResponseDTO.builder() 40 | .status(payment.status()) 41 | .items(payment.getItems()) 42 | .build(); 43 | 44 | return ResponseEntity.ok(paymentResponse); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/controller/TrainingController.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.controller; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidgood.repository.PokemonRepository; 6 | import com.jjeanjacques.solidgood.service.PokedexService; 7 | import com.jjeanjacques.solidgood.service.TrainingService; 8 | import com.jjeanjacques.solidgood.service.impl.TrainingServiceImpl; 9 | import com.jjeanjacques.solidgood.service.impl.training.TrainingValidation; 10 | import com.jjeanjacques.solidgood.service.impl.training.ValidateDateLastWorkout; 11 | import com.jjeanjacques.solidgood.service.impl.training.ValidatePokemonPowerLimit; 12 | import org.modelmapper.ModelMapper; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.http.ResponseEntity; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import java.util.List; 18 | 19 | @RestController 20 | @RequestMapping("/training") 21 | public class TrainingController { 22 | 23 | @Autowired 24 | private PokedexService pokedexService; 25 | 26 | @Autowired 27 | private PokemonRepository pokemonRepository; 28 | 29 | private TrainingService trainingService; 30 | 31 | @PostMapping("/{id}") 32 | public ResponseEntity training(@PathVariable Long id, 33 | @RequestBody TrainingDTO trainingDTO) { 34 | setValidacoes(); 35 | var pokemon = pokedexService.getPokemon(id); 36 | var pokemonTrained = trainingService.trainPokemon(pokemon, trainingDTO); 37 | return ResponseEntity.ok(pokemonTrained); 38 | } 39 | 40 | private void setValidacoes() { 41 | List validations = List.of(new ValidateDateLastWorkout(), new ValidatePokemonPowerLimit()); 42 | this.trainingService = new TrainingServiceImpl(validations, new ModelMapper(), pokemonRepository); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/TrainingServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.TrainingDTO; 5 | import com.jjeanjacques.solidgood.entity.Pokemon; 6 | import com.jjeanjacques.solidgood.repository.PokemonRepository; 7 | import com.jjeanjacques.solidgood.service.TrainingService; 8 | import com.jjeanjacques.solidgood.service.impl.training.TrainingValidation; 9 | import org.modelmapper.ModelMapper; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.time.LocalDateTime; 14 | import java.util.List; 15 | 16 | @Service 17 | public class TrainingServiceImpl implements TrainingService { 18 | 19 | private final PokemonRepository pokemonRepository; 20 | 21 | private final ModelMapper modelMapper; 22 | 23 | public List validations; 24 | 25 | @Autowired 26 | public TrainingServiceImpl(List validations, ModelMapper modelMapper, PokemonRepository pokemonRepository) { 27 | this.validations = validations; 28 | this.modelMapper = modelMapper; 29 | this.pokemonRepository = pokemonRepository; 30 | } 31 | 32 | public PokemonDTO trainPokemon(PokemonDTO pokemon, TrainingDTO training) { 33 | validations.forEach(v -> v.valid(pokemon, training)); 34 | setNewAttributes(pokemon, training); 35 | return pokemon; 36 | } 37 | 38 | private void setNewAttributes(PokemonDTO pokemon, TrainingDTO training) { 39 | int newAttack = Math.round(pokemon.getAttack() + (pokemon.getAttack() * (training.getIntension() / 100))); 40 | int newDefense = Math.round(pokemon.getDefense() + (pokemon.getDefense() * (training.getIntension() / 100))); 41 | pokemon.setAttack(newAttack); 42 | pokemon.setDefense(newDefense); 43 | pokemon.setLastWorkout(LocalDateTime.now()); 44 | pokemonRepository.save(modelMapper.map(pokemon, Pokemon.class)); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/ReportServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.controller.dto.ReportCatchDTO; 5 | import com.jjeanjacques.solidgood.controller.dto.ReportDTO; 6 | import com.jjeanjacques.solidgood.repository.PokemonRepository; 7 | import com.jjeanjacques.solidgood.repository.ReportRepository; 8 | import com.jjeanjacques.solidgood.service.ReportService; 9 | import org.modelmapper.ModelMapper; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.time.LocalDateTime; 14 | import java.util.stream.Collectors; 15 | 16 | @Service 17 | public class ReportServiceImpl implements ReportService { 18 | 19 | @Autowired 20 | private ReportRepository reportRepository; 21 | 22 | @Autowired 23 | private PokemonRepository pokemonRepository; 24 | 25 | @Autowired 26 | private ModelMapper modelMapper; 27 | 28 | @Override 29 | public ReportDTO printReport(int month, int year) { 30 | var totalPokemon = reportRepository.totalPokemon(month, year); 31 | var power = reportRepository.totalPowerPokemon(month, year); 32 | var categories = reportRepository.getAttackByType(month, year); 33 | 34 | return ReportDTO.builder() 35 | .total(totalPokemon) 36 | .power(power) 37 | .categories(categories) 38 | .createdAt(LocalDateTime.now()) 39 | .build(); 40 | } 41 | 42 | @Override 43 | public ReportCatchDTO showCatch() { 44 | var totalPokemon = reportRepository.totalPokemon(); 45 | var pokemons = pokemonRepository.findAll(); 46 | 47 | return ReportCatchDTO.builder() 48 | .total(totalPokemon) 49 | .pokemon(pokemons.stream().map(p -> modelMapper.map(p, PokemonDTO.class)) 50 | .collect(Collectors.toList())) 51 | .createdAt(LocalDateTime.now()) 52 | .build(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /solid-bad/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.6.4 9 | 10 | 11 | com.jjeanjacques 12 | solid-bad 13 | 0.0.1-SNAPSHOT 14 | solidbad 15 | Demo project for Spring Boot 16 | 17 | 11 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-validation 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | 34 | org.projectlombok 35 | lombok 36 | true 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-test 41 | test 42 | 43 | 44 | org.modelmapper 45 | modelmapper 46 | 2.4.5 47 | 48 | 49 | 50 | com.h2database 51 | h2 52 | runtime 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-maven-plugin 61 | 62 | 63 | 64 | org.projectlombok 65 | lombok 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /solid-good/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.6.4 9 | 10 | 11 | com.jjeanjacques 12 | solid-good 13 | 0.0.1-SNAPSHOT 14 | solidgood 15 | Demo project for Spring Boot 16 | 17 | 11 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-validation 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | 34 | org.projectlombok 35 | lombok 36 | true 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-test 41 | test 42 | 43 | 44 | org.modelmapper 45 | modelmapper 46 | 2.4.5 47 | 48 | 49 | 50 | com.h2database 51 | h2 52 | runtime 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-maven-plugin 61 | 62 | 63 | 64 | org.projectlombok 65 | lombok 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /solid-good/src/main/java/com/jjeanjacques/solidgood/service/impl/PokedexServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidgood.service.impl; 2 | 3 | import com.jjeanjacques.solidgood.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidgood.entity.Pokemon; 5 | import com.jjeanjacques.solidgood.exception.NotFoundPokemon; 6 | import com.jjeanjacques.solidgood.repository.PokemonRepository; 7 | import com.jjeanjacques.solidgood.service.PokedexService; 8 | import org.modelmapper.ModelMapper; 9 | import org.springframework.stereotype.Service; 10 | 11 | import javax.transaction.Transactional; 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | @Service 16 | public class PokedexServiceImpl implements PokedexService { 17 | 18 | private PokemonRepository pokemonRepository; 19 | private ModelMapper modelMapper; 20 | 21 | public PokedexServiceImpl(PokemonRepository pokemonRepository, 22 | ModelMapper modelMapper) { 23 | this.pokemonRepository = pokemonRepository; 24 | this.modelMapper = modelMapper; 25 | } 26 | 27 | @Override 28 | public List getAllPokemon() { 29 | var pokemons = pokemonRepository.findAll(); 30 | return pokemons.stream().map(p -> modelMapper.map(p, PokemonDTO.class)) 31 | .collect(Collectors.toList()); 32 | } 33 | 34 | @Override 35 | public PokemonDTO getPokemon(String name) { 36 | var pokemon = pokemonRepository.findByNameContaining(name); 37 | if (pokemon == null) 38 | throw new NotFoundPokemon("Pokemon with name " + name + " not found"); 39 | return modelMapper.map(pokemon, PokemonDTO.class); 40 | } 41 | 42 | @Override 43 | public PokemonDTO getPokemon(Long id) { 44 | var pokemon = pokemonRepository.findById(id).get(); 45 | if (pokemon == null) 46 | throw new NotFoundPokemon("Pokemon with id " + id + " not found"); 47 | return modelMapper.map(pokemon, PokemonDTO.class); 48 | } 49 | 50 | @Override 51 | @Transactional 52 | public Long addPokemon(PokemonDTO pokemonDTO) { 53 | var pokemon = modelMapper.map(pokemonDTO, Pokemon.class); 54 | var pokemonSaved = pokemonRepository.save(pokemon); 55 | return pokemonSaved.getId(); 56 | } 57 | 58 | @Override 59 | @Transactional 60 | public void deletePokemon(Long id) { 61 | if (pokemonRepository.existsById(id)) 62 | throw new NotFoundPokemon("Pokemon with id " + id + " not found"); 63 | pokemonRepository.deleteById(id); 64 | } 65 | 66 | @Override 67 | public void calculateTotalSum() { 68 | // No Implemented 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /solid-bad/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /solid-good/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /files/SOLID Pokemon.postman_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "_postman_id": "50c97683-5355-4cc7-b8c4-0c27af6aa462", 4 | "name": "SOLID Pokemon", 5 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" 6 | }, 7 | "item": [ 8 | { 9 | "name": "Report", 10 | "item": [ 11 | { 12 | "name": "Report", 13 | "request": { 14 | "method": "GET", 15 | "header": [], 16 | "url": { 17 | "raw": "{{base_url}}/report/2022/3", 18 | "host": [ 19 | "{{base_url}}" 20 | ], 21 | "path": [ 22 | "report", 23 | "2022", 24 | "3" 25 | ] 26 | } 27 | }, 28 | "response": [] 29 | }, 30 | { 31 | "name": "Report Catch", 32 | "request": { 33 | "method": "GET", 34 | "header": [], 35 | "url": { 36 | "raw": "{{base_url}}/report/catch", 37 | "host": [ 38 | "{{base_url}}" 39 | ], 40 | "path": [ 41 | "report", 42 | "catch" 43 | ] 44 | } 45 | }, 46 | "response": [] 47 | } 48 | ] 49 | }, 50 | { 51 | "name": "Training", 52 | "item": [ 53 | { 54 | "name": "Training Pokemon", 55 | "request": { 56 | "method": "POST", 57 | "header": [], 58 | "body": { 59 | "mode": "raw", 60 | "raw": "{\r\n \"intension\": 100,\r\n \"date\": \"2022-08-04T10:11:30\"\r\n}", 61 | "options": { 62 | "raw": { 63 | "language": "json" 64 | } 65 | } 66 | }, 67 | "url": { 68 | "raw": "{{base_url}}/training/4", 69 | "host": [ 70 | "{{base_url}}" 71 | ], 72 | "path": [ 73 | "training", 74 | "4" 75 | ], 76 | "query": [ 77 | { 78 | "key": "name", 79 | "value": "Pikachu", 80 | "disabled": true 81 | } 82 | ] 83 | } 84 | }, 85 | "response": [] 86 | } 87 | ] 88 | }, 89 | { 90 | "name": "Market", 91 | "item": [ 92 | { 93 | "name": "Buy/Sell Item", 94 | "request": { 95 | "method": "POST", 96 | "header": [], 97 | "body": { 98 | "mode": "raw", 99 | "raw": "{\r\n \"action\": \"buy\",\r\n \"item\": \"POKEBALL\"\r\n}", 100 | "options": { 101 | "raw": { 102 | "language": "json" 103 | } 104 | } 105 | }, 106 | "url": { 107 | "raw": "{{base_url}}/market", 108 | "host": [ 109 | "{{base_url}}" 110 | ], 111 | "path": [ 112 | "market" 113 | ], 114 | "query": [ 115 | { 116 | "key": "name", 117 | "value": "Pikachu", 118 | "disabled": true 119 | } 120 | ] 121 | } 122 | }, 123 | "response": [] 124 | } 125 | ] 126 | }, 127 | { 128 | "name": "Payment", 129 | "item": [ 130 | { 131 | "name": "Wallet", 132 | "request": { 133 | "method": "POST", 134 | "header": [], 135 | "body": { 136 | "mode": "raw", 137 | "raw": "{\r\n \"items\": [\r\n {\r\n \"value\": 10\r\n },\r\n {\r\n \"value\": 20\r\n }\r\n ]\r\n}", 138 | "options": { 139 | "raw": { 140 | "language": "json" 141 | } 142 | } 143 | }, 144 | "url": { 145 | "raw": "{{base_url}}/payment/wallet", 146 | "host": [ 147 | "{{base_url}}" 148 | ], 149 | "path": [ 150 | "payment", 151 | "wallet" 152 | ] 153 | } 154 | }, 155 | "response": [] 156 | }, 157 | { 158 | "name": "Loan", 159 | "request": { 160 | "method": "POST", 161 | "header": [], 162 | "body": { 163 | "mode": "raw", 164 | "raw": "{\r\n \"items\": [\r\n {\r\n \"value\": 10\r\n },\r\n {\r\n \"value\": 20\r\n }\r\n ]\r\n}", 165 | "options": { 166 | "raw": { 167 | "language": "json" 168 | } 169 | } 170 | }, 171 | "url": { 172 | "raw": "{{base_url}}/payment/loan", 173 | "host": [ 174 | "{{base_url}}" 175 | ], 176 | "path": [ 177 | "payment", 178 | "loan" 179 | ] 180 | } 181 | }, 182 | "response": [] 183 | } 184 | ] 185 | }, 186 | { 187 | "name": "Get All", 188 | "request": { 189 | "method": "GET", 190 | "header": [], 191 | "url": { 192 | "raw": "{{base_url}}/pokedex/pokemon", 193 | "host": [ 194 | "{{base_url}}" 195 | ], 196 | "path": [ 197 | "pokedex", 198 | "pokemon" 199 | ], 200 | "query": [ 201 | { 202 | "key": "name", 203 | "value": "Pikachu", 204 | "disabled": true 205 | } 206 | ] 207 | } 208 | }, 209 | "response": [] 210 | }, 211 | { 212 | "name": "Get By Name", 213 | "request": { 214 | "method": "GET", 215 | "header": [], 216 | "url": { 217 | "raw": "{{base_url}}/pokedex/pokemon?name=Pikachu", 218 | "host": [ 219 | "{{base_url}}" 220 | ], 221 | "path": [ 222 | "pokedex", 223 | "pokemon" 224 | ], 225 | "query": [ 226 | { 227 | "key": "name", 228 | "value": "Pikachu" 229 | } 230 | ] 231 | } 232 | }, 233 | "response": [] 234 | }, 235 | { 236 | "name": "Create", 237 | "request": { 238 | "method": "POST", 239 | "header": [], 240 | "body": { 241 | "mode": "raw", 242 | "raw": "{\r\n \"name\": \"Vileplume\",\r\n \"description\": \"Vileplume has the world’s largest petals. They are used to attract prey that are then doused with toxic spores. Once the prey are immobilized, this Pokémon catches and devours them.\",\r\n \"hp\": 75,\r\n \"attack\": 80,\r\n \"defense\": 85,\r\n \"speed\": 50,\r\n \"total\": 50,\r\n \"generation\": 45,\r\n \"legendary\": 0,\r\n \"imageUrl\": \"https://assets.pokemon.com/assets/cms2/img/pokedex/full/045.png\"\r\n}", 243 | "options": { 244 | "raw": { 245 | "language": "json" 246 | } 247 | } 248 | }, 249 | "url": { 250 | "raw": "{{base_url}}/pokedex/pokemon", 251 | "host": [ 252 | "{{base_url}}" 253 | ], 254 | "path": [ 255 | "pokedex", 256 | "pokemon" 257 | ] 258 | } 259 | }, 260 | "response": [] 261 | }, 262 | { 263 | "name": "Delete", 264 | "request": { 265 | "method": "DELETE", 266 | "header": [], 267 | "body": { 268 | "mode": "raw", 269 | "raw": "{\r\n \"id\": 45,\r\n \"name\": \"Vileplume\",\r\n \"description\": \"Vileplume has the world’s largest petals. They are used to attract prey that are then doused with toxic spores. Once the prey are immobilized, this Pokémon catches and devours them.\",\r\n \"hp\": 75,\r\n \"attack\": 80,\r\n \"defense\": 85,\r\n \"speed\": 50,\r\n \"total\": 50,\r\n \"generation\": 45,\r\n \"legendary\": 0\r\n}", 270 | "options": { 271 | "raw": { 272 | "language": "json" 273 | } 274 | } 275 | }, 276 | "url": { 277 | "raw": "{{base_url}}/pokedex/pokemon/1", 278 | "host": [ 279 | "{{base_url}}" 280 | ], 281 | "path": [ 282 | "pokedex", 283 | "pokemon", 284 | "1" 285 | ] 286 | } 287 | }, 288 | "response": [] 289 | } 290 | ], 291 | "event": [ 292 | { 293 | "listen": "prerequest", 294 | "script": { 295 | "type": "text/javascript", 296 | "exec": [ 297 | "" 298 | ] 299 | } 300 | }, 301 | { 302 | "listen": "test", 303 | "script": { 304 | "type": "text/javascript", 305 | "exec": [ 306 | "" 307 | ] 308 | } 309 | } 310 | ], 311 | "variable": [ 312 | { 313 | "key": "base_url", 314 | "value": "", 315 | "type": "string" 316 | } 317 | ] 318 | } -------------------------------------------------------------------------------- /solid-bad/src/main/java/com/jjeanjacques/solidbad/service/PokedexService.java: -------------------------------------------------------------------------------- 1 | package com.jjeanjacques.solidbad.service; 2 | 3 | import com.jjeanjacques.solidbad.controller.dto.PokemonDTO; 4 | import com.jjeanjacques.solidbad.controller.dto.ReportCatchDTO; 5 | import com.jjeanjacques.solidbad.controller.dto.ReportDTO; 6 | import com.jjeanjacques.solidbad.entity.Pokemon; 7 | import com.jjeanjacques.solidbad.exception.NotFoundPokemon; 8 | import org.modelmapper.ModelMapper; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.sql.*; 13 | import java.time.Instant; 14 | import java.time.LocalDateTime; 15 | import java.time.ZoneId; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | import java.util.stream.Collectors; 19 | 20 | /* God Class */ 21 | @Service 22 | public class PokedexService { 23 | 24 | private ModelMapper modelMapper; 25 | Connection connection; 26 | 27 | public PokedexService(@Value("${spring.datasource.url}") String DATABASE_URL, 28 | @Value("${spring.datasource.username}") String USER, 29 | @Value("${spring.datasource.password}") String PASSWORD) throws SQLException { 30 | modelMapper = new ModelMapper(); 31 | connection = DriverManager.getConnection(DATABASE_URL, USER, PASSWORD); 32 | } 33 | 34 | public void calculateTotalSum() {/**/} 35 | 36 | public List getAllPokemon() { 37 | var pokemons = findAll(); 38 | return pokemons.stream().map(p -> modelMapper.map(p, PokemonDTO.class)) 39 | .collect(Collectors.toList()); 40 | } 41 | 42 | public PokemonDTO getPokemon(String name) { 43 | var pokemon = findByNameContaining(name); 44 | if (pokemon == null) 45 | throw new NotFoundPokemon("Pokemon with name " + name + " not found"); 46 | return modelMapper.map(pokemon, PokemonDTO.class); 47 | } 48 | 49 | public PokemonDTO getPokemon(Long id) { 50 | var pokemon = findById(id); 51 | if (pokemon == null) 52 | throw new NotFoundPokemon("Pokemon with id " + id + " not found"); 53 | return modelMapper.map(pokemon, PokemonDTO.class); 54 | } 55 | 56 | public Long addPokemon(PokemonDTO pokemonDTO) { 57 | var pokemon = modelMapper.map(pokemonDTO, Pokemon.class); 58 | var pokemonSaved = save(pokemon); 59 | return pokemonSaved.getId(); 60 | } 61 | 62 | public void deletePokemon(Long id) { 63 | deleteById(id); 64 | } 65 | 66 | public ReportDTO printReport() { 67 | var pokemons = getAllPokemon(); 68 | return ReportDTO.builder() 69 | .total(pokemons.size()) 70 | .power(pokemons.stream().mapToInt(PokemonDTO::getAttack).sum()) 71 | .createdAt(LocalDateTime.now()) 72 | .build(); 73 | } 74 | 75 | public ReportCatchDTO showCatch() { 76 | var pokemons = getAllPokemon(); 77 | return ReportCatchDTO.builder() 78 | .total(pokemons.size()) 79 | .pokemon(pokemons) 80 | .createdAt(LocalDateTime.now()) 81 | .build(); 82 | } 83 | 84 | public List findAll() { 85 | List pokemons = new ArrayList<>(); 86 | 87 | try { 88 | var sql = "SELECT * FROM POKEMON"; 89 | 90 | Statement statement = connection.createStatement(); 91 | ResultSet result = statement.executeQuery(sql); 92 | 93 | while (result.next()) { 94 | var pokemon = Pokemon.builder() 95 | .id(Long.valueOf(result.getInt("id"))) 96 | .name(result.getString("name")) 97 | .description(result.getString("description")) 98 | .attack(result.getInt("attack")) 99 | .defense(result.getInt("defense")) 100 | .speed(result.getInt("speed")) 101 | .total(result.getInt("total")) 102 | .imageUrl(result.getString("image_url")) 103 | .build(); 104 | pokemons.add(pokemon); 105 | } 106 | } catch (SQLException e) { 107 | e.printStackTrace(); 108 | } 109 | return pokemons; 110 | } 111 | 112 | public Pokemon findByNameContaining(String name) { 113 | Pokemon pokemon = null; 114 | try { 115 | var sql = "SELECT * FROM POKEMON WHERE name LIKE '%" + name + "%'"; 116 | 117 | Statement statement = connection.createStatement(); 118 | ResultSet result = statement.executeQuery(sql); 119 | 120 | while (result.next()) { 121 | pokemon = Pokemon.builder() 122 | .id(Long.valueOf(result.getInt("id"))) 123 | .name(result.getString("name")) 124 | .description(result.getString("description")) 125 | .attack(result.getInt("attack")) 126 | .defense(result.getInt("defense")) 127 | .speed(result.getInt("speed")) 128 | .total(result.getInt("total")) 129 | .imageUrl(result.getString("image_url")) 130 | .build(); 131 | } 132 | } catch (SQLException e) { 133 | e.printStackTrace(); 134 | } 135 | return pokemon; 136 | } 137 | 138 | public Pokemon findById(Long id) { 139 | Pokemon pokemon = null; 140 | try { 141 | var sql = "SELECT * FROM POKEMON WHERE id = " + id; 142 | 143 | Statement statement = connection.createStatement(); 144 | ResultSet result = statement.executeQuery(sql); 145 | 146 | while (result.next()) { 147 | LocalDateTime lastWorkout = null; 148 | if (result.getDate("last_workout") != null) { 149 | lastWorkout = Instant.ofEpochMilli(result.getDate("last_workout").getTime()) 150 | .atZone(ZoneId.systemDefault()) 151 | .toLocalDateTime(); 152 | } 153 | pokemon = Pokemon.builder() 154 | .id(Long.valueOf(result.getInt("id"))) 155 | .name(result.getString("name")) 156 | .description(result.getString("description")) 157 | .attack(result.getInt("attack")) 158 | .defense(result.getInt("defense")) 159 | .speed(result.getInt("speed")) 160 | .total(result.getInt("total")) 161 | .imageUrl(result.getString("image_url")) 162 | .lastWorkout(lastWorkout) 163 | .build(); 164 | } 165 | } catch (SQLException e) { 166 | e.printStackTrace(); 167 | } 168 | return pokemon; 169 | } 170 | 171 | public Pokemon save(Pokemon pokemon) {/**/ 172 | try { 173 | Class.forName("org.h2.Driver"); 174 | 175 | Statement statement = connection.createStatement(); 176 | statement.execute("INSERT INTO POKEMON (name, description, hp, attack, defense, speed, total, image_url) " + 177 | "VALUES ('" + pokemon.getName() + "', '" + pokemon.getDescription() + "', " + pokemon.getHp() + ", " + pokemon.getAttack() + ", " + pokemon.getDefense() + ", " + pokemon.getSpeed() + ", " + pokemon.getTotal() + ", '" + pokemon.getImageUrl() + "');"); 178 | } catch (Exception e) { 179 | e.printStackTrace(); 180 | } 181 | return findByNameContaining(pokemon.getName()); 182 | } 183 | 184 | public Pokemon update(Pokemon pokemon) { 185 | try { 186 | Class.forName("org.h2.Driver"); 187 | 188 | Statement statement = connection.createStatement(); 189 | statement.execute("UPDATE POKEMON SET name = '" + pokemon.getName() + "', " + 190 | "description = '" + pokemon.getDescription() + "', " + 191 | "hp = " + pokemon.getHp() + ", " + 192 | "attack = " + pokemon.getAttack() + ", " + 193 | "defense = " + pokemon.getDefense() + ", " + 194 | "speed = " + pokemon.getSpeed() + ", " + 195 | "total = " + pokemon.getTotal() + ", " + 196 | "image_url = '" + pokemon.getImageUrl() + "', " + 197 | "last_workout = '" + pokemon.getLastWorkout() + "'" + 198 | " WHERE id = " + pokemon.getId() + ";"); 199 | } catch (Exception e) { 200 | e.printStackTrace(); 201 | } 202 | return findById(pokemon.getId()); 203 | } 204 | 205 | public void deleteById(Long id) { 206 | try { 207 | Class.forName("org.h2.Driver"); 208 | 209 | Statement statement = connection.createStatement(); 210 | statement.execute("DELETE * FROM POKEMON WHERE id = " + id); 211 | } catch (Exception e) { 212 | e.printStackTrace(); 213 | } 214 | } 215 | 216 | } 217 | -------------------------------------------------------------------------------- /solid-bad/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /solid-good/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /solid-bad/src/main/resources/sql/populate-database.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (1, 'Bulbasaur', 'A strange seed was planted on its back at birth. The plant sprouts and grows with this POKéMON.', 45, 49, 49, 65, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png', '2022-03-01 13:23:44', 'GRASS', null); 2 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (2, 'Ivysaur', 'There is a bud on this POKéMONs back. To support its weight, Ivysaurs legs and trunk grow thick and strong. If it starts spending more time lying in the sunlight, its a sign that the bud will bloom into a large flower soon.', 60, 62, 63, 80, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/002.png', '2022-02-01 13:23:44', 'GRASS', null); 3 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (3, 'Venusaur', 'There is a large flower on Venusaur''s back. The flower is said to take on vivid colors if it gets plenty of nutrition and sunlight. The flowers aroma soothes the emotions of people.', 80, 82, 83, 100, 100, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/003.png', '2022-02-01 13:23:44', 'GRASS', null); 4 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (4, 'Charmander', 'The flame that burns at the tip of its tail is an indication of its emotions. The flame wavers when Charmander is enjoying itself. If the POKéMON becomes enraged, the flame burns fiercely.', 39, 52, 43, 60, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/004.png', '2022-02-01 13:23:44', 'FIRE', null); 5 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (5, 'Charmeleon', 'Charmeleon mercilessly destroys its foes using its sharp claws. If it encounters a strong foe, it turns aggressive. In this excited state, the flame at the tip of its tail flares with a bluish white color.', 58, 64, 58, 80, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/005.png', '2022-02-01 13:23:44', 'FIRE', null); 6 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (6, 'Charizard', 'Charizard flies around the sky in search of powerful opponents. It breathes fire of such great heat that it melts anything. However, it never turns its fiery breath on any opponent weaker than itself.', 78, 84, 78, 109, 85, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/006.png', '2022-02-01 13:23:44', 'FIRE', null); 7 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (7, 'Squirtle', 'Squirtle''s shell is not merely used for protection. The shell''s rounded shape and the grooves on its surface help minimize resistance in water, enabling this POKéMON to swim at high speeds.', 44, 48, 65, 50, 64, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/007.png', '2022-02-01 13:23:44', 'WATER', null); 8 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (8, 'Wartortle', 'Its tail is large and covered with a rich, thick fur. The tail becomes increasingly deeper in color as Wartortle ages. The scratches on its shell are evidence of this POKéMON''s toughness as a battler.', 59, 63, 80, 65, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/008.png', '2022-02-01 13:23:44', 'WATER', null); 9 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (9, 'Blastoise', 'Blastoise has water spouts that protrude from its shell. The water spouts are very accurate. They can shoot bullets of water with enough accuracy to strike empty cans from a distance of over 160 feet.', 79, 83, 100, 85, 105, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/009.png', '2022-02-01 13:23:44', 'WATER', null); 10 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (10, 'Caterpie', 'The antenna on its head is large. It is capable of teleporting but its movements are very cumbersome. If it loses its head, this POKéMON immediately grows it back.', 45, 30, 35, 20, 20, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/010.png', '2022-02-01 13:23:44', 'BUG', null); 11 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (11, 'Metapod', 'The antenna on its head is large. It is capable of teleporting but its movements are very cumbersome. If it loses its head, this POKéMON immediately grows it back.', 50, 20, 55, 25, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/011.png', '2022-02-01 13:23:44', 'BUG', null); 12 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (12, 'Butterfree', 'Butterfree has a superior ability to search for delicious honey from flowers. It can even search out, extract, and carry honey from flowers that are blooming over six miles from its nest.', 60, 45, 50, 90, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/012.png', '2022-03-01 13:23:44', 'BUG', null); 13 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (13, 'Weedle', 'Weedle has an extremely acute sense of smell. It is capable of distinguishing its favorite kinds of leaves from those it dislikes just by sniffing with its big red proboscis (nose).', 40, 35, 30, 20, 20, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/013.png', '2022-03-01 13:23:44', 'BUG', null); 14 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (14, 'Kakuna', 'Kakuna remains virtually immobile as it clings to a tree. However, on the inside, it is extremely busy as it prepares for its coming evolution. This is evident from how hot the shell becomes to the touch.', 45, 25, 50, 25, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/014.png', '2022-03-01 13:23:44', 'BUG', null); 15 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (15, 'Beedrill', 'Beedrill is extremely territorial. No one should ever approach its nest—this is for their own safety. If angered, they will attack in a furious swarm.', 65, 90, 40, 45, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/015.png', '2022-03-01 13:23:44', 'BUG', null); 16 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (16, 'Pidgey', 'Pidgey has an extremely sharp sense of direction. It is capable of unerringly returning home to its nest, however far it may be removed from its familiar surroundings.', 40, 45, 40, 35, 35, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/016.png', '2022-03-01 13:23:44', 'NORMAL', null); 17 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (17, 'Pidgeotto', 'Pidgeotto claims a large area as its own territory. This Pokémon flies around, patrolling its living space. If its territory is violated, it shows no mercy in thoroughly punishing the foe with its sharp claws.', 63, 60, 55, 50, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/017.png', '2022-03-01 13:23:44', 'NORMAL', null); 18 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (18, 'Pidgeot', 'Pidgeot has a dazzling plumage of beautifully glossy feathers. Many Trainers are captivated by the striking beauty of the feathers on its head, compelling them to choose Pidgeot as their POKéMON.', 83, 80, 75, 70, 70, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/018.png', '2022-03-01 13:23:44', 'NORMAL', null); 19 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (19, 'Rattata', 'Rattata is cautious in the extreme. Even while it is asleep, it constantly listens by moving its ears around. It is not picky about where it lives—it will make its nest anywhere.', 30, 56, 35, 25, 35, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/019.png', '2022-03-01 13:23:44', 'NORMAL', null); 20 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (20, 'Raticate', 'Raticate’s sturdy fangs grow steadily. To keep them ground down, it gnaws on rocks and logs. It may even chew on the walls of houses.', 55, 81, 60, 50, 70, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/020.png', '2022-03-01 13:23:44', 'NORMAL', null); 21 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (21, 'Spearow', 'Spearow has a very loud cry that can be heard over half a mile away. If its high, keening cry is heard echoing all around, it is a sign that they are warning each other of danger.', 40, 60, 30, 31, 31, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/021.png', '2022-03-01 13:23:44', 'NORMAL', null); 22 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (22, 'Fearow', 'Fearow is recognized by its long neck and elongated beak. They are conveniently shaped for catching prey in soil or water. It deftly moves its long and skinny beak to pluck prey.', 65, 90, 65, 61, 61, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/022.png', '2022-03-01 13:23:44', 'NORMAL', null); 23 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (23, 'Ekans', 'Ekans curls itself up in a spiral while it rests. Assuming this position allows it to quickly respond to a threat from any direction with a glare from its upraised head.', 35, 60, 44, 40, 54, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/023.png', '2022-03-01 13:23:44', 'POISON', null); 24 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (24, 'Arbok', 'This Pokémon is terrifically strong in order to constrict things with its body. It can even flatten steel oil drums. Once Arbok wraps its body around its foe, escaping its crunching embrace is impossible.', 60, 95, 69, 65, 79, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/024.png', '2022-03-01 13:23:44', 'POISON', null); 25 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (25, 'Pikachu', 'Whenever Pikachu comes across something new, it blasts it with a jolt of electricity. If you come across a blackened berry, it’s evidence that this Pokémon mistook the intensity of its charge.', 35, 55, 30, 50, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/025.png', '2022-03-01 13:23:44', 'ELECTRIC', null); 26 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (26, 'Raichu', 'When electricity builds up inside its body, Raichu plants its tail in the ground and statically charges. Even in a electric storm, Raichu can power through even thick of weather.', 60, 90, 55, 90, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/026.png', '2022-03-01 13:23:44', 'ELECTRIC', null); 27 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (27, 'Sandshrew', 'Sandshrew has a very dry hide that is extremely tough. The Pokémon can roll into a ball that repels any attack. At night, it burrows into the desert sand to sleep.', 50, 75, 85, 20, 30, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/027.png', '2022-03-01 13:23:44', 'GROUND', null); 28 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (28, 'Sandslash', 'Sandslash can roll up its body as if it were a ball covered with large spikes. It then spits the spikes at blinding speed.', 75, 100, 110, 45, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/028.png', '2022-03-01 13:23:44', 'GROUND', null); 29 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (29, 'Nidoran♀', 'Nidoran has barbs that secrete a powerful poison. They are thought to have developed as protection for this small-bodied Pokémon. When enraged, it releases a horrible toxin from its horn.', 55, 47, 52, 41, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/029.png', '2022-03-01 13:23:44', 'POISON', null); 30 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (30, 'Nidorina', 'When Nidorina are with their friends or family, they keep their barbs tucked away to prevent hurting each other. This Pokémon appears to become nervous if separated from the others.', 70, 62, 67, 56, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/030.png', '2022-03-01 13:23:44', 'POISON', null); 31 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (31, 'Nidoqueen', 'Nidoqueen’s body is encased in extremely hard scales. It is adept at sending foes flying with harsh tackles. This Pokémon is at its strongest when it is defending its young.', 90, 82, 87, 76, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/031.png', '2022-03-01 13:23:44', 'POISON', null); 32 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (32, 'Nidoran♂', 'Nidoran has developed muscles for moving its ears. Thanks to them, the ears can be freely moved in any direction. Even the slightest sound does not escape this Pokémon’s notice.', 46, 57, 40, 40, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/032.png', '2022-03-01 13:23:44', 'POISON', null); 33 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (33, 'Nidorino', 'Nidorino has a horn that is harder than a diamond. If it senses a hostile presence, all the barbs on its back bristle up at once, and it challenges the foe with all its might.', 61, 72, 57, 55, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/033.png', '2022-03-01 13:23:44', 'POISON', null); 34 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (34, 'Nidoking', 'Nidoking’s thick tail packs enormously destructive power. With one swing, the tail can topple a metal transmission tower. Once this Pokémon goes on a rampage, there is no stopping it.', 81, 102, 77, 85, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/034.png', '2022-03-01 13:23:44', 'POISON', null); 35 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (35, 'Clefairy', 'On every night of a full moon, groups of this Pokémon come out to play. When dawn arrives, the tired Clefairy return to their quiet mountain retreats and go to sleep nestled up against each other.', 70, 45, 48, 60, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/035.png', '2022-03-01 13:23:44', 'FAIRY', null); 36 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (36, 'Clefable', 'Clefable moves by skipping lightly as if it were flying using its wings. Its bouncy step lets it even walk on water. It is known to take strolls on lakes on quiet, moonlit nights.', 95, 70, 73, 95, 90, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/036.png', '2022-03-01 13:23:44', 'FAIRY', null); 37 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (37, 'Vulpix', 'At the time of birth, Vulpix has one white tail. The tail splits from its tip as it grows older. As it matures, its tail will split from its tip, too.', 38, 41, 40, 50, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/037.png', '2022-03-01 13:23:44', 'FIRE', null); 38 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (38, 'Ninetales', 'Ninetales casts a sinister light from its bright red eyes to gain total control over its foe’s mind. This Pokémon is said to live for a thousand years.', 73, 76, 75, 81, 100, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/038.png', '2022-03-01 13:23:44', 'FIRE', null); 39 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (39, 'Jigglypuff', 'Jigglypuff has a huge, red ball of fur on its head. The color of the fur changes with its emotions. Jigglypuff’s favorite color is red. If this Pokémon is caught, the holder should toss it in the air. It will then float down to earth.', 115, 45, 20, 45, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/039.png', '2022-03-01 13:23:44', 'NORMAL', null); 40 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (40, 'Wigglytuff', 'Wigglytuff has large eyes. The surfaces of its eyes are always covered with a thin layer of tears. If any dust gets in this Pokémon’s eyes, it is quickly washed away.', 140, 70, 45, 75, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/040.png', '2022-03-01 13:23:44', 'NORMAL', null); 41 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (41, 'Zubat', 'Zubat remains quietly unmoving in a dark spot during the bright daylight hours. It does so because prolonged exposure to the sun causes its body to become slightly burned.', 40, 45, 35, 30, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/041.png', '2022-03-01 13:23:44', 'POISON', null); 42 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (42, 'Golbat', 'Golbat loves to drink the blood of living things. It is particularly active in the pitch black of night. This Pokémon flits around in the night skies, seeking fresh blood.', 75, 80, 70, 65, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/042.png', '2022-03-01 13:23:44', 'POISON', null); 43 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (43, 'Oddish', 'Oddish searches for fertile, nutrient-rich soil, then plants itself. During the daytime, while it is planted, this Pokémon’s feet are thought to change shape and become similar to the roots of trees.', 45, 50, 55, 30, 30, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/043.png', '2022-03-01 13:23:44', 'GRASS', null); 44 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (44, 'Gloom', 'Gloom releases a foul fragrance from the pistil of its flower. When faced with danger, the stench worsens. If this Pokémon is feeling calm and secure, it does not release its usual stinky aroma.', 60, 65, 70, 40, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/044.png', '2022-03-01 13:23:44', 'GRASS', null); -------------------------------------------------------------------------------- /solid-good/src/main/resources/sql/populate-database.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (1, 'Bulbasaur', 'A strange seed was planted on its back at birth. The plant sprouts and grows with this POKéMON.', 45, 49, 49, 65, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png', '2022-03-01 13:23:44', 'GRASS', null); 2 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (2, 'Ivysaur', 'There is a bud on this POKéMONs back. To support its weight, Ivysaurs legs and trunk grow thick and strong. If it starts spending more time lying in the sunlight, its a sign that the bud will bloom into a large flower soon.', 60, 62, 63, 80, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/002.png', '2022-02-01 13:23:44', 'GRASS', null); 3 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (3, 'Venusaur', 'There is a large flower on Venusaur''s back. The flower is said to take on vivid colors if it gets plenty of nutrition and sunlight. The flowers aroma soothes the emotions of people.', 80, 82, 83, 100, 100, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/003.png', '2022-02-01 13:23:44', 'GRASS', null); 4 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (4, 'Charmander', 'The flame that burns at the tip of its tail is an indication of its emotions. The flame wavers when Charmander is enjoying itself. If the POKéMON becomes enraged, the flame burns fiercely.', 39, 52, 43, 60, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/004.png', '2022-02-01 13:23:44', 'FIRE', null); 5 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (5, 'Charmeleon', 'Charmeleon mercilessly destroys its foes using its sharp claws. If it encounters a strong foe, it turns aggressive. In this excited state, the flame at the tip of its tail flares with a bluish white color.', 58, 64, 58, 80, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/005.png', '2022-02-01 13:23:44', 'FIRE', null); 6 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (6, 'Charizard', 'Charizard flies around the sky in search of powerful opponents. It breathes fire of such great heat that it melts anything. However, it never turns its fiery breath on any opponent weaker than itself.', 78, 84, 78, 109, 85, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/006.png', '2022-02-01 13:23:44', 'FIRE', null); 7 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (7, 'Squirtle', 'Squirtle''s shell is not merely used for protection. The shell''s rounded shape and the grooves on its surface help minimize resistance in water, enabling this POKéMON to swim at high speeds.', 44, 48, 65, 50, 64, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/007.png', '2022-02-01 13:23:44', 'WATER', null); 8 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (8, 'Wartortle', 'Its tail is large and covered with a rich, thick fur. The tail becomes increasingly deeper in color as Wartortle ages. The scratches on its shell are evidence of this POKéMON''s toughness as a battler.', 59, 63, 80, 65, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/008.png', '2022-02-01 13:23:44', 'WATER', null); 9 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (9, 'Blastoise', 'Blastoise has water spouts that protrude from its shell. The water spouts are very accurate. They can shoot bullets of water with enough accuracy to strike empty cans from a distance of over 160 feet.', 79, 83, 100, 85, 105, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/009.png', '2022-02-01 13:23:44', 'WATER', null); 10 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (10, 'Caterpie', 'The antenna on its head is large. It is capable of teleporting but its movements are very cumbersome. If it loses its head, this POKéMON immediately grows it back.', 45, 30, 35, 20, 20, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/010.png', '2022-02-01 13:23:44', 'BUG', null); 11 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (11, 'Metapod', 'The antenna on its head is large. It is capable of teleporting but its movements are very cumbersome. If it loses its head, this POKéMON immediately grows it back.', 50, 20, 55, 25, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/011.png', '2022-02-01 13:23:44', 'BUG', null); 12 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (12, 'Butterfree', 'Butterfree has a superior ability to search for delicious honey from flowers. It can even search out, extract, and carry honey from flowers that are blooming over six miles from its nest.', 60, 45, 50, 90, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/012.png', '2022-03-01 13:23:44', 'BUG', null); 13 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (13, 'Weedle', 'Weedle has an extremely acute sense of smell. It is capable of distinguishing its favorite kinds of leaves from those it dislikes just by sniffing with its big red proboscis (nose).', 40, 35, 30, 20, 20, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/013.png', '2022-03-01 13:23:44', 'BUG', null); 14 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (14, 'Kakuna', 'Kakuna remains virtually immobile as it clings to a tree. However, on the inside, it is extremely busy as it prepares for its coming evolution. This is evident from how hot the shell becomes to the touch.', 45, 25, 50, 25, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/014.png', '2022-03-01 13:23:44', 'BUG', null); 15 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (15, 'Beedrill', 'Beedrill is extremely territorial. No one should ever approach its nest—this is for their own safety. If angered, they will attack in a furious swarm.', 65, 90, 40, 45, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/015.png', '2022-03-01 13:23:44', 'BUG', null); 16 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (16, 'Pidgey', 'Pidgey has an extremely sharp sense of direction. It is capable of unerringly returning home to its nest, however far it may be removed from its familiar surroundings.', 40, 45, 40, 35, 35, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/016.png', '2022-03-01 13:23:44', 'NORMAL', null); 17 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (17, 'Pidgeotto', 'Pidgeotto claims a large area as its own territory. This Pokémon flies around, patrolling its living space. If its territory is violated, it shows no mercy in thoroughly punishing the foe with its sharp claws.', 63, 60, 55, 50, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/017.png', '2022-03-01 13:23:44', 'NORMAL', null); 18 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (18, 'Pidgeot', 'Pidgeot has a dazzling plumage of beautifully glossy feathers. Many Trainers are captivated by the striking beauty of the feathers on its head, compelling them to choose Pidgeot as their POKéMON.', 83, 80, 75, 70, 70, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/018.png', '2022-03-01 13:23:44', 'NORMAL', null); 19 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (19, 'Rattata', 'Rattata is cautious in the extreme. Even while it is asleep, it constantly listens by moving its ears around. It is not picky about where it lives—it will make its nest anywhere.', 30, 56, 35, 25, 35, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/019.png', '2022-03-01 13:23:44', 'NORMAL', null); 20 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (20, 'Raticate', 'Raticate’s sturdy fangs grow steadily. To keep them ground down, it gnaws on rocks and logs. It may even chew on the walls of houses.', 55, 81, 60, 50, 70, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/020.png', '2022-03-01 13:23:44', 'NORMAL', null); 21 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (21, 'Spearow', 'Spearow has a very loud cry that can be heard over half a mile away. If its high, keening cry is heard echoing all around, it is a sign that they are warning each other of danger.', 40, 60, 30, 31, 31, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/021.png', '2022-03-01 13:23:44', 'NORMAL', null); 22 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (22, 'Fearow', 'Fearow is recognized by its long neck and elongated beak. They are conveniently shaped for catching prey in soil or water. It deftly moves its long and skinny beak to pluck prey.', 65, 90, 65, 61, 61, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/022.png', '2022-03-01 13:23:44', 'NORMAL', null); 23 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (23, 'Ekans', 'Ekans curls itself up in a spiral while it rests. Assuming this position allows it to quickly respond to a threat from any direction with a glare from its upraised head.', 35, 60, 44, 40, 54, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/023.png', '2022-03-01 13:23:44', 'POISON', null); 24 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (24, 'Arbok', 'This Pokémon is terrifically strong in order to constrict things with its body. It can even flatten steel oil drums. Once Arbok wraps its body around its foe, escaping its crunching embrace is impossible.', 60, 95, 69, 65, 79, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/024.png', '2022-03-01 13:23:44', 'POISON', null); 25 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (25, 'Pikachu', 'Whenever Pikachu comes across something new, it blasts it with a jolt of electricity. If you come across a blackened berry, it’s evidence that this Pokémon mistook the intensity of its charge.', 35, 55, 30, 50, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/025.png', '2022-03-01 13:23:44', 'ELECTRIC', null); 26 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (26, 'Raichu', 'When electricity builds up inside its body, Raichu plants its tail in the ground and statically charges. Even in a electric storm, Raichu can power through even thick of weather.', 60, 90, 55, 90, 80, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/026.png', '2022-03-01 13:23:44', 'ELECTRIC', null); 27 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (27, 'Sandshrew', 'Sandshrew has a very dry hide that is extremely tough. The Pokémon can roll into a ball that repels any attack. At night, it burrows into the desert sand to sleep.', 50, 75, 85, 20, 30, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/027.png', '2022-03-01 13:23:44', 'GROUND', null); 28 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (28, 'Sandslash', 'Sandslash can roll up its body as if it were a ball covered with large spikes. It then spits the spikes at blinding speed.', 75, 100, 110, 45, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/028.png', '2022-03-01 13:23:44', 'GROUND', null); 29 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (29, 'Nidoran♀', 'Nidoran has barbs that secrete a powerful poison. They are thought to have developed as protection for this small-bodied Pokémon. When enraged, it releases a horrible toxin from its horn.', 55, 47, 52, 41, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/029.png', '2022-03-01 13:23:44', 'POISON', null); 30 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (30, 'Nidorina', 'When Nidorina are with their friends or family, they keep their barbs tucked away to prevent hurting each other. This Pokémon appears to become nervous if separated from the others.', 70, 62, 67, 56, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/030.png', '2022-03-01 13:23:44', 'POISON', null); 31 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (31, 'Nidoqueen', 'Nidoqueen’s body is encased in extremely hard scales. It is adept at sending foes flying with harsh tackles. This Pokémon is at its strongest when it is defending its young.', 90, 82, 87, 76, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/031.png', '2022-03-01 13:23:44', 'POISON', null); 32 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (32, 'Nidoran♂', 'Nidoran has developed muscles for moving its ears. Thanks to them, the ears can be freely moved in any direction. Even the slightest sound does not escape this Pokémon’s notice.', 46, 57, 40, 40, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/032.png', '2022-03-01 13:23:44', 'POISON', null); 33 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (33, 'Nidorino', 'Nidorino has a horn that is harder than a diamond. If it senses a hostile presence, all the barbs on its back bristle up at once, and it challenges the foe with all its might.', 61, 72, 57, 55, 55, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/033.png', '2022-03-01 13:23:44', 'POISON', null); 34 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (34, 'Nidoking', 'Nidoking’s thick tail packs enormously destructive power. With one swing, the tail can topple a metal transmission tower. Once this Pokémon goes on a rampage, there is no stopping it.', 81, 102, 77, 85, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/034.png', '2022-03-01 13:23:44', 'POISON', null); 35 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (35, 'Clefairy', 'On every night of a full moon, groups of this Pokémon come out to play. When dawn arrives, the tired Clefairy return to their quiet mountain retreats and go to sleep nestled up against each other.', 70, 45, 48, 60, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/035.png', '2022-03-01 13:23:44', 'FAIRY', null); 36 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (36, 'Clefable', 'Clefable moves by skipping lightly as if it were flying using its wings. Its bouncy step lets it even walk on water. It is known to take strolls on lakes on quiet, moonlit nights.', 95, 70, 73, 95, 90, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/036.png', '2022-03-01 13:23:44', 'FAIRY', null); 37 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (37, 'Vulpix', 'At the time of birth, Vulpix has one white tail. The tail splits from its tip as it grows older. As it matures, its tail will split from its tip, too.', 38, 41, 40, 50, 65, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/037.png', '2022-03-01 13:23:44', 'FIRE', null); 38 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (38, 'Ninetales', 'Ninetales casts a sinister light from its bright red eyes to gain total control over its foe’s mind. This Pokémon is said to live for a thousand years.', 73, 76, 75, 81, 100, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/038.png', '2022-03-01 13:23:44', 'FIRE', null); 39 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (39, 'Jigglypuff', 'Jigglypuff has a huge, red ball of fur on its head. The color of the fur changes with its emotions. Jigglypuff’s favorite color is red. If this Pokémon is caught, the holder should toss it in the air. It will then float down to earth.', 115, 45, 20, 45, 25, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/039.png', '2022-03-01 13:23:44', 'NORMAL', null); 40 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (40, 'Wigglytuff', 'Wigglytuff has large eyes. The surfaces of its eyes are always covered with a thin layer of tears. If any dust gets in this Pokémon’s eyes, it is quickly washed away.', 140, 70, 45, 75, 50, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/040.png', '2022-03-01 13:23:44', 'NORMAL', null); 41 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (41, 'Zubat', 'Zubat remains quietly unmoving in a dark spot during the bright daylight hours. It does so because prolonged exposure to the sun causes its body to become slightly burned.', 40, 45, 35, 30, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/041.png', '2022-03-01 13:23:44', 'POISON', null); 42 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (42, 'Golbat', 'Golbat loves to drink the blood of living things. It is particularly active in the pitch black of night. This Pokémon flits around in the night skies, seeking fresh blood.', 75, 80, 70, 65, 75, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/042.png', '2022-03-01 13:23:44', 'POISON', null); 43 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (43, 'Oddish', 'Oddish searches for fertile, nutrient-rich soil, then plants itself. During the daytime, while it is planted, this Pokémon’s feet are thought to change shape and become similar to the roots of trees.', 45, 50, 55, 30, 30, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/043.png', '2022-03-01 13:23:44', 'GRASS', null); 44 | INSERT INTO POKEMON (id, name, description, hp, attack, defense, speed, total, image_url, captured_at, type, last_workout) VALUES (44, 'Gloom', 'Gloom releases a foul fragrance from the pistil of its flower. When faced with danger, the stench worsens. If this Pokémon is feeling calm and secure, it does not release its usual stinky aroma.', 60, 65, 70, 40, 40, 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/044.png', '2022-03-01 13:23:44', 'GRASS', null); --------------------------------------------------------------------------------