diff --git a/pom.xml b/pom.xml index 9d74fdc..9cff8df 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,6 @@ org.springframework.boot spring-boot-starter-web - org.springframework.boot spring-boot-devtools diff --git a/src/main/java/com/provedcode/config/PageConfig.java b/src/main/java/com/provedcode/config/PageProperties.java similarity index 63% rename from src/main/java/com/provedcode/config/PageConfig.java rename to src/main/java/com/provedcode/config/PageProperties.java index 1922716..48ab911 100644 --- a/src/main/java/com/provedcode/config/PageConfig.java +++ b/src/main/java/com/provedcode/config/PageProperties.java @@ -1,15 +1,20 @@ package com.provedcode.config; import jakarta.annotation.PostConstruct; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; +import org.springframework.stereotype.Component; +import org.springframework.validation.annotation.Validated; -@EnableConfigurationProperties +@Validated @ConfigurationProperties(prefix = "page-config") @Slf4j -public record PageConfig( +public record PageProperties( int defaultPageNum, int defaultPageSize ) { diff --git a/src/main/java/com/provedcode/config/PropsConfig.java b/src/main/java/com/provedcode/config/PropsConfig.java new file mode 100644 index 0000000..5161d40 --- /dev/null +++ b/src/main/java/com/provedcode/config/PropsConfig.java @@ -0,0 +1,11 @@ +package com.provedcode.config; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +@EnableConfigurationProperties(PageProperties.class) +@PropertySource("pagination.properties") +@Configuration +public class PropsConfig { +} diff --git a/src/main/java/com/provedcode/config/SecurityConfig.java b/src/main/java/com/provedcode/config/SecurityConfig.java index 3d2d942..819c2af 100644 --- a/src/main/java/com/provedcode/config/SecurityConfig.java +++ b/src/main/java/com/provedcode/config/SecurityConfig.java @@ -17,6 +17,7 @@ public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests(c -> c + .requestMatchers("/actuator/health").permitAll() // for DevOps .requestMatchers(antMatcher("/h2/**")).permitAll() .requestMatchers(antMatcher("/api/**")).permitAll() .anyRequest().denyAll() diff --git a/src/main/java/com/provedcode/talent/TalentController.java b/src/main/java/com/provedcode/talent/TalentController.java index 0ca8e61..9abf1b4 100644 --- a/src/main/java/com/provedcode/talent/TalentController.java +++ b/src/main/java/com/provedcode/talent/TalentController.java @@ -4,10 +4,10 @@ import com.provedcode.talent.model.dto.FullTalentDTO; import com.provedcode.talent.model.dto.ShortTalentDTO; import lombok.AllArgsConstructor; +import org.springframework.data.domain.Page; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; -import java.util.List; import java.util.Optional; @RestController @@ -22,7 +22,7 @@ FullTalentDTO getTalent(@PathVariable("id") long id) { @GetMapping("/api/talents") @ResponseStatus(HttpStatus.OK) - List getTalents(@RequestParam(value = "page") Optional page, + Page getTalents(@RequestParam(value = "page") Optional page, @RequestParam(value = "size") Optional size) { return talentService.getTalentsPage(page, size); } diff --git a/src/main/java/com/provedcode/talent/mapper/TalentMapper.java b/src/main/java/com/provedcode/talent/mapper/TalentMapper.java index ca767a4..a3818a7 100644 --- a/src/main/java/com/provedcode/talent/mapper/TalentMapper.java +++ b/src/main/java/com/provedcode/talent/mapper/TalentMapper.java @@ -5,31 +5,8 @@ import com.provedcode.talent.model.entity.*; public interface TalentMapper { - default ShortTalentDTO talentToShortTalentDTO(Talent talent) { - return ShortTalentDTO.builder() - .id(talent.getId()) - .image(talent.getImage()) - .firstname(talent.getFirstName()) - .lastname(talent.getLastName()) - .specialization(talent.getSpecialization()) - .skills(talent.getTalentSkills().stream().map(TalentSkill::getSkill).toList()) - .build(); - } - default FullTalentDTO talentToFullTalentDTO(Talent talent) { - return FullTalentDTO.builder() - .id(talent.getId()) - .firstname(talent.getFirstName()) - .lastname(talent.getLastName()) - .bio(talent.getTalentDescription().getBio()) - .additionalInfo(talent.getTalentDescription().getAdditionalInfo()) - .image(talent.getImage()) - .specialization(talent.getSpecialization()) - .links(talent.getTalentLinks().stream().map(TalentLink::getLink).toList()) - .contacts(talent.getTalentContacts().stream().map(TalentContact::getContact).toList()) - .skills(talent.getTalentSkills().stream().map(TalentSkill::getSkill).toList()) - .attachedFiles(talent.getTalentAttachedFiles().stream().map(TalentAttachedFile::getAttachedFile).toList()) - .build(); - } + ShortTalentDTO talentToShortTalentDTO(Talent talent); + FullTalentDTO talentToFullTalentDTO(Talent talent); } diff --git a/src/main/java/com/provedcode/talent/mapper/impl/TalentMapperImpl.java b/src/main/java/com/provedcode/talent/mapper/impl/TalentMapperImpl.java index 6dc6a03..90516ac 100644 --- a/src/main/java/com/provedcode/talent/mapper/impl/TalentMapperImpl.java +++ b/src/main/java/com/provedcode/talent/mapper/impl/TalentMapperImpl.java @@ -1,8 +1,38 @@ package com.provedcode.talent.mapper.impl; import com.provedcode.talent.mapper.TalentMapper; +import com.provedcode.talent.model.dto.FullTalentDTO; +import com.provedcode.talent.model.dto.ShortTalentDTO; +import com.provedcode.talent.model.entity.*; import org.springframework.stereotype.Component; @Component public class TalentMapperImpl implements TalentMapper { + @Override + public ShortTalentDTO talentToShortTalentDTO(Talent talent) { + return ShortTalentDTO.builder() + .id(talent.getId()) + .image(talent.getImage()) + .firstname(talent.getFirstName()) + .lastname(talent.getLastName()) + .specialization(talent.getSpecialization()) + .skills(talent.getTalentSkills().stream().map(TalentSkill::getSkill).toList()) + .build(); + } + @Override + public FullTalentDTO talentToFullTalentDTO(Talent talent) { + return FullTalentDTO.builder() + .id(talent.getId()) + .firstname(talent.getFirstName()) + .lastname(talent.getLastName()) + .bio(talent.getTalentDescription().getBio()) + .additionalInfo(talent.getTalentDescription().getAdditionalInfo()) + .image(talent.getImage()) + .specialization(talent.getSpecialization()) + .links(talent.getTalentLinks().stream().map(TalentLink::getLink).toList()) + .contacts(talent.getTalentContacts().stream().map(TalentContact::getContact).toList()) + .skills(talent.getTalentSkills().stream().map(TalentSkill::getSkill).toList()) + .attachedFiles(talent.getTalentAttachedFiles().stream().map(TalentAttachedFile::getAttachedFile).toList()) + .build(); + } } diff --git a/src/main/java/com/provedcode/talent/repo/TalentRepository.java b/src/main/java/com/provedcode/talent/repo/TalentRepository.java index b2fe0de..c077eb8 100644 --- a/src/main/java/com/provedcode/talent/repo/TalentRepository.java +++ b/src/main/java/com/provedcode/talent/repo/TalentRepository.java @@ -1,16 +1,14 @@ package com.provedcode.talent.repo; import com.provedcode.talent.model.entity.Talent; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; -import java.util.List; import java.util.Optional; public interface TalentRepository { - List getTalentsPage(PageRequest page); + Page findAll(Pageable pageable); Optional findById(Long aLong); } \ No newline at end of file diff --git a/src/main/java/com/provedcode/talent/repo/db/TalentEntityRepository.java b/src/main/java/com/provedcode/talent/repo/db/TalentEntityRepository.java index aaa9688..e3fa4a9 100644 --- a/src/main/java/com/provedcode/talent/repo/db/TalentEntityRepository.java +++ b/src/main/java/com/provedcode/talent/repo/db/TalentEntityRepository.java @@ -2,27 +2,19 @@ import com.provedcode.talent.model.entity.Talent; import com.provedcode.talent.repo.TalentRepository; -import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.transaction.annotation.Transactional; -import java.util.List; import java.util.Optional; public interface TalentEntityRepository extends JpaRepository, TalentRepository { @Transactional(readOnly = true) - default List getTalents() { - return findAll(); - } - + Page findAll(Pageable pageable); @Override @Transactional(readOnly = true) - default List getTalentsPage(PageRequest page) { - return findAll(page).stream().toList(); - } - - @Override Optional findById(Long aLong); } \ No newline at end of file diff --git a/src/main/java/com/provedcode/talent/service/TalentService.java b/src/main/java/com/provedcode/talent/service/TalentService.java index 3b1147a..e583ff2 100644 --- a/src/main/java/com/provedcode/talent/service/TalentService.java +++ b/src/main/java/com/provedcode/talent/service/TalentService.java @@ -2,13 +2,14 @@ import com.provedcode.talent.model.dto.FullTalentDTO; import com.provedcode.talent.model.dto.ShortTalentDTO; +import org.springframework.data.domain.Page; import java.util.List; import java.util.Optional; public interface TalentService { - List getTalentsPage(Optional page, Optional size); + Page getTalentsPage(Optional page, Optional size); FullTalentDTO getTalentById(long id); } \ No newline at end of file diff --git a/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java b/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java index 5f23955..af20a7f 100644 --- a/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java +++ b/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java @@ -1,6 +1,6 @@ package com.provedcode.talent.service.impl; -import com.provedcode.config.PageConfig; +import com.provedcode.config.PageProperties; import com.provedcode.talent.service.TalentService; import com.provedcode.talent.mapper.TalentMapper; import com.provedcode.talent.model.dto.FullTalentDTO; @@ -9,12 +9,15 @@ import com.provedcode.talent.repo.TalentRepository; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import org.springframework.web.server.ResponseStatusException; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.NOT_FOUND; @@ -25,20 +28,19 @@ public class TalentServiceImpl implements TalentService { TalentMapper talentMapper; TalentRepository talentRepository; - PageConfig pageConfig; + PageProperties pageProperties; @Override - public List getTalentsPage(Optional page, Optional size) { - if (page.orElse(pageConfig.defaultPageNum()) < 0) { + public Page getTalentsPage(Optional page, Optional size) { + if (page.orElse(pageProperties.defaultPageNum()) < 0) { throw new ResponseStatusException(BAD_REQUEST, "'page' query parameter must be greater than or equal to 0"); } - if (size.orElse(pageConfig.defaultPageSize()) <= 0) { + if (size.orElse(pageProperties.defaultPageSize()) <= 0) { throw new ResponseStatusException(BAD_REQUEST, "'size' query parameter must be greater than or equal to 1"); } - return talentRepository.getTalentsPage( - PageRequest.of(page.orElse(pageConfig.defaultPageNum()), size.orElse(pageConfig.defaultPageSize()))) - .stream().map(i -> talentMapper.talentToShortTalentDTO(i)) - .toList(); + return talentRepository.findAll(PageRequest.of(page.orElse(pageProperties.defaultPageNum()), size.orElse(pageProperties.defaultPageSize()))) + .map(talentMapper::talentToShortTalentDTO); + } @Override diff --git a/src/main/java/com/provedcode/talent/service/mock/TalentServiceMock.java b/src/main/java/com/provedcode/talent/service/mock/TalentServiceMock.java index 84ba719..b305f3a 100644 --- a/src/main/java/com/provedcode/talent/service/mock/TalentServiceMock.java +++ b/src/main/java/com/provedcode/talent/service/mock/TalentServiceMock.java @@ -1,6 +1,6 @@ package com.provedcode.talent.service.mock; -import com.provedcode.config.PageConfig; +import com.provedcode.config.PageProperties; import com.provedcode.talent.service.TalentService; import com.provedcode.talent.mapper.TalentMapper; import com.provedcode.talent.model.dto.FullTalentDTO; @@ -9,10 +9,11 @@ import com.provedcode.talent.repo.TalentRepository; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.web.server.ResponseStatusException; -import java.util.List; import java.util.Optional; import static org.springframework.http.HttpStatus.BAD_REQUEST; @@ -24,20 +25,20 @@ public class TalentServiceMock implements TalentService { TalentMapper talentMapper; TalentRepository talentRepository; - PageConfig pageConfig; + PageProperties pageProperties; @Override - public List getTalentsPage(Optional page, Optional size) { - if (page.orElse(pageConfig.defaultPageNum()) < 0) { + public Page getTalentsPage(Optional page, Optional size) { + if (page.orElse(pageProperties.defaultPageNum()) < 0) { throw new ResponseStatusException(BAD_REQUEST, "'page' query parameter must be greater than or equal to 0"); } - if (size.orElse(pageConfig.defaultPageSize()) <= 0) { + if (size.orElse(pageProperties.defaultPageSize()) <= 0) { throw new ResponseStatusException(BAD_REQUEST, "'size' query parameter must be greater than or equal to 1"); } - return talentRepository.getTalentsPage( - PageRequest.of(page.orElse(pageConfig.defaultPageNum()), size.orElse(pageConfig.defaultPageSize()))) - .stream().map(i -> talentMapper.talentToShortTalentDTO(i)) - .toList(); + return new PageImpl<>(talentRepository.findAll( + PageRequest.of(page.orElse(pageProperties.defaultPageNum()), size.orElse(pageProperties.defaultPageSize()))) + .stream().map(talentMapper::talentToShortTalentDTO) + .toList()); } @Override diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties new file mode 100644 index 0000000..584e38f --- /dev/null +++ b/src/main/resources/application-dev.properties @@ -0,0 +1,2 @@ +spring.datasource.username=sa +spring.datasource.url=jdbc:h2:mem:../sampleDB diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties new file mode 100644 index 0000000..3eb12be --- /dev/null +++ b/src/main/resources/application-prod.properties @@ -0,0 +1,6 @@ +spring.datasource.username=${DB_LOGIN} +spring.datasource.password=${DB_PASSWORD} +spring.datasource.url=${DB_URL} +spring.jpa.hibernate.ddl-auto=none +spring.sql.init.mode=always +spring.sql.init.platform=h2 \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4d1a553..55ff623 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,17 +1,12 @@ -server.port=28852 -management.endpoints.web.exposure.include=* -management.endpoint.shutdown.enabled=true +spring.profiles.active=${SPRING_PROFILES_ACTIVE:dev} +## +server.port=8080 ## spring.jackson.property-naming-strategy=SNAKE_CASE ## logging.level.cinema.controller=info ## spring.datasource.driverClassName=org.h2.Driver -spring.datasource.url=jdbc:h2:mem:/sampleDB spring.h2.console.enabled=true spring.h2.console.path=/h2 -## -spring.jpa.hibernate.ddl-auto=none -## BUG WAS HERE -page-config.default-page-num=0 -page-config.default-page-size=5 \ No newline at end of file +spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index 5604d04..6b0f1ae 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -1,7 +1,7 @@ insert into talent (first_name, last_name, specialization, image) -values ('Serhii', 'Soloviov', 'Java-Developer', 'http://image'); +values ('Serhii', 'Soloviov', 'Java-Developer', 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg'); insert into talent_description (talent_id, BIO, addition_info) -values((select id from talent order by id desc limit 1), 'Default bio', 'Default addition info'); +values((select id from talent order by id desc limit 1), 'Serhii Soloviov bio', 'Serhii Soloviov addition info'); insert into talent_link (talent_id, link) values ((select id from talent order by id desc limit 1), 'http://first_link'); insert into talent_link (talent_id, link) @@ -9,11 +9,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_link'); insert into talent_link (talent_id, link) values ((select id from talent order by id desc limit 1), 'http://third_link'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'first_skill'); +values ((select id from talent order by id desc limit 1), 'Java Core'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'second_skill'); +values ((select id from talent order by id desc limit 1), 'Spring Core'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'third_skill'); +values ((select id from talent order by id desc limit 1), 'Spring boot'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'H2 Database'); insert into talent_contact (talent_id, contact) values ((select id from talent order by id desc limit 1), 'first_contact'); insert into talent_contact (talent_id, contact) @@ -28,7 +30,7 @@ insert into talent_attached_file (talent_id, attached_file) values ((select id from talent order by id desc limit 1), 'third_file'); insert into talent (first_name, last_name, specialization, image) -values ('Mykhailo', 'Ordyntsev', 'Java-Developer', 'http://MykhailoOrdyntsevImage'); +values ('Mykhailo', 'Ordyntsev', 'Java-Developer', 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg'); insert into talent_description (talent_id, BIO, addition_info) values((select id from talent order by id desc limit 1), 'Mykhailo Ordyntsev bio', 'Mykhailo Ordyntsev addition info'); insert into talent_link (talent_id, link) @@ -38,11 +40,13 @@ values ((select id from talent order by id desc limit 1), 'http://MykhailoOrdynt insert into talent_link (talent_id, link) values ((select id from talent order by id desc limit 1), 'http://MykhailoOrdyntsev_third_link'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev_first_skill'); +values ((select id from talent order by id desc limit 1), 'Java Core'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Hibernate'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev_second_skill'); +values ((select id from talent order by id desc limit 1), 'Spring Boot'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev_third_skill'); +values ((select id from talent order by id desc limit 1), 'Git'); insert into talent_contact (talent_id, contact) values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev_first_contact'); insert into talent_contact (talent_id, contact) @@ -57,7 +61,7 @@ insert into talent_attached_file (talent_id, attached_file) values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev_third_file'); insert into talent (first_name, last_name, specialization, image) -values ('Denis', 'Boyko', 'Java-Developer', 'http://DenisBoykoImage'); +values ('Denis', 'Boyko', 'Java-Developer', 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg'); insert into talent_description (talent_id, BIO, addition_info) values((select id from talent order by id desc limit 1), 'Denis Boyko bio', 'Denis Boyko addition info'); insert into talent_link (talent_id, link) @@ -67,11 +71,11 @@ values ((select id from talent order by id desc limit 1), 'http://DenisBoyko_sec insert into talent_link (talent_id, link) values ((select id from talent order by id desc limit 1), 'http://DenisBoyko_third_link'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'DenisBoyko_first_skill'); +values ((select id from talent order by id desc limit 1), 'Java Core'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'DenisBoyko_second_skill'); +values ((select id from talent order by id desc limit 1), 'Spring Security'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'DenisBoyko_third_skill'); +values ((select id from talent order by id desc limit 1), 'Spring Core'); insert into talent_contact (talent_id, contact) values ((select id from talent order by id desc limit 1), 'DenisBoyko_first_contact'); insert into talent_contact (talent_id, contact) @@ -86,7 +90,7 @@ insert into talent_attached_file (talent_id, attached_file) values ((select id from talent order by id desc limit 1), 'DenisBoyko_third_file'); insert into talent (first_name, last_name, specialization, image) -values ('Ihor', 'Schurenko', 'Java-Developer', 'http://IhorShchurenkoImage'); +values ('Ihor', 'Schurenko', 'Java-Developer', 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg'); insert into talent_description (talent_id, BIO, addition_info) values((select id from talent order by id desc limit 1), 'Ihor Shchurenko bio', 'Ihor Shchurenko addition info'); insert into talent_link (talent_id, link) @@ -96,11 +100,9 @@ values ((select id from talent order by id desc limit 1), 'http://IhorShchurenko insert into talent_link (talent_id, link) values ((select id from talent order by id desc limit 1), 'http://IhorShchurenko_third_link'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'IhorShchurenko_first_skill'); -insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'IhorShchurenko_second_skill'); +values ((select id from talent order by id desc limit 1), 'Java Core'); insert into talent_skill (talent_id, skill) -values ((select id from talent order by id desc limit 1), 'IhorShchurenko_third_skill'); +values ((select id from talent order by id desc limit 1), 'REST API'); insert into talent_contact (talent_id, contact) values ((select id from talent order by id desc limit 1), 'IhorShchurenko_first_contact'); insert into talent_contact (talent_id, contact) @@ -113,3 +115,255 @@ insert into talent_attached_file (talent_id, attached_file) values ((select id from talent order by id desc limit 1), 'IhorShchurenko_second_file'); insert into talent_attached_file (talent_id, attached_file) values ((select id from talent order by id desc limit 1), 'IhorShchurenko_third_file'); +insert into talent (first_name, last_name, specialization, image) +values ('Dmytro', 'Uzun', 'Dev-Ops', 'https://i.pinimg.com/564x/1c/af/87/1caf8771ef3edf351f6f2bf6f1c0a276.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Dmytro Uzun bio', 'Dmytro Uzun addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DmytroUzun_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DmytroUzun_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DmytroUzun_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Docker'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Mentor'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DmytroUzun_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Viktor', 'Voloshko', 'Dev-Ops', 'https://i.pinimg.com/564x/a9/51/ab/a951ab682413b89617235e65564c1e5e.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Viktor Voloshko bio', 'Viktor Voloshko addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ViktorVoloshko_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ViktorVoloshko_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ViktorVoloshko_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Docker'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ViktorVoloshko_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Olha', 'Moiseienko', 'QA', 'https://i.pinimg.com/564x/6d/9d/43/6d9d437baf4db114c047d927307beb84.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Olha Moiseienko bio', 'Olha Moiseienko addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://OlhaMoiseienko_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://OlhaMoiseienko_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://OlhaMoiseienko_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Jira'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'QA'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko _third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Maxim', 'Kiyashko', 'QA', 'https://i.pinimg.com/564x/80/2d/58/802d58b0302985f9486893d499d3634d.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Maxim Kiyashko', 'Ihor Shchurenko addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://MaximKiyashko_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://MaximKiyashko_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://MaximKiyashko_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'QA'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'MaximKiyashko_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Nikolaiev', 'Oleksii', 'QA', 'https://i.pinimg.com/564x/54/d1/0d/54d10dfce64afefabc9fbbce5de82c87.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Nikolaiev Oleksii bio', 'Nikolaiev Oleksii addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://NikolaievOleksii_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://NikolaievOleksii_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://NikolaievOleksii_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'QA'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_third_skill'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksii_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'NikolaievOleksiio_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Artem', 'Lytvynenko', 'QA', 'https://i.pinimg.com/564x/87/63/55/87635509c5fa7ee496ec351fa7e67eaa.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Artem Lytvynenko bio', 'Artem Lytvynenko addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ArtemLytvynenko_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ArtemLytvynenko_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://ArtemLytvynenko_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'QA'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Git'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Daniil', 'Yevtukhov', 'Java-Script-Developer', 'https://i.pinimg.com/564x/fe/b1/37/feb137d88a3d1c8fb28796db6cbc576f.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Daniil Yevtukhov bio', 'Daniil Yevtukhov addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DaniilYevtukhov_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DaniilYevtukhov_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://DaniilYevtukhov_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'JavaScript Core'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'React'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Ruslan', 'Morozov', 'Java-Script-Developer', 'https://i.pinimg.com/736x/36/ae/0e/36ae0ea4aad656f7c3d3175bc33b8399.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Ruslan Morozov bio', 'Ruslan Morozov addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://RuslanMorozov_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://RuslanMorozov_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://RuslanMorozov_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'JavaScript Core'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'React'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Node.js'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'RuslanMorozov_third_file'); + +insert into talent (first_name, last_name, specialization, image) +values ('Ihor', 'Kopieichykov', 'Java-Script-Developer', 'https://i.pinimg.com/564x/0d/f0/83/0df083121bac75f64e3d93c7c5682d04.jpg'); +insert into talent_description (talent_id, BIO, addition_info) +values((select id from talent order by id desc limit 1), 'Ihor Kopieichykov bio', 'Ihor Kopieichykov addition info'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://IhorKopieichykov_first_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://IhorKopieichykov_second_link'); +insert into talent_link (talent_id, link) +values ((select id from talent order by id desc limit 1), 'http://IhorKopieichykov_third_link'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'JavaScript Core'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'React'); +insert into talent_skill (talent_id, skill) +values ((select id from talent order by id desc limit 1), 'Angular'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_first_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_second_contact'); +insert into talent_contact (talent_id, contact) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_third_contact'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_first_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_second_file'); +insert into talent_attached_file (talent_id, attached_file) +values ((select id from talent order by id desc limit 1), 'IhorKopieichykov_third_file'); \ No newline at end of file diff --git a/src/main/resources/pagination.properties b/src/main/resources/pagination.properties index e69de29..81dce8f 100644 --- a/src/main/resources/pagination.properties +++ b/src/main/resources/pagination.properties @@ -0,0 +1,3 @@ +## DEFAULT PAGE VALUES +page-config.default-page-num=0 +page-config.default-page-size=5 \ No newline at end of file diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index 06f6c86..05c6a9e 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -1,4 +1,13 @@ ---talent tables-- +DROP TABLE IF EXISTS talent CASCADE ; +DROP TABLE IF EXISTS talent_description CASCADE ; +DROP TABLE IF EXISTS talent_link CASCADE ; +DROP TABLE IF EXISTS talent_contact CASCADE ; +DROP TABLE IF EXISTS talent_attached_file CASCADE ; +DROP TABLE IF EXISTS talent_skill CASCADE ; +DROP TABLE IF EXISTS user_authority CASCADE ; +DROP TABLE IF EXISTS user_info CASCADE ; +DROP TABLE IF EXISTS authority CASCADE ; + CREATE TABLE talent ( id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, first_name VARCHAR(20) NOT NULL,