diff --git a/pom.xml b/pom.xml
index 64ee618..07b8dcc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,14 @@
17
+
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-ui
+ 2.0.0
+
+
org.springframework.boot
spring-boot-starter-data-jpa
diff --git a/src/main/java/com/provedcode/ProvedCodeApplication.java b/src/main/java/com/provedcode/ProvedCodeApplication.java
index e780cab..78360e0 100644
--- a/src/main/java/com/provedcode/ProvedCodeApplication.java
+++ b/src/main/java/com/provedcode/ProvedCodeApplication.java
@@ -6,10 +6,10 @@
@SpringBootApplication
@ConfigurationPropertiesScan
-public class ProvedCodeApplication {
+public class ProvedCodeApplication {
- public static void main(String[] args) {
- SpringApplication.run(ProvedCodeApplication.class, args);
- }
+ public static void main(String[] args) {
+ SpringApplication.run(ProvedCodeApplication.class, args);
+ }
}
diff --git a/src/main/java/com/provedcode/config/PageProperties.java b/src/main/java/com/provedcode/config/PageProperties.java
index 48ab911..f3e17d3 100644
--- a/src/main/java/com/provedcode/config/PageProperties.java
+++ b/src/main/java/com/provedcode/config/PageProperties.java
@@ -16,7 +16,8 @@
@Slf4j
public record PageProperties(
int defaultPageNum,
- int defaultPageSize
+ int defaultPageSize,
+ String defaultSortBy
) {
@PostConstruct
void print() {
diff --git a/src/main/java/com/provedcode/config/SecurityConfig.java b/src/main/java/com/provedcode/config/SecurityConfig.java
index 13c0ee8..044a13d 100644
--- a/src/main/java/com/provedcode/config/SecurityConfig.java
+++ b/src/main/java/com/provedcode/config/SecurityConfig.java
@@ -44,6 +44,7 @@
@EnableWebSecurity
@EnableMethodSecurity
public class SecurityConfig {
+ //http://localhost:8080/swagger-ui/index.html
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(c -> c
@@ -51,26 +52,29 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers(antMatcher("/h2/**")).permitAll()
.requestMatchers(antMatcher("/api/talents/**")).permitAll()
.requestMatchers(antMatcher("/error")).permitAll()
+ .requestMatchers(antMatcher("/v3/api-docs/**")).permitAll() // for openAPI
+ .requestMatchers(antMatcher("/swagger-ui/**")).permitAll() // for openAPI
+ .requestMatchers(antMatcher("/swagger-ui.html")).permitAll() // for openAPI
.anyRequest().authenticated()
);
http.exceptionHandling(c -> c
.authenticationEntryPoint((request, response, authException) -> {
- log.info("Authentication failed {}, message:{}",
- describe(request),
- authException.getMessage());
- response.sendError(
- HttpStatus.UNAUTHORIZED.value(),
- authException.getMessage());
- }
+ log.info("Authentication failed {}, message:{}",
+ describe(request),
+ authException.getMessage());
+ response.sendError(
+ HttpStatus.UNAUTHORIZED.value(),
+ authException.getMessage());
+ }
)
.accessDeniedHandler((request, response, accessDeniedException) -> {
- log.info("Authorization failed {},message: {}",
- describe(request),
- accessDeniedException.getMessage());
- response.sendError(HttpStatus.FORBIDDEN.value(),
- accessDeniedException.getMessage());
- }
+ log.info("Authorization failed {},message: {}",
+ describe(request),
+ accessDeniedException.getMessage());
+ response.sendError(HttpStatus.FORBIDDEN.value(),
+ accessDeniedException.getMessage());
+ }
)
);
@@ -82,10 +86,10 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
http.sessionManagement().sessionCreationPolicy(STATELESS);
http.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
- .exceptionHandling(c -> c
- .authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint())
- .accessDeniedHandler(new BearerTokenAccessDeniedHandler())
- );
+ .exceptionHandling(c -> c
+ .authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint())
+ .accessDeniedHandler(new BearerTokenAccessDeniedHandler())
+ );
return http.build();
}
@@ -135,8 +139,8 @@ UserDetailsService userDetailsService(
UserInfoMapper mapper
) {
return login -> repository.findByLogin(login)
- .map(mapper::toUserDetails)
- .orElseThrow(() -> new UsernameNotFoundException(login + " not found"));
+ .map(mapper::toUserDetails)
+ .orElseThrow(() -> new UsernameNotFoundException(login + " not found"));
}
@Bean
diff --git a/src/main/java/com/provedcode/talent/controller/TalentProofController.java b/src/main/java/com/provedcode/talent/controller/TalentProofController.java
index b104448..7d8d8ee 100644
--- a/src/main/java/com/provedcode/talent/controller/TalentProofController.java
+++ b/src/main/java/com/provedcode/talent/controller/TalentProofController.java
@@ -1,11 +1,17 @@
package com.provedcode.talent.controller;
import com.provedcode.talent.mapper.TalentProofMapper;
+import com.provedcode.talent.model.dto.AddProofDTO;
import com.provedcode.talent.model.dto.FullProofDTO;
import com.provedcode.talent.model.dto.ProofDTO;
import com.provedcode.talent.service.TalentProofService;
+import com.provedcode.user.model.dto.SessionInfoDTO;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.Authentication;
+import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
@@ -21,8 +27,25 @@ public class TalentProofController {
@GetMapping("/proofs")
Page getAllProofs(@RequestParam(value = "page") Optional page,
- @RequestParam(value = "size") Optional size) {
- return talentProofService.getAllProofsPage(page, size).map(talentProofMapper::toProofDTO);
+ @RequestParam(value = "size") Optional size,
+ @RequestParam(value = "order-by") Optional orderBy) {
+ return talentProofService.getAllProofsPage(page, size, orderBy).map(talentProofMapper::toProofDTO);
+ }
+
+ @PreAuthorize("hasRole('TALENT')")
+ @DeleteMapping("/{talent-id}/proofs/{proof-id}")
+ SessionInfoDTO deleteProof(@PathVariable(value = "talent-id") long talentId,
+ @PathVariable(value = "proof-id") long proofId,
+ Authentication authentication) {
+ return talentProofService.deleteProofById(talentId, proofId, authentication);
+ }
+
+ @PreAuthorize("hasRole('TALENT')")
+ @PostMapping("/{talent-id}/proofs")
+ ResponseEntity> addProof(@PathVariable(value = "talent-id") long talentId,
+ @RequestBody AddProofDTO addProofDTO,
+ Authentication authentication) {
+ return talentProofService.addProof(addProofDTO, talentId, authentication);
}
@GetMapping("/{talent-id}/proofs")
diff --git a/src/main/java/com/provedcode/talent/model/dto/AddProofDTO.java b/src/main/java/com/provedcode/talent/model/dto/AddProofDTO.java
new file mode 100644
index 0000000..96729f2
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/model/dto/AddProofDTO.java
@@ -0,0 +1,7 @@
+package com.provedcode.talent.model.dto;
+
+public record AddProofDTO(
+ String link,
+ String text
+) {
+}
diff --git a/src/main/java/com/provedcode/talent/service/TalentProofService.java b/src/main/java/com/provedcode/talent/service/TalentProofService.java
index c81f4c0..772133b 100644
--- a/src/main/java/com/provedcode/talent/service/TalentProofService.java
+++ b/src/main/java/com/provedcode/talent/service/TalentProofService.java
@@ -2,27 +2,36 @@
import com.provedcode.config.PageProperties;
import com.provedcode.talent.model.ProofStatus;
+import com.provedcode.talent.model.dto.AddProofDTO;
import com.provedcode.talent.model.dto.FullProofDTO;
import com.provedcode.talent.model.dto.ProofDTO;
import com.provedcode.talent.model.entity.Talent;
import com.provedcode.talent.model.entity.TalentProof;
import com.provedcode.talent.repo.TalentProofRepository;
import com.provedcode.talent.repo.TalentRepository;
+import com.provedcode.user.model.dto.SessionInfoDTO;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.UserInfoRepository;
+import com.provedcode.utill.ValidateTalentForCompliance;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+import java.net.URI;
+import java.time.LocalDateTime;
import java.util.Optional;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
+import static org.springframework.http.HttpStatus.NOT_IMPLEMENTED;
@Service
@AllArgsConstructor
@@ -32,27 +41,89 @@ public class TalentProofService {
TalentRepository talentRepository;
UserInfoRepository userInfoRepository;
PageProperties pageProperties;
+ ValidateTalentForCompliance validateTalentForCompliance;
- public Page getAllProofsPage(Optional page, Optional size) {
+ public Page getAllProofsPage(Optional page, Optional size,
+ Optional orderBy) {
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(pageProperties.defaultPageSize()) <= 0) {
throw new ResponseStatusException(BAD_REQUEST, "'size' query parameter must be greater than or equal to 1");
}
+
+ if (orderBy.isPresent()) {
+ if (!orderBy.get().equalsIgnoreCase(Sort.Direction.ASC.name()) &&
+ !orderBy.get().equalsIgnoreCase(Sort.Direction.DESC.name())) {
+ throw new ResponseStatusException(BAD_REQUEST, "'orderBy' query parameter must be ASC or DESC");
+ }
+ Sort sort =
+ orderBy.get().equalsIgnoreCase(Sort.Direction.ASC.name()) ? Sort.by(pageProperties.defaultSortBy())
+ .ascending()
+ : Sort.by(pageProperties.defaultSortBy())
+ .descending();
+ return talentProofRepository.findByStatus(ProofStatus.PUBLISHED,
+ PageRequest.of(page.orElse(
+ pageProperties.defaultPageNum()),
+ size.orElse(
+ pageProperties.defaultPageSize()), sort));
+ }
return talentProofRepository.findByStatus(ProofStatus.PUBLISHED,
- PageRequest.of(page.orElse(
- pageProperties.defaultPageNum()),
- size.orElse(
- pageProperties.defaultPageSize())));
+ PageRequest.of(page.orElse(
+ pageProperties.defaultPageNum()),
+ size.orElse(
+ pageProperties.defaultPageSize())));
+ }
+
+ @Transactional
+ public SessionInfoDTO deleteProofById(long talentId, long proofId, Authentication authentication) {
+
+ Optional talent = talentRepository.findById(talentId);
+ Optional talentProof = talentProofRepository.findById(proofId);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+ validateTalentForCompliance.userVerification(talent, talentProof, userInfo, talentId, proofId);
+ talentProofRepository.delete(talentProof.orElseThrow(() -> new ResponseStatusException(NOT_IMPLEMENTED)));
+ return new SessionInfoDTO("deleted", "null");
+ }
+
+ public ResponseEntity> addProof(AddProofDTO addProofDTO, long talentId, Authentication authentication) {
+
+ Optional talent = talentRepository.findById(talentId);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+
+ validateTalentForCompliance.userVerification(talent, userInfo, talentId);
+
+ TalentProof talentProof = TalentProof.builder()
+ .talent(talent.get())
+ .talentId(talentId)
+ .link(addProofDTO.link())
+ .text(addProofDTO.text())
+ .status(ProofStatus.DRAFT)
+ .created(LocalDateTime.now())
+ .build();
+
+ talentProofRepository.save(talentProof);
+
+ URI location = ServletUriComponentsBuilder
+ .fromCurrentRequest()
+ .path("/{id}")
+ .buildAndExpand(talentProof.getId())
+ .toUri();
+
+ return ResponseEntity.created(location).build();
}
public FullProofDTO getTalentProofs(Long talentId, Optional page, Optional size,
- Optional direction, Authentication authentication, String... sortProperties) {
+ Optional direction, Authentication authentication,
+ String... sortProperties) {
Talent talent = talentRepository.findById(talentId)
- .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Talent with id = %s not found".formatted(talentId)));
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND,
+ "Talent with id = %s not found".formatted(
+ talentId)));
UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
- .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Talent with id = %s not found".formatted(talentId)));
+ .orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND,
+ "Talent with id = %s not found".formatted(
+ talentId)));
Page proofs;
PageRequest pageRequest;
String sortDirection = direction.orElseGet(Sort.DEFAULT_DIRECTION::name);
@@ -63,7 +134,8 @@ public FullProofDTO getTalentProofs(Long talentId, Optional page, Optio
if (size.orElse(pageProperties.defaultPageSize()) <= 0) {
throw new ResponseStatusException(BAD_REQUEST, "'size' query parameter must be greater than or equal to 1");
}
- if (!sortDirection.equalsIgnoreCase(Sort.Direction.ASC.name()) && !sortDirection.equalsIgnoreCase(Sort.Direction.DESC.name())) {
+ if (!sortDirection.equalsIgnoreCase(Sort.Direction.ASC.name()) &&
+ !sortDirection.equalsIgnoreCase(Sort.Direction.DESC.name())) {
throw new ResponseStatusException(BAD_REQUEST, "'direction' query param must be equals ASC or DESC");
}
@@ -84,17 +156,17 @@ public FullProofDTO getTalentProofs(Long talentId, Optional page, Optio
}
return FullProofDTO.builder()
- .id(talent.getId())
- .image(talent.getImage())
- .firstName(talent.getFirstName())
- .lastName(talent.getLastName())
- .specialization(talent.getSpecialization())
- .proofs(proofs.map(i -> ProofDTO.builder()
- .id(i.getId())
- .created(i.getCreated().toString())
- .link(i.getLink())
- .text(i.getText())
- .status(i.getStatus()).build()))
- .build();
+ .id(talent.getId())
+ .image(talent.getImage())
+ .firstName(talent.getFirstName())
+ .lastName(talent.getLastName())
+ .specialization(talent.getSpecialization())
+ .proofs(proofs.map(i -> ProofDTO.builder()
+ .id(i.getId())
+ .created(i.getCreated().toString())
+ .link(i.getLink())
+ .text(i.getText())
+ .status(i.getStatus()).build()))
+ .build();
}
-}
+}
\ 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 fd3b24b..d472df5 100644
--- a/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java
+++ b/src/main/java/com/provedcode/talent/service/impl/TalentServiceImpl.java
@@ -8,6 +8,7 @@
import com.provedcode.user.model.dto.SessionInfoDTO;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.UserInfoRepository;
+import com.provedcode.utill.ValidateTalentForCompliance;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
@@ -30,6 +31,7 @@ public class TalentServiceImpl implements TalentService {
TalentRepository talentRepository;
UserInfoRepository userInfoRepository;
PageProperties pageProperties;
+ ValidateTalentForCompliance validateTalentForCompliance;
@Override
@@ -42,7 +44,7 @@ public Page getTalentsPage(Optional page, Optional siz
throw new ResponseStatusException(BAD_REQUEST, "'size' query parameter must be greater than or equal to 1");
}
return talentRepository.findAll(PageRequest.of(page.orElse(pageProperties.defaultPageNum()),
- size.orElse(pageProperties.defaultPageSize())));
+ size.orElse(pageProperties.defaultPageSize())));
}
@@ -61,7 +63,7 @@ public Talent editTalent(long id, FullTalentDTO fullTalent, Authentication authe
Optional talent = talentRepository.findById(id);
Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
- userVerification(talent, userInfo, id);
+ validateTalentForCompliance.userVerification(talent, userInfo, id);
Talent oldTalent = talent.get();
long oldTalentId = oldTalent.getId();
@@ -78,60 +80,60 @@ public Talent editTalent(long id, FullTalentDTO fullTalent, Authentication authe
.setBio(fullTalent.bio());
} else {
oldTalentDescription = TalentDescription.builder()
- .talentId(oldTalentId)
- .additionalInfo(fullTalent.additionalInfo())
- .bio(fullTalent.bio())
- .talent(oldTalent)
- .build();
+ .talentId(oldTalentId)
+ .additionalInfo(fullTalent.additionalInfo())
+ .bio(fullTalent.bio())
+ .talent(oldTalent)
+ .build();
}
oldTalentTalents.clear();
if (fullTalent.talents() != null) {
oldTalentTalents.addAll(fullTalent.talents().stream().map(s -> TalentTalents.builder()
- .talentId(oldTalentId)
- .talent(oldTalent)
- .talentName(s)
- .build()).toList());
+ .talentId(oldTalentId)
+ .talent(oldTalent)
+ .talentName(s)
+ .build()).toList());
}
oldTalentLinks.clear();
if (fullTalent.links() != null) {
oldTalentLinks.addAll(fullTalent.links().stream().map(l -> TalentLink.builder()
- .talentId(oldTalentId)
- .talent(oldTalent)
- .link(l)
- .build()).toList());
+ .talentId(oldTalentId)
+ .talent(oldTalent)
+ .link(l)
+ .build()).toList());
}
oldTalentContacts.clear();
if (fullTalent.contacts() != null) {
oldTalentContacts.addAll(fullTalent.contacts().stream().map(s -> TalentContact.builder()
- .talentId(oldTalentId)
- .talent(oldTalent)
- .contact(s)
- .build()).toList());
+ .talentId(oldTalentId)
+ .talent(oldTalent)
+ .contact(s)
+ .build()).toList());
}
oldTalentAttachedFile.clear();
if (fullTalent.attachedFiles() != null) {
oldTalentAttachedFile.addAll(fullTalent.attachedFiles().stream().map(s -> TalentAttachedFile.builder()
- .talentId(
- oldTalentId)
- .talent(oldTalent)
- .attachedFile(s)
- .build())
- .toList());
+ .talentId(
+ oldTalentId)
+ .talent(oldTalent)
+ .attachedFile(s)
+ .build())
+ .toList());
}
oldTalent.setFirstName(fullTalent.firstName())
- .setLastName(fullTalent.lastName())
- .setSpecialization(fullTalent.specialization())
- .setImage(fullTalent.image())
- .setTalentDescription(oldTalentDescription)
- .setTalentTalents(oldTalentTalents)
- .setTalentLinks(oldTalentLinks)
- .setTalentContacts(oldTalentContacts)
- .setTalentAttachedFiles(oldTalentAttachedFile);
+ .setLastName(fullTalent.lastName())
+ .setSpecialization(fullTalent.specialization())
+ .setImage(fullTalent.image())
+ .setTalentDescription(oldTalentDescription)
+ .setTalentTalents(oldTalentTalents)
+ .setTalentLinks(oldTalentLinks)
+ .setTalentContacts(oldTalentContacts)
+ .setTalentAttachedFiles(oldTalentAttachedFile);
Talent newTalent = talentRepository.save(oldTalent);
@@ -143,19 +145,10 @@ public SessionInfoDTO deleteTalentById(long id, Authentication authentication) {
Optional talent = talentRepository.findById(id);
Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
- userVerification(talent, userInfo, id);
+ validateTalentForCompliance.userVerification(talent, userInfo, id);
userInfoRepository.delete(userInfo.orElseThrow(() -> new ResponseStatusException(NOT_IMPLEMENTED)));
talentRepository.delete(talent.orElseThrow(() -> new ResponseStatusException(NOT_IMPLEMENTED)));
return new SessionInfoDTO("deleted", "null");
}
-
- private void userVerification(Optional talent, Optional userInfo, long id) {
- if (talent.isEmpty() || userInfo.isEmpty()) {
- throw new ResponseStatusException(NOT_FOUND, String.format("talent with id = %d not found", id));
- }
- if (userInfo.get().getTalent().getId() != id) {
- throw new ResponseStatusException(FORBIDDEN, "you can`t delete/update another user");
- }
- }
}
diff --git a/src/main/java/com/provedcode/utill/ValidateTalentForCompliance.java b/src/main/java/com/provedcode/utill/ValidateTalentForCompliance.java
new file mode 100644
index 0000000..b6103e0
--- /dev/null
+++ b/src/main/java/com/provedcode/utill/ValidateTalentForCompliance.java
@@ -0,0 +1,42 @@
+package com.provedcode.utill;
+
+import com.provedcode.talent.model.entity.Talent;
+import com.provedcode.talent.model.entity.TalentProof;
+import com.provedcode.user.model.entity.UserInfo;
+import org.springframework.stereotype.Service;
+import org.springframework.web.server.ResponseStatusException;
+
+import java.util.Optional;
+
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.NOT_FOUND;
+
+@Service
+public class ValidateTalentForCompliance {
+
+ public void userVerification(Optional talent, Optional userInfo, long id) {
+ if (talent.isEmpty() || userInfo.isEmpty()) {
+ throw new ResponseStatusException(NOT_FOUND, String.format("talent with id = %d not found", id));
+ }
+ if (userInfo.get().getTalent().getId() != id) {
+ throw new ResponseStatusException(FORBIDDEN, "you can`t add proof another user");
+ }
+ }
+
+ public void userVerification(Optional talent,
+ Optional talentProof,
+ Optional userInfo, long talentId, long proofId) {
+ if (talent.isEmpty() && userInfo.isEmpty()) {
+ throw new ResponseStatusException(NOT_FOUND, String.format("talent with id = %d not found", talentId));
+ }
+ if (userInfo.get().getTalent().getId() != talentId) {
+ throw new ResponseStatusException(FORBIDDEN, "you can`t delete/update another user");
+ }
+ if (talentProof.isEmpty()) {
+ throw new ResponseStatusException(NOT_FOUND, String.format("proof with id = %d not found", proofId));
+ }
+ if (talentProof.get().getTalentId() != talentId) {
+ throw new ResponseStatusException(FORBIDDEN, "you can`t delete/update another proof");
+ }
+ }
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 3b79c9c..943468c 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -19,3 +19,5 @@ spring.jpa.properties.javax.persistence.schema-generation.scripts.drop-source=me
##DEFAULT PAGE PROPS
page-config.default-page-num=0
page-config.default-page-size=5
+page-config.default-sort-by=created
+##
\ No newline at end of file
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index 494a7af..35e7efc 100644
--- a/src/main/resources/data.sql
+++ b/src/main/resources/data.sql
@@ -37,11 +37,11 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2022-01-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-03-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'HIDDEN', '2021-06-08 16:00:19');
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'SerhiiSoloviov', 'password');
@@ -80,11 +80,11 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'DRAFT', '2022-08-07 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'HIDDEN', '2022-04-08 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2022-09-02 16:00:19');
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'MykhailoOrdyntsev', 'password');
@@ -121,11 +121,11 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'DRAFT', '2022-02-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2021-09-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-04-04 16:00:19');
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'DenisBoyko', 'password');
@@ -160,6 +160,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2021-08-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2022-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-05-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'DmytroUzun', 'password');
insert into user_authorities (user_id, authority_id)
@@ -195,6 +202,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-02-08 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2021-03-03 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-09-05 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'DmytroUzun', 'password');
insert into user_authorities (user_id, authority_id)
@@ -228,6 +242,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'HIDDEN', '2022-02-09 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2020-04-02 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-08-06 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'ViktorVoloshko', 'password');
insert into user_authorities (user_id, authority_id)
@@ -263,6 +284,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'HIDDEN', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'PUBLISHED', '2022-09-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2021-01-09 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'OlhaMoiseienko', 'password');
insert into user_authorities (user_id, authority_id)
@@ -296,6 +324,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-08-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-01-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'PUBLISHED', '2023-02-09 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'MaximKiyashko', 'password');
insert into user_authorities (user_id, authority_id)
@@ -331,6 +366,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'NikolaievOleksiio', 'password');
insert into user_authorities (user_id, authority_id)
@@ -364,6 +406,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'ArtemLytvynenko', 'password');
insert into user_authorities (user_id, authority_id)
@@ -397,6 +446,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'HIDDEN', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'DaniilYevtukhov', 'password');
insert into user_authorities (user_id, authority_id)
@@ -432,6 +488,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'RuslanMorozov', 'password');
insert into user_authorities (user_id, authority_id)
@@ -467,6 +530,13 @@ values ((select id from talent order by id desc limit 1), 'http://second_file');
insert into talent_attached_file (talent_id, attached_file)
values ((select id from talent order by id desc limit 1), 'http://third_file');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://first_link', 'text to first proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://second_link', 'text to second proof', 'PUBLISHED', '2023-06-04 16:00:19');
+insert into talent_proofs (talent_id, link, text, status, created)
+values ((select id from talent order by id desc limit 1), 'http://third_link', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
+
insert into user_info (talent_id, login, password)
values ((select id from talent order by id desc limit 1), 'IhorKopieichykov', 'password');
insert into user_authorities (user_id, authority_id)