diff --git a/pom.xml b/pom.xml
index 54591a1..409f5d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,13 +10,17 @@
com.provedcode
demo
- 0.1.1-SNAPSHOT
+ 0.5.0-SNAPSHOT
ProvedCode
Demo project for Spring Boot
17
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
org.springdoc
diff --git a/src/main/java/com/provedcode/aws/controller/AWSS3BucketController.java b/src/main/java/com/provedcode/aws/controller/AWSS3BucketController.java
index 926e991..54bd25f 100644
--- a/src/main/java/com/provedcode/aws/controller/AWSS3BucketController.java
+++ b/src/main/java/com/provedcode/aws/controller/AWSS3BucketController.java
@@ -21,10 +21,11 @@ public class AWSS3BucketController {
@PostSetNewUserImageApiDoc
@PreAuthorize("hasRole('TALENT')")
- @PostMapping("/image/upload")
+ @PostMapping("/talents/{talent-id}/image/upload")
public void setNewUserImage(@RequestParam("file") MultipartFile file,
- Authentication authentication) {
- fileService.setNewUserImage(file, authentication);
+ @PathVariable("talent-id") Long talentId,
+ Authentication authentication) {
+ fileService.setNewUserImage(file, talentId, authentication);
}
@GetAllAWSBucketFilesDevApiDoc
diff --git a/src/main/java/com/provedcode/aws/service/FileService.java b/src/main/java/com/provedcode/aws/service/FileService.java
index 1c1d9e6..bb771c2 100644
--- a/src/main/java/com/provedcode/aws/service/FileService.java
+++ b/src/main/java/com/provedcode/aws/service/FileService.java
@@ -16,7 +16,7 @@ public interface FileService {
List listAllFiles();
- void setNewUserImage(MultipartFile file, Authentication authentication);
+ void setNewUserImage(MultipartFile file, Long talentId, Authentication authentication);
URL generetePresingedUrlFor7Days(String fileFullPath);
}
diff --git a/src/main/java/com/provedcode/aws/service/S3Service.java b/src/main/java/com/provedcode/aws/service/S3Service.java
index a7a4dc9..5c753ef 100644
--- a/src/main/java/com/provedcode/aws/service/S3Service.java
+++ b/src/main/java/com/provedcode/aws/service/S3Service.java
@@ -6,6 +6,7 @@
import com.amazonaws.services.s3.model.*;
import com.amazonaws.util.IOUtils;
import com.provedcode.config.AWSProperties;
+import com.provedcode.talent.model.entity.Talent;
import com.provedcode.talent.repo.TalentRepository;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.UserInfoRepository;
@@ -75,7 +76,7 @@ public List listAllFiles() {
}
@Override
- public void setNewUserImage(MultipartFile file, Authentication authentication) {
+ public void setNewUserImage(MultipartFile file, Long talentId, Authentication authentication) {
if (file.isEmpty()) {
throw new ResponseStatusException(BAD_REQUEST, "file must be not empty, actual file-size: %s".formatted(file.getSize()));
}
@@ -84,6 +85,11 @@ public void setNewUserImage(MultipartFile file, Authentication authentication) {
}
UserInfo user = userInfoRepository.findByLogin(authentication.getName())
.orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "user with login = {%s} not found".formatted(authentication.getName())));
+ Talent talent = talentRepository.findById(talentId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "talent with id = {%s} not found".formatted(talentId)));
+ if (!user.getTalent().equals(talent)) {
+ throw new ResponseStatusException(FORBIDDEN, "You cannot change another talent");
+ }
try {
String fileType = getFileType(file);
diff --git a/src/main/java/com/provedcode/config/EmailConfig.java b/src/main/java/com/provedcode/config/EmailConfig.java
new file mode 100644
index 0000000..d1a0073
--- /dev/null
+++ b/src/main/java/com/provedcode/config/EmailConfig.java
@@ -0,0 +1,15 @@
+package com.provedcode.config;
+
+import lombok.AllArgsConstructor;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+
+@Configuration
+@AllArgsConstructor
+public class EmailConfig {
+ private Environment env;
+
+ public String getDefaultEmail() {
+ return env.getProperty("EMAIL_USER");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/config/EmailDefaultProps.java b/src/main/java/com/provedcode/config/EmailDefaultProps.java
new file mode 100644
index 0000000..f6adf63
--- /dev/null
+++ b/src/main/java/com/provedcode/config/EmailDefaultProps.java
@@ -0,0 +1,19 @@
+package com.provedcode.config;
+
+import jakarta.annotation.PostConstruct;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.validation.annotation.Validated;
+
+@Validated
+@ConfigurationProperties(prefix = "default-email")
+@Slf4j
+public record EmailDefaultProps(
+ String userDeleted,
+ String userDeletedSubject
+) {
+ @PostConstruct
+ void logging() {
+ log.info("email-default-props = {}", this);
+ }
+}
diff --git a/src/main/java/com/provedcode/config/SecurityConfig.java b/src/main/java/com/provedcode/config/SecurityConfig.java
index 6a3ac6b..8bfb464 100644
--- a/src/main/java/com/provedcode/config/SecurityConfig.java
+++ b/src/main/java/com/provedcode/config/SecurityConfig.java
@@ -9,6 +9,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
@@ -51,14 +52,15 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.requestMatchers("/actuator/health").permitAll() // for DevOps
.requestMatchers(antMatcher("/h2/**")).permitAll()
.requestMatchers(antMatcher("/api/*/talents/**")).permitAll()
- .requestMatchers(antMatcher("/api/*/proofs/**")).permitAll()
.requestMatchers(antMatcher("/api/*/sponsors/**")).permitAll()
.requestMatchers(antMatcher("/api/*/login")).permitAll()
.requestMatchers(antMatcher("/api/*/skills")).permitAll()
+ .requestMatchers(antMatcher("/api/*/proofs/**")).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
+ .requestMatchers(antMatcher(HttpMethod.GET, "/api/v5/activate")).permitAll()// for email account recovery
.anyRequest().authenticated()
);
diff --git a/src/main/java/com/provedcode/config/ServerInfoConfig.java b/src/main/java/com/provedcode/config/ServerInfoConfig.java
new file mode 100644
index 0000000..ba483f4
--- /dev/null
+++ b/src/main/java/com/provedcode/config/ServerInfoConfig.java
@@ -0,0 +1,29 @@
+package com.provedcode.config;
+
+import lombok.AllArgsConstructor;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+@AllArgsConstructor
+@Configuration
+public class ServerInfoConfig {
+ private Environment env;
+
+ public String getServerPort() {
+ return env.getProperty("server.port");
+ }
+ public String getIpAddress() {
+ InetAddress ip = null;
+ try {
+ return ip.getLocalHost().getHostAddress();
+ } catch (UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ public String getFullServerAddress() {
+ return getIpAddress() + ":" + getServerPort();
+ }
+}
diff --git a/src/main/java/com/provedcode/handlers/GlobalControllerAdvice.java b/src/main/java/com/provedcode/handlers/GlobalControllerAdvice.java
new file mode 100644
index 0000000..1d59e1d
--- /dev/null
+++ b/src/main/java/com/provedcode/handlers/GlobalControllerAdvice.java
@@ -0,0 +1,33 @@
+package com.provedcode.handlers;
+
+import com.provedcode.user.model.entity.UserInfo;
+import com.provedcode.user.repo.UserInfoRepository;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.core.Authentication;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.server.ResponseStatusException;
+
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.NOT_FOUND;
+
+@ControllerAdvice
+@AllArgsConstructor
+@Slf4j
+public class GlobalControllerAdvice {
+ UserInfoRepository userInfoRepository;
+
+ @ModelAttribute
+ public void handleAuthentication(Authentication authentication) {
+ if (authentication != null) {
+ String login = authentication.getName();
+ UserInfo user = userInfoRepository.findByLogin(login)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "User with login {%s} not found".formatted(login)));
+ if (Boolean.TRUE.equals(user.getIsLocked())) {
+ throw new ResponseStatusException(FORBIDDEN, "your account is blocked");
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/provedcode/handlers/TalentExceptionHandler.java b/src/main/java/com/provedcode/handlers/TalentExceptionHandler.java
index 7da4cc8..cc31cbf 100644
--- a/src/main/java/com/provedcode/handlers/TalentExceptionHandler.java
+++ b/src/main/java/com/provedcode/handlers/TalentExceptionHandler.java
@@ -1,5 +1,6 @@
package com.provedcode.handlers;
+import com.provedcode.handlers.dto.ErrorDTO;
import jakarta.validation.ConstraintViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
@@ -65,7 +66,7 @@ private ResponseEntity> responseStatusExceptionHandler(ResponseStatusException
@ResponseStatus(HttpStatus.BAD_REQUEST)
private ResponseEntity> responseStatusExceptionHandler(ConstraintViolationException exception) {
ApiError apiError = new ApiError(HttpStatus.BAD_REQUEST, exception.getMessage(), exception.toString());
- return new ResponseEntity<>(apiError, new HttpHeaders(), apiError.getStatus());
+ return new ResponseEntity<>(new ErrorDTO(apiError.getMessage()), new HttpHeaders(), apiError.getStatus());
}
// @ExceptionHandler({ Exception.class })
diff --git a/src/main/java/com/provedcode/kudos/controller/KudosController.java b/src/main/java/com/provedcode/kudos/controller/KudosController.java
index 72e0a57..78fa3e1 100644
--- a/src/main/java/com/provedcode/kudos/controller/KudosController.java
+++ b/src/main/java/com/provedcode/kudos/controller/KudosController.java
@@ -1,5 +1,15 @@
package com.provedcode.kudos.controller;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.Authentication;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
import com.provedcode.kudos.model.request.SetAmountKudos;
import com.provedcode.kudos.model.response.KudosAmount;
import com.provedcode.kudos.model.response.KudosAmountWithSponsor;
@@ -7,19 +17,14 @@
import com.provedcode.util.annotations.doc.controller.kudos.GetAmountOfKudosApiDoc;
import com.provedcode.util.annotations.doc.controller.kudos.GetKudosForSponsorApiDoc;
import com.provedcode.util.annotations.doc.controller.kudos.PostAddKudosToProofApiDoc;
+
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.core.Authentication;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Optional;
@RestController
@AllArgsConstructor
@Validated
-@RequestMapping("/api/v3/")
+@RequestMapping("/api/v5/")
public class KudosController {
KudosService kudosService;
@@ -41,8 +46,20 @@ KudosAmountWithSponsor getProofKudos(@PathVariable("proof-id") long proofId, Aut
@PreAuthorize("hasRole('SPONSOR')")
@PostMapping("/proofs/{proof-id}/kudos")
void addKudosToProof(@PathVariable("proof-id") long proofId,
- @RequestBody @Valid Optional amount,
- Authentication authentication) {
+ @RequestBody @Valid SetAmountKudos amount,
+ Authentication authentication) {
kudosService.addKudosToProof(proofId, amount, authentication);
}
+
+ @PreAuthorize("hasRole('SPONSOR')")
+ @PostMapping("/proofs/{proof-id}/skills/{skill-id}/kudos")
+ void addKudosToSkill(@PathVariable("proof-id") long proofId, @PathVariable("skill-id") long skillId,
+ Authentication authentication, @RequestBody @Valid SetAmountKudos amount) {
+ kudosService.addKudosToSkill(proofId, skillId, amount, authentication);
+ }
+
+ @GetMapping("/proofs/{proof-id}/skills/{skill-id}/kudos")
+ KudosAmount getKudosForSkill(@PathVariable("proof-id") long proofId, @PathVariable("skill-id") long skillId) {
+ return kudosService.getSkillKudos(proofId, skillId);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/kudos/model/entity/Kudos.java b/src/main/java/com/provedcode/kudos/model/entity/Kudos.java
index 259c387..f4d1df1 100644
--- a/src/main/java/com/provedcode/kudos/model/entity/Kudos.java
+++ b/src/main/java/com/provedcode/kudos/model/entity/Kudos.java
@@ -1,9 +1,22 @@
package com.provedcode.kudos.model.entity;
import com.provedcode.sponsor.model.entity.Sponsor;
-import com.provedcode.talent.model.entity.TalentProof;
-import jakarta.persistence.*;
-import lombok.*;
+import com.provedcode.talent.model.entity.ProofSkill;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.Positive;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@Getter
@Setter
@@ -15,14 +28,15 @@
public class Kudos {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, updatable = false, insertable = false)
private Long id;
@Column(name = "amount")
+ @Positive
private Long amount;
@ManyToOne
@JoinColumn(name = "sponsor_id")
private Sponsor sponsor;
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "proof_id")
- private TalentProof proof;
+ @ManyToOne
+ @JoinColumn(name = "proof_skill_id")
+ private ProofSkill skill;
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/kudos/model/response/KudosAmountWithSponsor.java b/src/main/java/com/provedcode/kudos/model/response/KudosAmountWithSponsor.java
index 75b80f9..f7460c2 100644
--- a/src/main/java/com/provedcode/kudos/model/response/KudosAmountWithSponsor.java
+++ b/src/main/java/com/provedcode/kudos/model/response/KudosAmountWithSponsor.java
@@ -8,6 +8,6 @@
@Builder
public record KudosAmountWithSponsor(
Long allKudosOnProof,
- Map kudosFromSponsor
+ Map> kudosFromSponsor
) {
}
diff --git a/src/main/java/com/provedcode/kudos/repository/KudosRepository.java b/src/main/java/com/provedcode/kudos/repository/KudosRepository.java
index 3b0f629..0408d75 100644
--- a/src/main/java/com/provedcode/kudos/repository/KudosRepository.java
+++ b/src/main/java/com/provedcode/kudos/repository/KudosRepository.java
@@ -1,10 +1,13 @@
package com.provedcode.kudos.repository;
-import com.provedcode.kudos.model.entity.Kudos;
+import java.util.List;
+
import org.springframework.data.jpa.repository.JpaRepository;
-public interface KudosRepository extends JpaRepository {
- long countByProofId(Long id);
+import com.provedcode.kudos.model.entity.Kudos;
+import com.provedcode.talent.model.entity.ProofSkill;
+
- boolean existsBySponsorIdAndProofId(Long sponsorId, Long proofId);
+public interface KudosRepository extends JpaRepository {
+ List findBySkill(ProofSkill skill);
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/kudos/service/KudosService.java b/src/main/java/com/provedcode/kudos/service/KudosService.java
index 7945e82..793441a 100644
--- a/src/main/java/com/provedcode/kudos/service/KudosService.java
+++ b/src/main/java/com/provedcode/kudos/service/KudosService.java
@@ -1,5 +1,18 @@
package com.provedcode.kudos.service;
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.NOT_FOUND;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.server.ResponseStatusException;
+
import com.provedcode.kudos.model.entity.Kudos;
import com.provedcode.kudos.model.request.SetAmountKudos;
import com.provedcode.kudos.model.response.KudosAmount;
@@ -10,24 +23,16 @@
import com.provedcode.sponsor.model.entity.Sponsor;
import com.provedcode.sponsor.repository.SponsorRepository;
import com.provedcode.talent.model.ProofStatus;
+import com.provedcode.talent.model.entity.ProofSkill;
import com.provedcode.talent.model.entity.Talent;
import com.provedcode.talent.model.entity.TalentProof;
+import com.provedcode.talent.repo.ProofSkillRepository;
import com.provedcode.talent.repo.TalentProofRepository;
import com.provedcode.talent.repo.TalentRepository;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.UserInfoRepository;
-import lombok.AllArgsConstructor;
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.server.ResponseStatusException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.springframework.http.HttpStatus.*;
+import lombok.AllArgsConstructor;
@Service
@AllArgsConstructor
@@ -38,39 +43,9 @@ public class KudosService {
UserInfoRepository userInfoRepository;
SponsorRepository sponsorRepository;
TalentRepository talentRepository;
+ ProofSkillRepository proofSkillRepository;
SponsorMapper sponsorMapper;
- public void addKudosToProof(long proofId, Optional setAmountKudos, Authentication authentication) {
- String login = authentication.getName();
- UserInfo userInfo = userInfoRepository.findByLogin(login)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "User with login = %s not found".formatted(
- login)));
- Sponsor sponsor = sponsorRepository.findById(userInfo.getSponsor().getId()).orElseThrow(
- () -> new ResponseStatusException(NOT_FOUND,
- "Sponsor with login = %s not found".formatted(login)));
- TalentProof talentProof = talentProofRepository.findById(proofId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "Proof with id = %d not found".formatted(
- proofId)));
-
- if (kudosRepository.existsBySponsorIdAndProofId(sponsor.getId(), talentProof.getId()))
- throw new ResponseStatusException(FORBIDDEN, "The sponsor has already set kudos to this proof");
- if (!talentProof.getStatus().equals(ProofStatus.PUBLISHED))
- throw new ResponseStatusException(FORBIDDEN, "Proof that was kudosed does not have the PUBLISHED status");
-
- long obtainedAmount = setAmountKudos.orElse(new SetAmountKudos(1L)).amount();
- if (sponsor.getAmountKudos() < obtainedAmount) {
- throw new ResponseStatusException(FORBIDDEN, "The sponsor cannot give more kudos than he has");
- }
- sponsor.setAmountKudos(sponsor.getAmountKudos() - obtainedAmount);
- kudosRepository.save(Kudos.builder()
- .amount(obtainedAmount)
- .proof(talentProof)
- .sponsor(sponsor)
- .build());
- }
-
@Transactional(readOnly = true)
public KudosAmount getKudosForSponsor(long sponsorId, Authentication authentication) {
String login = authentication.getName();
@@ -92,58 +67,69 @@ public KudosAmountWithSponsor getProofKudos(long proofId, Authentication authent
String login = authentication.getName();
UserInfo userInfo = userInfoRepository.findByLogin(login)
.orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "User with login = %s not found".formatted(
- login)));
+ "User with login = %s not found".formatted(login)));
TalentProof talentProof = talentProofRepository.findById(proofId)
.orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "Proof with id = %s not found".formatted(
- proofId)));
- Long countOfAllKudos = talentProof.getKudos().stream()
- .map(Kudos::getAmount)
- .reduce(0L, (prev, next) -> prev + next);
+ "Proof with id = %s not found".formatted(proofId)));
+
+ Long countOfAllKudos = talentProof.getProofSkills()
+ .stream().flatMap(proofSkills -> proofSkills.getKudos()
+ .stream().map(Kudos::getAmount))
+ .reduce(0L, Long::sum);
+ Map> skillsMap = new HashMap<>();
if (userInfo.getSponsor() != null && userInfo.getTalent() == null) {
Sponsor sponsor = sponsorRepository.findById(userInfo.getSponsor().getId())
.orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
"User with login = %s not found".formatted(
login)));
-
- Map kudosFromSponsor = talentProof.getKudos().stream()
- .filter(kudos -> sponsor.equals(kudos.getSponsor()))
- .collect(Collectors.toMap(
- Kudos::getAmount,
- proof -> sponsorMapper.toDto(
- proof.getSponsor()),
- (prev, next) -> next,
- HashMap::new
- ));
+ talentProof.getProofSkills().forEach(proofSkill -> {
+ String skill = proofSkill.getSkill().getSkill();
+ Map kudosFromSponsor = talentProof.getProofSkills().stream()
+ .map(proofSkills -> {
+ proofSkills.setKudos(proofSkills.getKudos().stream()
+ .filter(kudos -> sponsor.equals(kudos.getSponsor())).toList());
+ return proofSkills;
+ })
+ .filter(proofSkills -> proofSkills.getSkill().getSkill().equals(skill))
+ .flatMap(proofSkills -> proofSkills.getKudos().stream())
+ .collect(Collectors.toMap(
+ Kudos::getAmount,
+ proof -> proof.getSponsor() != null
+ ? sponsorMapper.toDto(proof.getSponsor())
+ : SponsorDTO.builder().build(),
+ (prev, next) -> next,
+ HashMap::new));
+ skillsMap.put(skill, kudosFromSponsor);
+ });
return KudosAmountWithSponsor.builder()
.allKudosOnProof(countOfAllKudos)
- .kudosFromSponsor(kudosFromSponsor)
+ .kudosFromSponsor(skillsMap)
.build();
}
+
Talent talent = talentRepository.findById(userInfo.getTalent().getId())
.orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "Talent with login = %s not found".formatted(
- login)));
-
-
+ "Talent with login = %s not found".formatted(login)));
if (talent.getId().equals(talentProof.getTalent().getId())) {
- Map kudosFromSponsor = talentProof.getKudos().stream()
- .collect(Collectors.toMap(
- Kudos::getAmount,
- proof -> proof.getSponsor() != null
- ? sponsorMapper.toDto(
- proof.getSponsor())
- : SponsorDTO.builder().build(),
- (prev, next) -> next,
- HashMap::new
- ));
-
+ talentProof.getProofSkills().forEach(proofSkill -> { // I dnk wtf is this piece of shit, but it works.
+ String skill = proofSkill.getSkill().getSkill();
+ Map kudosFromSponsor = talentProof.getProofSkills().stream()
+ .filter(proofSkills -> proofSkills.getSkill().getSkill().equals(skill))
+ .flatMap(proofSkills -> proofSkills.getKudos().stream())
+ .collect(Collectors.toMap(
+ Kudos::getAmount,
+ proof -> proof.getSponsor() != null
+ ? sponsorMapper.toDto(proof.getSponsor())
+ : SponsorDTO.builder().build(),
+ (prev, next) -> next,
+ HashMap::new));
+ skillsMap.put(skill, kudosFromSponsor);
+ });
return KudosAmountWithSponsor.builder()
.allKudosOnProof(countOfAllKudos)
- .kudosFromSponsor(kudosFromSponsor)
+ .kudosFromSponsor(skillsMap)
.build();
} else {
return KudosAmountWithSponsor.builder()
@@ -151,4 +137,86 @@ public KudosAmountWithSponsor getProofKudos(long proofId, Authentication authent
.kudosFromSponsor(null).build();
}
}
-}
\ No newline at end of file
+
+ public void addKudosToProof(long proofId, SetAmountKudos amountOfKudoses, Authentication authentication) {
+ String login = authentication.getName();
+ UserInfo userInfo = userInfoRepository.findByLogin(login)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "User with login = %s not found".formatted(login)));
+ Sponsor sponsor = sponsorRepository.findById(userInfo.getSponsor().getId()).orElseThrow(
+ () -> new ResponseStatusException(NOT_FOUND,
+ "Sponsor with login = %s not found".formatted(login)));
+ TalentProof talentProof = talentProofRepository.findById(proofId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Proof with id = %d not found".formatted(proofId)));
+ if (!talentProof.getStatus().equals(ProofStatus.PUBLISHED))
+ throw new ResponseStatusException(FORBIDDEN,
+ "Proof that was kudosed does not have the PUBLISHED status");
+ long obtainedAmount = amountOfKudoses.amount();
+
+ if (sponsor.getAmountKudos() < obtainedAmount) {
+ throw new ResponseStatusException(FORBIDDEN, "The sponsor cannot give more kudos than he has");
+ }
+ Long modula = obtainedAmount % talentProof.getProofSkills().size();
+ if (modula != 0) {
+ obtainedAmount -= modula;
+ }
+ sponsor.setAmountKudos(sponsor.getAmountKudos() - obtainedAmount);
+
+ Long addKudoses = obtainedAmount / talentProof.getProofSkills().size();
+
+ talentProof.getProofSkills().forEach(proofSkill -> {
+ Kudos kudos = Kudos.builder()
+ .sponsor(sponsor)
+ .skill(proofSkill)
+ .amount(addKudoses)
+ .build();
+ proofSkill.getKudos().add(kudosRepository.save(kudos));
+ });
+ }
+
+ public void addKudosToSkill(long proofId, long skillId, SetAmountKudos amountOfKudos,
+ Authentication authentication) {
+ String login = authentication.getName();
+ UserInfo userInfo = userInfoRepository.findByLogin(login)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "User with login = %s not found".formatted(
+ login)));
+ Sponsor sponsor = sponsorRepository.findById(userInfo.getSponsor().getId()).orElseThrow(
+ () -> new ResponseStatusException(NOT_FOUND,
+ "Sponsor with login = %s not found".formatted(login)));
+ TalentProof talentProof = talentProofRepository.findById(proofId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Proof with id = %d not found".formatted(proofId)));
+ if (!talentProof.getStatus().equals(ProofStatus.PUBLISHED))
+ throw new ResponseStatusException(FORBIDDEN,
+ "Skill on proof that was kudosed does not have the PUBLISHED status");
+ long obtainedAmount = amountOfKudos.amount();
+ if (sponsor.getAmountKudos() < obtainedAmount) {
+ throw new ResponseStatusException(FORBIDDEN, "The sponsor cannot give more kudos than he has");
+ }
+ sponsor.setAmountKudos(sponsor.getAmountKudos() - obtainedAmount);
+ ProofSkill proofSkill = talentProof.getProofSkills().stream()
+ .filter(s -> s.getSkill().getId().equals(skillId))
+ .findFirst().orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Skill with id = %d not found".formatted(skillId)));
+ kudosRepository.save(Kudos.builder().amount(obtainedAmount).sponsor(sponsor).skill(proofSkill).build());
+ }
+
+ @Transactional(readOnly = true)
+ public KudosAmount getSkillKudos(long proofId, long skillId) {
+ TalentProof talentProof = talentProofRepository.findById(proofId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Proof with id = %d not found".formatted(proofId)));
+ if (!talentProof.getStatus().equals(ProofStatus.PUBLISHED))
+ throw new ResponseStatusException(FORBIDDEN,
+ "The skill from the proof that was referred to does not have a PUBLISHED status");
+ ProofSkill proofSkill = talentProof.getProofSkills().stream()
+ .filter(s -> s.getSkill().getId().equals(skillId))
+ .findFirst().orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Skill with id = %d not found".formatted(skillId)));
+ List kudos = kudosRepository.findBySkill(proofSkill);
+ long amountOfKudos = kudos.stream().map(Kudos::getAmount).reduce(0L, Long::sum);
+ return new KudosAmount(amountOfKudos);
+ }
+}
diff --git a/src/main/java/com/provedcode/sponsor/controller/SponsorController.java b/src/main/java/com/provedcode/sponsor/controller/SponsorController.java
index 39c5bad..09aa4d0 100644
--- a/src/main/java/com/provedcode/sponsor/controller/SponsorController.java
+++ b/src/main/java/com/provedcode/sponsor/controller/SponsorController.java
@@ -23,13 +23,13 @@
@RestController
@AllArgsConstructor
@Validated
-@RequestMapping("/api/v3")
+@RequestMapping("/api")
public class SponsorController {
SponsorService sponsorService;
SponsorMapper sponsorMapper;
@GetAllSponsorsApiDoc
- @GetMapping("/sponsors")
+ @GetMapping("/v3/sponsors")
Page getSponsors(@RequestParam(value = "page", defaultValue = "0") @PositiveOrZero Integer page,
@RequestParam(value = "size", defaultValue = "5") @Min(1) @Max(1000) Integer size) {
return sponsorService.getAllSponsors(page, size).map(sponsorMapper::toDto);
@@ -37,14 +37,14 @@ Page getSponsors(@RequestParam(value = "page", defaultValue = "0") @
@GetSponsorApiDoc
@PreAuthorize("hasRole('SPONSOR')")
- @GetMapping("/sponsors/{id}")
+ @GetMapping("/v3/sponsors/{id}")
SponsorDTO getSponsor(@PathVariable("id") long id, Authentication authentication) {
return sponsorMapper.toDto(sponsorService.getSponsorById(id, authentication));
}
@PatchEditSponsorApiDoc
@PreAuthorize("hasRole('SPONSOR')")
- @PatchMapping("/sponsors/{id}")
+ @PatchMapping("/v3/sponsors/{id}")
SponsorDTO editSponsor(@PathVariable("id") long id,
@RequestBody EditSponsor editSponsor,
Authentication authentication) {
@@ -53,8 +53,14 @@ SponsorDTO editSponsor(@PathVariable("id") long id,
@DeleteSponsorApiDoc
@PreAuthorize("hasRole('SPONSOR')")
- @DeleteMapping("/sponsors/{id}")
+ @DeleteMapping("/v3/sponsors/{id}")
void deleteSponsor(@PathVariable("id") long id, Authentication authentication) {
sponsorService.deleteSponsor(id, authentication);
}
+
+ @PreAuthorize("hasRole('SPONSOR')")
+ @DeleteMapping("/v5/sponsors/{sponsor-id}")
+ void deactivateSponsor(@PathVariable("sponsor-id") long sponsorId, Authentication authentication) {
+ sponsorService.deactivateSponsor(sponsorId, authentication);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/sponsor/model/entity/Sponsor.java b/src/main/java/com/provedcode/sponsor/model/entity/Sponsor.java
index 662de41..e698366 100644
--- a/src/main/java/com/provedcode/sponsor/model/entity/Sponsor.java
+++ b/src/main/java/com/provedcode/sponsor/model/entity/Sponsor.java
@@ -1,25 +1,37 @@
package com.provedcode.sponsor.model.entity;
-import com.provedcode.kudos.model.entity.Kudos;
-import jakarta.persistence.*;
-import jakarta.validation.constraints.NotEmpty;
-import lombok.*;
-import org.hibernate.validator.constraints.URL;
-
import java.util.ArrayList;
import java.util.List;
+import org.hibernate.validator.constraints.URL;
+
+import com.provedcode.kudos.model.entity.Kudos;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Entity
-@Table(name = "sponsor")
+@Table(name = "sponsors")
public class Sponsor {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, insertable = false, updatable = false)
private Long id;
@Column(name = "amount_kudos")
private Long amountKudos;
diff --git a/src/main/java/com/provedcode/sponsor/service/SponsorService.java b/src/main/java/com/provedcode/sponsor/service/SponsorService.java
index 8beaba7..40bff99 100644
--- a/src/main/java/com/provedcode/sponsor/service/SponsorService.java
+++ b/src/main/java/com/provedcode/sponsor/service/SponsorService.java
@@ -1,13 +1,20 @@
package com.provedcode.sponsor.service;
+import com.provedcode.config.EmailDefaultProps;
import com.provedcode.config.PageProperties;
+import com.provedcode.config.ServerInfoConfig;
import com.provedcode.kudos.model.entity.Kudos;
import com.provedcode.sponsor.model.entity.Sponsor;
import com.provedcode.sponsor.model.request.EditSponsor;
import com.provedcode.sponsor.repository.SponsorRepository;
import com.provedcode.sponsor.utill.ValidateSponsorForCompliance;
+import com.provedcode.user.model.entity.DeletedUser;
import com.provedcode.user.model.entity.UserInfo;
+import com.provedcode.user.repo.DeletedUserRepository;
import com.provedcode.user.repo.UserInfoRepository;
+import com.provedcode.user.service.impl.EmailService;
+import com.provedcode.user.util.UsersSchedulerService;
+import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -16,11 +23,13 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.*;
@Service
@AllArgsConstructor
@@ -30,6 +39,10 @@ public class SponsorService {
SponsorRepository sponsorRepository;
UserInfoRepository userInfoRepository;
ValidateSponsorForCompliance validateSponsorForCompliance;
+ DeletedUserRepository deletedUserRepository;
+ ServerInfoConfig serverInfoConfig;
+ EmailService emailService;
+ EmailDefaultProps emailDefaultProps;
@Transactional(readOnly = true)
public Page getAllSponsors(Integer page, Integer size) {
@@ -76,17 +89,49 @@ public void deleteSponsor(long id, Authentication authentication) {
validateSponsorForCompliance.userVerification(sponsor, user, id);
Sponsor deletableSponsor = sponsor.get();
+ deleteSponsorByUser(user.get(), deletableSponsor);
+ }
+
+ private void deleteSponsorByUser(UserInfo user, @NotNull Sponsor deletableSponsor) {
List kudosList = deletableSponsor.getKudoses().stream().map(i -> {
i.setSponsor(null);
return i;
}).toList();
deletableSponsor.setKudoses(kudosList);
- userInfoRepository.delete(user.get());
+ userInfoRepository.delete(user);
}
private void checkEditSponsorNull(EditSponsor editSponsor) {
if (editSponsor.firstName() == null && editSponsor.lastName() == null && editSponsor.image() == null &&
- editSponsor.countOfKudos() == null)
+ editSponsor.countOfKudos() == null)
throw new ResponseStatusException(FORBIDDEN, "you did not provide information to make changes");
}
+
+ public void deactivateSponsor(long sponsorId, Authentication authentication) {
+ UserInfo user = userInfoRepository.findByLogin(authentication.getName())
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "user with login = %s not found".formatted(authentication.getName())));
+ Sponsor sponsor = sponsorRepository.findById(sponsorId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "sponsor with id = %s not found".formatted(sponsorId)));
+ if (!sponsor.equals(user.getSponsor())) {
+ throw new ResponseStatusException(FORBIDDEN, "you cannot update/delete another sponsor");
+ }
+ user.setIsLocked(true);
+
+ DeletedUser deletedUser = DeletedUser.builder()
+ .deletedUser(user)
+ .timeToDelete(Instant.now().plus(3, ChronoUnit.DAYS))
+ .uuidForActivate(UUID.randomUUID().toString())
+ .build();
+
+ String userActivateAccountLink = serverInfoConfig.getFullServerAddress() +
+ "/api/v5/activate?uuid=" + deletedUser.getUuidForActivate();
+
+ deletedUserRepository.save(deletedUser);
+
+ emailService.sendEmail(user.getLogin(),
+ emailDefaultProps.userDeletedSubject(),
+ emailDefaultProps.userDeleted().formatted(userActivateAccountLink));
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/controller/TalentController.java b/src/main/java/com/provedcode/talent/controller/TalentController.java
index f8496e7..cb81997 100644
--- a/src/main/java/com/provedcode/talent/controller/TalentController.java
+++ b/src/main/java/com/provedcode/talent/controller/TalentController.java
@@ -1,9 +1,10 @@
package com.provedcode.talent.controller;
-import com.provedcode.config.PageProperties;
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.dto.SkillIdDTO;
+import com.provedcode.talent.model.dto.StatisticsDTO;
import com.provedcode.talent.model.request.EditTalent;
import com.provedcode.talent.service.TalentService;
import com.provedcode.user.model.dto.SessionInfoDTO;
@@ -19,18 +20,16 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
-import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import java.util.Optional;
@Slf4j
@RestController
@AllArgsConstructor
-@RequestMapping("/api/v2")
+@RequestMapping("/api/")
@Tag(name = "talent", description = "Talent API")
@Validated
public class TalentController {
@@ -38,7 +37,7 @@ public class TalentController {
TalentMapper talentMapper;
@GetAllTalentsApiDoc
- @GetMapping("/talents")
+ @GetMapping("v2/talents")
@Validated
Page getTalents(@RequestParam(value = "page", defaultValue = "0") @PositiveOrZero Integer page,
@RequestParam(value = "size", defaultValue = "5") @Min(1) @Max(1000) Integer size) {
@@ -46,8 +45,8 @@ Page getTalents(@RequestParam(value = "page", defaultValue = "0"
}
@GetTalentApiDoc
- @PreAuthorize("hasAnyRole('ROLE_TALENT', 'ROLE_SPONSOR')")
- @GetMapping("/talents/{id}")
+ @PreAuthorize("hasAnyRole('TALENT', 'SPONSOR')")
+ @GetMapping("v2/talents/{id}")
FullTalentDTO getTalent(@PathVariable("id") long id, Authentication authentication) {
log.info("get-talent auth = {}", authentication);
log.info("get-talent auth.name = {}", authentication.getAuthorities());
@@ -56,7 +55,7 @@ FullTalentDTO getTalent(@PathVariable("id") long id, Authentication authenticati
@PatchEditTalentApiDoc
@PreAuthorize("hasRole('TALENT')")
- @PatchMapping("/talents/{talent-id}")
+ @PatchMapping("v2/talents/{talent-id}")
FullTalentDTO editTalent(@PathVariable("talent-id") long id,
@RequestBody @Valid EditTalent editTalent,
Authentication authentication) {
@@ -65,8 +64,45 @@ FullTalentDTO editTalent(@PathVariable("talent-id") long id,
@DeleteTalentApiDoc
@PreAuthorize("hasRole('TALENT')")
- @DeleteMapping("/talents/{id}")
+ @DeleteMapping("v2/talents/{id}")
SessionInfoDTO deleteTalent(@PathVariable("id") long id, Authentication authentication) {
return talentService.deleteTalentById(id, authentication);
}
+
+ @PreAuthorize("hasRole('TALENT')")
+ @PostMapping("v4/talents/{talent-id}/skills")
+ void addSkillOnTalent(@PathVariable("talent-id") long id,
+ @RequestBody @Valid SkillIdDTO skillIdDTO,
+ Authentication authentication) {
+ talentService.addSkillOnTalent(id, skillIdDTO, authentication);
+ }
+
+ @PreAuthorize("hasRole('TALENT')")
+ @DeleteMapping("v4/talents/{talent-id}/skills/{skill-id}")
+ void deleteSkillFromTalent(@PathVariable("talent-id") long talentId,
+ @PathVariable("skill-id") long skillId,
+ Authentication authentication) {
+ talentService.deleteSkillFromTalent(talentId, skillId, authentication);
+ }
+
+ @GetMapping("v4/talents")
+ Page getFilteredBySkillsTalents(@RequestParam(value = "page", defaultValue = "0") @PositiveOrZero Integer page,
+ @RequestParam(value = "size", defaultValue = "5") @Min(1) @Max(1000) Integer size,
+ @RequestParam(value = "filter-by", required = false) String... filterBy) {
+ return talentService.getFilteredBySkillsTalentsPage(page, size, filterBy).map(talentMapper::talentToShortTalentDTO);
+ }
+
+ @PreAuthorize("hasRole('TALENT')")
+ @GetMapping("v5/talents/{talent-id}/statistics")
+ StatisticsDTO getStatisticsForTalent(@PathVariable("talent-id") long talentId,
+ Authentication authentication) {
+ return talentService.getStatisticsForTalent(talentId, authentication);
+ }
+
+ @PreAuthorize("hasRole('TALENT')")
+ @DeleteMapping("v5/talents/{talent-id}")
+ void deactivateTalentById(@PathVariable("talent-id") long talentId,
+ Authentication authentication) {
+ talentService.deactivateTalentById(talentId, authentication);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/controller/TalentProofController.java b/src/main/java/com/provedcode/talent/controller/TalentProofController.java
index 25492f0..775edf6 100644
--- a/src/main/java/com/provedcode/talent/controller/TalentProofController.java
+++ b/src/main/java/com/provedcode/talent/controller/TalentProofController.java
@@ -3,7 +3,6 @@
import com.provedcode.talent.mapper.TalentProofMapper;
import com.provedcode.talent.model.dto.FullProofDTO;
import com.provedcode.talent.model.dto.ProofDTO;
-import com.provedcode.talent.model.dto.StatusDTO;
import com.provedcode.talent.model.request.AddProof;
import com.provedcode.talent.service.TalentProofService;
import com.provedcode.util.annotations.doc.controller.proof.*;
@@ -88,9 +87,9 @@ ProofDTO editProof(Authentication authentication,
@DeleteProofApiDoc
@DeleteMapping("/{talent-id}/proofs/{proof-id}")
@PreAuthorize("hasRole('TALENT')")
- StatusDTO deleteProof(@PathVariable(value = "talent-id") long talentId,
+ void deleteProof(@PathVariable(value = "talent-id") long talentId,
@PathVariable(value = "proof-id") long proofId,
Authentication authentication) {
- return talentProofService.deleteProofById(talentId, proofId, authentication);
+ talentProofService.deleteProofById(talentId, proofId, authentication);
}
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/controller/TalentSkillsController.java b/src/main/java/com/provedcode/talent/controller/TalentSkillsController.java
index fbbc97c..7d58afd 100644
--- a/src/main/java/com/provedcode/talent/controller/TalentSkillsController.java
+++ b/src/main/java/com/provedcode/talent/controller/TalentSkillsController.java
@@ -2,7 +2,7 @@
import com.provedcode.talent.model.dto.ProofSkillsDTO;
import com.provedcode.talent.model.dto.SkillsOnProofDTO;
-import com.provedcode.talent.service.TalentSkillsService;
+import com.provedcode.talent.service.ProofSkillsService;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -10,35 +10,40 @@
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.server.ResponseStatusException;
+
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
@Slf4j
@Validated
@AllArgsConstructor
@RestController
-@RequestMapping("/api/v4/")
+@RequestMapping("/api/v5/talents")
public class TalentSkillsController {
- TalentSkillsService talentSkillsService;
+ ProofSkillsService proofSkillsService;
- @PostMapping("talents/{talent-id}/proofs/{proof-id}/skills")
+ @PostMapping("/{talent-id}/proofs/{proof-id}/skills")
void addSkillOnProof(@PathVariable("talent-id") long talentId,
@PathVariable("proof-id") long proofId,
@RequestBody @Valid ProofSkillsDTO skills,
Authentication authentication) {
- talentSkillsService.addSkillsOnProof(talentId, proofId, skills, authentication);
+ proofSkillsService.addSkillsOnProof(talentId, proofId, skills, authentication);
}
- @GetMapping("proofs/{proof-id}/skills")
- SkillsOnProofDTO getAllSkillsOnProof(@PathVariable("proof-id") long proofId,
+ @GetMapping("/{talent-id}/proofs/{proof-id}/skills")
+ SkillsOnProofDTO getAllSkillsOnProof(@PathVariable("talent-id") long talentId,
+ @PathVariable("proof-id") long proofId,
Authentication authentication) {
- return talentSkillsService.getAllSkillsOnProof(proofId, authentication);
+ return proofSkillsService.getAllSkillsOnProof(talentId, proofId, authentication);
}
+
@PreAuthorize("hasRole('TALENT')")
- @DeleteMapping("talents/{talent-id}/proofs/{proof-id}/skills/{skill-id}")
+ @DeleteMapping("/{talent-id}/proofs/{proof-id}/skills/{skill-id}")
void deleteSkillOnProof(@PathVariable("talent-id") long talentId,
@PathVariable("proof-id") long proofId,
@PathVariable("skill-id") long skillId,
Authentication authentication) {
- talentSkillsService.deleteSkillOnProof(talentId, proofId, skillId, authentication);
+ proofSkillsService.deleteSkillOnProof(talentId, proofId, skillId, authentication);
}
}
diff --git a/src/main/java/com/provedcode/talent/mapper/SkillMapper.java b/src/main/java/com/provedcode/talent/mapper/SkillMapper.java
index 74c30b6..c2eabf4 100644
--- a/src/main/java/com/provedcode/talent/mapper/SkillMapper.java
+++ b/src/main/java/com/provedcode/talent/mapper/SkillMapper.java
@@ -1,12 +1,12 @@
package com.provedcode.talent.mapper;
import com.provedcode.talent.model.dto.SkillDTO;
-import com.provedcode.talent.model.entity.Skills;
+import com.provedcode.talent.model.entity.Skill;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
public interface SkillMapper {
- SkillDTO skillToSkillDTO(Skills skills);
+ SkillDTO skillToSkillDTO(Skill skills);
}
diff --git a/src/main/java/com/provedcode/talent/mapper/TalentMapper.java b/src/main/java/com/provedcode/talent/mapper/TalentMapper.java
index 336714e..b8cd37d 100644
--- a/src/main/java/com/provedcode/talent/mapper/TalentMapper.java
+++ b/src/main/java/com/provedcode/talent/mapper/TalentMapper.java
@@ -14,10 +14,8 @@ public interface TalentMapper {
@Mapping(target = "additionalInfo", expression = "java(talent.getTalentDescription() != null ? talent.getTalentDescription().getAdditionalInfo() : null)")
@Mapping(target = "links", expression = "java(talent.getTalentLinks().stream().map(l -> l.getLink()).toList())")
@Mapping(target = "contacts", expression = "java(talent.getTalentContacts().stream().map(c -> c.getContact()).toList())")
-// @Mapping(target = "talents", expression = "java(talent.getTalentTalents().stream().map(t -> t.getTalentName()).toList())")
@Mapping(target = "attachedFiles", expression = "java(talent.getTalentAttachedFiles().stream().map(a -> a.getAttachedFile()).toList())")
FullTalentDTO talentToFullTalentDTO(Talent talent);
-// @Mapping(target = "talents", expression = "java(talent.getTalentTalents().stream().map(t -> t.getTalentName()).toList())")
ShortTalentDTO talentToShortTalentDTO(Talent talent);
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/model/dto/FullTalentDTO.java b/src/main/java/com/provedcode/talent/model/dto/FullTalentDTO.java
index 0c30c03..436ee41 100644
--- a/src/main/java/com/provedcode/talent/model/dto/FullTalentDTO.java
+++ b/src/main/java/com/provedcode/talent/model/dto/FullTalentDTO.java
@@ -7,6 +7,7 @@
import lombok.Builder;
import java.util.List;
+import java.util.Set;
@Builder
public record FullTalentDTO(
@@ -29,7 +30,7 @@ public record FullTalentDTO(
String additionalInfo,
@Size(min = 4, max = 2000)
String bio,
- List talents,
+ Set skills,
@UrlList
List links,
List contacts,
diff --git a/src/main/java/com/provedcode/talent/model/dto/ShortTalentDTO.java b/src/main/java/com/provedcode/talent/model/dto/ShortTalentDTO.java
index d252bcd..14d2f09 100644
--- a/src/main/java/com/provedcode/talent/model/dto/ShortTalentDTO.java
+++ b/src/main/java/com/provedcode/talent/model/dto/ShortTalentDTO.java
@@ -2,7 +2,7 @@
import lombok.Builder;
-import java.util.List;
+import java.util.Set;
@Builder
public record ShortTalentDTO(
@@ -11,6 +11,6 @@ public record ShortTalentDTO(
String firstName,
String lastName,
String specialization,
- List talents
+ Set skills
) {
}
diff --git a/src/main/java/com/provedcode/talent/model/dto/SkillDTO.java b/src/main/java/com/provedcode/talent/model/dto/SkillDTO.java
index f93fe25..e02a54d 100644
--- a/src/main/java/com/provedcode/talent/model/dto/SkillDTO.java
+++ b/src/main/java/com/provedcode/talent/model/dto/SkillDTO.java
@@ -1,5 +1,8 @@
package com.provedcode.talent.model.dto;
+import lombok.Builder;
+
+@Builder
public record SkillDTO(
Long id,
String skill
diff --git a/src/main/java/com/provedcode/talent/model/dto/SkillIdDTO.java b/src/main/java/com/provedcode/talent/model/dto/SkillIdDTO.java
new file mode 100644
index 0000000..c6d4013
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/model/dto/SkillIdDTO.java
@@ -0,0 +1,11 @@
+package com.provedcode.talent.model.dto;
+
+import jakarta.validation.constraints.NotEmpty;
+
+import java.util.List;
+
+public record SkillIdDTO(
+ @NotEmpty
+ List id
+) {
+}
diff --git a/src/main/java/com/provedcode/talent/model/dto/SkillsOnProofDTO.java b/src/main/java/com/provedcode/talent/model/dto/SkillsOnProofDTO.java
index f70ff5e..c916456 100644
--- a/src/main/java/com/provedcode/talent/model/dto/SkillsOnProofDTO.java
+++ b/src/main/java/com/provedcode/talent/model/dto/SkillsOnProofDTO.java
@@ -1,12 +1,11 @@
package com.provedcode.talent.model.dto;
-import com.provedcode.talent.model.entity.Skills;
import lombok.Builder;
import java.util.Set;
@Builder
public record SkillsOnProofDTO(
- Set skills
+ Set skills
) {
}
diff --git a/src/main/java/com/provedcode/talent/model/dto/StatisticsDTO.java b/src/main/java/com/provedcode/talent/model/dto/StatisticsDTO.java
new file mode 100644
index 0000000..1914887
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/model/dto/StatisticsDTO.java
@@ -0,0 +1,13 @@
+package com.provedcode.talent.model.dto;
+
+import lombok.Builder;
+
+import java.util.Map;
+
+@Builder
+public record StatisticsDTO(
+ Long allKudosOnTalent,
+ Map skillWithLargestNumberOfKudos,
+ Map proofWithLargestNumberOfKudos
+) {
+}
diff --git a/src/main/java/com/provedcode/talent/model/entity/ProofSkill.java b/src/main/java/com/provedcode/talent/model/entity/ProofSkill.java
new file mode 100644
index 0000000..3739cbe
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/model/entity/ProofSkill.java
@@ -0,0 +1,61 @@
+package com.provedcode.talent.model.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import org.hibernate.Hibernate;
+
+import com.provedcode.kudos.model.entity.Kudos;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Builder
+@Entity
+@Getter
+@Setter
+@AllArgsConstructor
+@NoArgsConstructor
+@Table(name = "proofs_skills")
+public class ProofSkill {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(nullable = false, insertable = false, updatable = false)
+ private Long id;
+ @ManyToOne
+ @JoinColumn(name = "proof_id")
+ private TalentProof talentProof;
+ @ManyToOne
+ @JoinColumn(name = "skill_id")
+ private Skill skill;
+ @OneToMany(mappedBy = "skill")
+ private List kudos = new ArrayList<>();
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
+ return false;
+ ProofSkill that = (ProofSkill) o;
+ return getId() != null && Objects.equals(getId(), that.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+}
diff --git a/src/main/java/com/provedcode/talent/model/entity/Skill.java b/src/main/java/com/provedcode/talent/model/entity/Skill.java
new file mode 100644
index 0000000..01fe8d3
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/model/entity/Skill.java
@@ -0,0 +1,49 @@
+package com.provedcode.talent.model.entity;
+
+import java.util.LinkedHashSet;
+import java.util.Objects;
+import java.util.Set;
+
+import org.hibernate.Hibernate;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.Table;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+@Entity
+@Table(name = "skills")
+public class Skill {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id", nullable = false)
+ private Long id;
+ @Column(name = "skill", length = 30)
+ private String skill;
+ @ManyToMany(mappedBy = "skills")
+ private Set talents = new LinkedHashSet<>();
+ @ManyToMany(mappedBy = "skill")
+ private Set proofSkills = new LinkedHashSet<>();
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o))
+ return false;
+ Skill skills = (Skill) o;
+ return getId() != null && Objects.equals(getId(), skills.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/model/entity/Talent.java b/src/main/java/com/provedcode/talent/model/entity/Talent.java
index 46ca5db..bed3a74 100644
--- a/src/main/java/com/provedcode/talent/model/entity/Talent.java
+++ b/src/main/java/com/provedcode/talent/model/entity/Talent.java
@@ -1,13 +1,31 @@
package com.provedcode.talent.model.entity;
-import jakarta.persistence.*;
-import jakarta.validation.constraints.NotEmpty;
-import lombok.*;
-import lombok.experimental.Accessors;
-import org.hibernate.validator.constraints.URL;
-
import java.util.ArrayList;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
+
+import org.hibernate.validator.constraints.URL;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
@Builder
@Accessors(chain = true)
@@ -16,7 +34,7 @@
@Getter
@Setter
@Entity
-@Table(name = "talent")
+@Table(name = "talents")
public class Talent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -41,12 +59,13 @@ public class Talent {
private TalentDescription talentDescription;
@OneToMany(mappedBy = "talent", cascade = CascadeType.ALL, orphanRemoval = true)
private List talentLinks = new ArrayList<>();
-// @OneToMany(mappedBy = "talent", cascade = CascadeType.ALL, orphanRemoval = true)
-// private List talentTalents = new ArrayList<>();
@OneToMany(mappedBy = "talent", cascade = CascadeType.ALL, orphanRemoval = true)
private List talentContacts = new ArrayList<>();
@OneToMany(mappedBy = "talent", cascade = CascadeType.ALL, orphanRemoval = true)
private List talentAttachedFiles = new ArrayList<>();
@OneToMany(mappedBy = "talent", cascade = CascadeType.ALL, orphanRemoval = true)
private List talentProofs = new ArrayList<>();
+ @ManyToMany
+ @JoinTable(name = "talents_skills", joinColumns = @JoinColumn(name = "talent_id"), inverseJoinColumns = @JoinColumn(name = "skill_id"))
+ private Set skills = new LinkedHashSet<>();
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/model/entity/TalentAttachedFile.java b/src/main/java/com/provedcode/talent/model/entity/TalentAttachedFile.java
index b35fdb5..3b0d1d5 100644
--- a/src/main/java/com/provedcode/talent/model/entity/TalentAttachedFile.java
+++ b/src/main/java/com/provedcode/talent/model/entity/TalentAttachedFile.java
@@ -1,20 +1,32 @@
package com.provedcode.talent.model.entity;
-import jakarta.persistence.*;
-import jakarta.validation.constraints.NotNull;
-import lombok.*;
import org.hibernate.validator.constraints.URL;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Getter
@Setter
@Entity
-@Table(name = "talent_attached_file")
+@Table(name = "attached_files")
public class TalentAttachedFile {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, insertable = false, updatable = false)
private Long id;
@NotNull
@ManyToOne
diff --git a/src/main/java/com/provedcode/talent/model/entity/TalentContact.java b/src/main/java/com/provedcode/talent/model/entity/TalentContact.java
index 48a390b..d052694 100644
--- a/src/main/java/com/provedcode/talent/model/entity/TalentContact.java
+++ b/src/main/java/com/provedcode/talent/model/entity/TalentContact.java
@@ -1,8 +1,19 @@
package com.provedcode.talent.model.entity;
-import jakarta.persistence.*;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@NoArgsConstructor
@AllArgsConstructor
@@ -10,11 +21,11 @@
@Getter
@Setter
@Entity
-@Table(name = "talent_contact")
+@Table(name = "contacts")
public class TalentContact {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, insertable = false, updatable = false)
private Long id;
@NotNull
@ManyToOne
diff --git a/src/main/java/com/provedcode/talent/model/entity/TalentDescription.java b/src/main/java/com/provedcode/talent/model/entity/TalentDescription.java
index 21629d3..a1d9eb9 100644
--- a/src/main/java/com/provedcode/talent/model/entity/TalentDescription.java
+++ b/src/main/java/com/provedcode/talent/model/entity/TalentDescription.java
@@ -1,8 +1,19 @@
package com.provedcode.talent.model.entity;
-import jakarta.persistence.*;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import lombok.experimental.Accessors;
@Builder
@@ -12,17 +23,17 @@
@Getter
@Setter
@Entity
-@Table(name = "talent_description")
+@Table(name = "descriptions")
public class TalentDescription {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(nullable = false)
+ @Column(nullable = false, insertable = false, updatable = false)
private Long id;
@NotNull
@OneToOne(orphanRemoval = true)
@JoinColumn(name = "talent_id", updatable = false)
private Talent talent;
- @Column(name = "BIO")
+ @Column(name = "bio")
private String bio;
@Column(name = "addition_info")
private String additionalInfo;
diff --git a/src/main/java/com/provedcode/talent/model/entity/TalentLink.java b/src/main/java/com/provedcode/talent/model/entity/TalentLink.java
index bcb4fac..6a343c1 100644
--- a/src/main/java/com/provedcode/talent/model/entity/TalentLink.java
+++ b/src/main/java/com/provedcode/talent/model/entity/TalentLink.java
@@ -1,20 +1,33 @@
package com.provedcode.talent.model.entity;
-import jakarta.persistence.*;
-import jakarta.validation.constraints.NotNull;
-import lombok.*;
import org.hibernate.validator.constraints.URL;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Getter
@Setter
@Entity
-@Table(name = "talent_link")
+@Table(name = "links")
public class TalentLink {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(nullable = false)
+ @Column(nullable = false, insertable = false, updatable = false)
private Long id;
@NotNull
@ManyToOne
diff --git a/src/main/java/com/provedcode/talent/model/entity/TalentProof.java b/src/main/java/com/provedcode/talent/model/entity/TalentProof.java
index 549dbea..68aead0 100644
--- a/src/main/java/com/provedcode/talent/model/entity/TalentProof.java
+++ b/src/main/java/com/provedcode/talent/model/entity/TalentProof.java
@@ -1,18 +1,38 @@
package com.provedcode.talent.model.entity;
+import java.time.LocalDateTime;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hibernate.validator.constraints.URL;
+
import com.provedcode.kudos.model.entity.Kudos;
import com.provedcode.talent.model.ProofStatus;
-import jakarta.persistence.*;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.Table;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import lombok.experimental.Accessors;
-import org.hibernate.validator.constraints.URL;
-
-import java.time.LocalDateTime;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
@Accessors(chain = true)
@NoArgsConstructor
@@ -21,11 +41,11 @@
@Getter
@Setter
@Entity
-@Table(name = "talent_proofs")
+@Table(name = "proofs")
public class TalentProof {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, insertable = false, updatable = false)
private Long id;
@NotNull
@ManyToOne
@@ -41,11 +61,6 @@ public class TalentProof {
@Column(length = 20)
private ProofStatus status;
private LocalDateTime created;
- @OneToMany(fetch = FetchType.EAGER, mappedBy = "proof", cascade = CascadeType.ALL, orphanRemoval = true)
- private List kudos;
- @ManyToMany
- @JoinTable(name = "talent_skill",
- joinColumns = @JoinColumn(name = "proof_id"),
- inverseJoinColumns = @JoinColumn(name = "skill_id"))
- private Set skills = new LinkedHashSet<>();
+ @OneToMany(mappedBy = "talentProof", cascade = CascadeType.ALL, orphanRemoval = true)
+ private Set proofSkills = new LinkedHashSet<>();
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/repo/ProofSkillRepository.java b/src/main/java/com/provedcode/talent/repo/ProofSkillRepository.java
new file mode 100644
index 0000000..20b4536
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/repo/ProofSkillRepository.java
@@ -0,0 +1,7 @@
+package com.provedcode.talent.repo;
+
+import com.provedcode.talent.model.entity.ProofSkill;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface ProofSkillRepository extends JpaRepository {
+}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/repo/SkillsRepository.java b/src/main/java/com/provedcode/talent/repo/SkillsRepository.java
index 384d489..a879f10 100644
--- a/src/main/java/com/provedcode/talent/repo/SkillsRepository.java
+++ b/src/main/java/com/provedcode/talent/repo/SkillsRepository.java
@@ -1,12 +1,12 @@
package com.provedcode.talent.repo;
-import com.provedcode.talent.model.entity.Skills;
+import com.provedcode.talent.model.entity.Skill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
-public interface SkillsRepository extends JpaRepository {
- @Query("select s from Skills s where upper(s.skill) like upper(concat('%', ?1, '%'))")
- List findBySkillContainsIgnoreCase(String skill);
+public interface SkillsRepository extends JpaRepository {
+ @Query("select s from Skill s where upper(s.skill) like upper(concat('%', ?1, '%'))")
+ List findBySkillContainsIgnoreCase(String skill);
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/repo/TalentRepository.java b/src/main/java/com/provedcode/talent/repo/TalentRepository.java
index b2bac22..e253032 100644
--- a/src/main/java/com/provedcode/talent/repo/TalentRepository.java
+++ b/src/main/java/com/provedcode/talent/repo/TalentRepository.java
@@ -1,7 +1,23 @@
package com.provedcode.talent.repo;
import com.provedcode.talent.model.entity.Talent;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
public interface TalentRepository extends JpaRepository {
+// @Query("select t from Talent t left join t.skills skills where upper(skills.skill) like upper(concat('%', ?2, '%'))")
+// Page findBySkills_SkillContainsIgnoreCase(Pageable pageable, String... skill);
+// @Query("SELECT t FROM Talent t LEFT JOIN t.skills skills WHERE UPPER(skills.skill) LIKE UPPER(CONCAT('%', :skills, '%'))") // if by-symbol contains
+// Page findBySkills_SkillContainsIgnoreCase(Pageable pageable, @Param("skills") String... skills);
+ @Query("SELECT t FROM Talent t INNER JOIN t.skills s WHERE UPPER(s.skill) IN (:filter_by)") //if only contains all
+ Page findBySkills_SkillsInIgnoreCase(Pageable pageable, @Param("filter_by") List skills);
+// @Query("select t from Talent t inner join t.skills skills where upper(skills.skill) like upper(?1)")
+// Page findBySkillsLikeIgnoreCase(String skill, Pageable pageable);
+
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/service/ProofSkillsService.java b/src/main/java/com/provedcode/talent/service/ProofSkillsService.java
new file mode 100644
index 0000000..9640715
--- /dev/null
+++ b/src/main/java/com/provedcode/talent/service/ProofSkillsService.java
@@ -0,0 +1,174 @@
+package com.provedcode.talent.service;
+
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
+import static org.springframework.http.HttpStatus.CONFLICT;
+import static org.springframework.http.HttpStatus.FORBIDDEN;
+import static org.springframework.http.HttpStatus.NOT_FOUND;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.function.BiConsumer;
+import java.util.stream.Collectors;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.server.ResponseStatusException;
+
+import com.provedcode.talent.mapper.SkillMapper;
+import com.provedcode.talent.model.ProofStatus;
+import com.provedcode.talent.model.dto.ProofSkillsDTO;
+import com.provedcode.talent.model.dto.SkillDTO;
+import com.provedcode.talent.model.dto.SkillsOnProofDTO;
+import com.provedcode.talent.model.entity.ProofSkill;
+import com.provedcode.talent.model.entity.Talent;
+import com.provedcode.talent.model.entity.TalentProof;
+import com.provedcode.talent.repo.ProofSkillRepository;
+import com.provedcode.talent.repo.SkillsRepository;
+import com.provedcode.talent.repo.TalentProofRepository;
+import com.provedcode.talent.repo.TalentRepository;
+import com.provedcode.user.model.entity.UserInfo;
+import com.provedcode.user.repo.UserInfoRepository;
+
+import lombok.AllArgsConstructor;
+
+@Transactional
+@Service
+@AllArgsConstructor
+public class ProofSkillsService {
+ SkillsRepository skillsRepository;
+ TalentRepository talentRepository;
+ UserInfoRepository userInfoRepository;
+ TalentProofRepository talentProofRepository;
+ ProofSkillRepository proofSkillRepository;
+ SkillMapper skillMapper;
+
+ final BiConsumer isValidTalentEditProof = (talent, talentProof) -> {
+ if (!talent.getId().equals(talentProof.getTalent().getId())) {
+ throw new ResponseStatusException(BAD_REQUEST,
+ "talentId with id = %s and proofId with id = %s do not match"
+ .formatted(talent.getId(), talentProof.getId()));
+ }
+ };
+
+ final BiConsumer isValidUserEditTalent = (talentId, userInfo) -> {
+ if (!userInfo.getTalent().getId().equals(talentId)) {
+ throw new ResponseStatusException(CONFLICT, "you can`t change another talent");
+ }
+ };
+
+
+ public void addSkillsOnProof(long talentId, long proofId, ProofSkillsDTO skills, Authentication authentication) {
+ if (!talentRepository.existsById(talentId)) {
+ throw new ResponseStatusException(NOT_FOUND, "talent with id = %s not found".formatted(talentId));
+ }
+ UserInfo user = userInfoRepository.findByLogin(authentication.getName())
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "user with id = %s not found"));
+ TalentProof proof = talentProofRepository.findById(proofId).
+ orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "proof with id = %s not found".formatted(proofId)));
+ if (!proof.getStatus().equals(ProofStatus.DRAFT)) {
+ throw new ResponseStatusException(CONFLICT, "proof status must be DRAFT");
+ }
+ isValidUserEditTalent.accept(talentId, user);
+
+ // Set of new skills
+ Set addedSkillsId = new TreeSet<>(skills.skills());
+ addedSkillsId.forEach(skillId -> {
+ if (!skillsRepository.existsById(skillId))
+ throw new ResponseStatusException(NOT_FOUND, "no such skill with id = " + skillId);
+ });
+
+ // check if skill already on proof
+ proof.getProofSkills().forEach(proofSkill -> {
+ if (addedSkillsId.contains(proofSkill.getSkill().getId())) {
+ throw new ResponseStatusException(CONFLICT,
+ "skill with id = %s already on skill".formatted(proofSkill.getSkill().getId()));
+ }
+ });
+
+ Set addedSkills = new HashSet<>(skillsRepository.findAllById(addedSkillsId)).stream()
+ .map(skill -> ProofSkill.builder().talentProof(proof).skill(skill).build())
+ .collect(Collectors.toSet()); // skills to add on proof
+
+ proof.getProofSkills().addAll(addedSkills);
+ }
+
+ @Transactional(readOnly = true)
+ public SkillsOnProofDTO getAllSkillsOnProof(long talentId, long proofId, Authentication authentication) {
+ TalentProof talentProof = talentProofRepository.findById(proofId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "proof with id = %s not found".formatted(proofId)));
+ Talent talent = talentRepository.findById(talentId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "talent with id = %s not found".formatted(talentId)));
+ if (!talent.getId().equals(talentProof.getTalent().getId())) {
+ throw new ResponseStatusException(BAD_REQUEST,
+ "talentId with id = %s and proofId with id = %s do not match".formatted(talentId, proofId));
+ }
+ Set skills = talentProof.getProofSkills().stream()
+ .map(ProofSkill::getSkill)
+ .map(skillMapper::skillToSkillDTO).collect(Collectors.toSet());
+
+ if (talentProof.getStatus().equals(ProofStatus.PUBLISHED)) {
+ return SkillsOnProofDTO.builder().skills(skills).build();
+ } else if (authentication != null) {
+ UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
+ if (userInfo.getTalent().getId().equals(talentProof.getTalent().getId())) {
+ return SkillsOnProofDTO.builder().skills(skills).build();
+ } else {
+ throw new ResponseStatusException(FORBIDDEN, "you can't see proofs in DRAFT and HIDDEN status");
+ }
+ } else {
+ throw new ResponseStatusException(FORBIDDEN, "you can't see proofs in DRAFT and HIDDEN status");
+ }
+
+ }
+
+ public void deleteSkillOnProof(long talentId, long proofId, long skillId, Authentication authentication) {
+ UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
+ isValidUserEditTalent.accept(talentId, userInfo);
+
+ Talent talent = talentRepository.findById(talentId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "talent with id = %s not found".formatted(talentId)));
+
+ TalentProof talentProof = talentProofRepository.findById(proofId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "proof with id = %s not found".formatted(proofId)));
+ if (!talentProof.getStatus().equals(ProofStatus.DRAFT)) {
+ throw new ResponseStatusException(CONFLICT, "proof status must be DRAFT");
+ }
+ isValidTalentEditProof.accept(talent, talentProof);
+
+ talentProof.getProofSkills().removeIf(i -> i.getSkill().getId().equals(skillId));
+ }
+
+
+// public void deleteSkillOnProof(long talentId, long proofId, long skillId, Authentication authentication) {
+// Talent talent = talentRepository.findById(talentId)
+// .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+// "talent with id = %s not found".formatted(talentId)));
+// UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
+// .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
+// TalentProof talentProof = talentProofRepository.findById(proofId)
+// .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "proof with id = %s not found".formatted(proofId)));
+// if (!talentProof.getStatus().equals(ProofStatus.DRAFT)) {
+// throw new ResponseStatusException(CONFLICT, "proof status must be DRAFT");
+// }
+// if (!talent.getId().equals(talentProof.getTalent().getId())) {
+// throw new ResponseStatusException(BAD_REQUEST,
+// "talentId with id = %s and proofId with id = %s do not match".formatted(talentId, proofId));
+// }
+// isValidUserEditTalent.accept(talentId, userInfo);
+// Skills skills = skillsRepository.findById(skillId)
+// .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+// "skill with id = %s not found".formatted(skillId)));
+// if (!talentProof.getSkills().contains(skills)) {
+// throw new ResponseStatusException(NOT_FOUND,
+// "you dont have skill with id = %s on proof with id = %s".formatted(skillId, proofId));
+// }
+// talentProof.getSkills().remove(skills);
+// }
+}
diff --git a/src/main/java/com/provedcode/talent/service/TalentProofService.java b/src/main/java/com/provedcode/talent/service/TalentProofService.java
index 9c92069..e69bbfe 100644
--- a/src/main/java/com/provedcode/talent/service/TalentProofService.java
+++ b/src/main/java/com/provedcode/talent/service/TalentProofService.java
@@ -5,6 +5,7 @@
import com.provedcode.talent.model.dto.FullProofDTO;
import com.provedcode.talent.model.dto.ProofDTO;
import com.provedcode.talent.model.dto.StatusDTO;
+import com.provedcode.talent.model.entity.Skill;
import com.provedcode.talent.model.entity.Talent;
import com.provedcode.talent.model.entity.TalentProof;
import com.provedcode.talent.model.request.AddProof;
@@ -30,8 +31,8 @@
import java.net.URI;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
+import java.util.stream.Collectors;
import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND;
@@ -159,14 +160,28 @@ public TalentProof editTalentProof(long talentId, long proofId, ProofDTO proof,
return talentProofRepository.save(oldProof);
}
- public StatusDTO deleteProofById(long talentId, long proofId, Authentication authentication) {
+ public void deleteProofById(long talentId, long proofId, Authentication authentication) {
Optional talent = talentRepository.findById(talentId);
Optional talentProof = talentProofRepository.findById(proofId);
Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
validateTalentForCompliance.userAndProofVerification(talent, talentProof, userInfo, talentId, proofId);
- talent.get().getTalentProofs().remove(talentProof.get());
- return new StatusDTO("deleted");
+ Talent updatableTalent = talent.get();
+
+ List allTalentSkills = updatableTalent.getTalentProofs().stream()
+ .flatMap(proof -> proof.getProofSkills()
+ .stream().map(skill -> skill.getSkill())).collect(Collectors.toList());
+
+ log.info("talent-skills = {}", allTalentSkills.stream().map(i -> i.getSkill()).toList());
+
+ List skillsOnProofForDelete = talentProof.get().getProofSkills()
+ .stream().map(skill -> skill.getSkill()).toList();
+
+ allTalentSkills.removeAll(skillsOnProofForDelete);
+ Set newTalentSkills = new HashSet<>(allTalentSkills);
+ updatableTalent.setSkills(newTalentSkills);
+ log.info("new talent-skills = {}", newTalentSkills.stream().map(Skill::getSkill).toList());
+ updatableTalent.getTalentProofs().remove(talentProof.get());
}
}
\ 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 fb35aa9..e0e8e54 100644
--- a/src/main/java/com/provedcode/talent/service/TalentService.java
+++ b/src/main/java/com/provedcode/talent/service/TalentService.java
@@ -1,15 +1,29 @@
package com.provedcode.talent.service;
+import com.provedcode.config.EmailDefaultProps;
import com.provedcode.config.PageProperties;
+import com.provedcode.config.ServerInfoConfig;
+import com.provedcode.kudos.model.entity.Kudos;
+import com.provedcode.talent.mapper.TalentProofMapper;
+import com.provedcode.talent.model.dto.ProofDTO;
+import com.provedcode.talent.model.dto.SkillIdDTO;
+import com.provedcode.talent.model.dto.StatisticsDTO;
import com.provedcode.talent.model.entity.*;
import com.provedcode.talent.model.request.EditTalent;
+import com.provedcode.talent.repo.SkillsRepository;
import com.provedcode.talent.repo.TalentProofRepository;
import com.provedcode.talent.repo.TalentRepository;
import com.provedcode.talent.utill.ValidateTalentForCompliance;
import com.provedcode.user.model.dto.SessionInfoDTO;
+import com.provedcode.user.model.entity.DeletedUser;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.AuthorityRepository;
+import com.provedcode.user.repo.DeletedUserRepository;
import com.provedcode.user.repo.UserInfoRepository;
+import com.provedcode.user.service.impl.EmailService;
+import jakarta.validation.constraints.Max;
+import jakarta.validation.constraints.Min;
+import jakarta.validation.constraints.PositiveOrZero;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
@@ -19,11 +33,12 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
-import java.util.List;
-import java.util.Optional;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
+import java.util.stream.Collectors;
-import static org.springframework.http.HttpStatus.BAD_REQUEST;
-import static org.springframework.http.HttpStatus.NOT_FOUND;
+import static org.springframework.http.HttpStatus.*;
@Service
@Slf4j
@@ -36,6 +51,12 @@ public class TalentService {
UserInfoRepository userInfoRepository;
PageProperties pageProperties;
ValidateTalentForCompliance validateTalentForCompliance;
+ SkillsRepository skillsRepository;
+ TalentProofMapper talentProofMapper;
+ DeletedUserRepository deletedUserRepository;
+ ServerInfoConfig serverInfoConfig;
+ EmailService emailService;
+ EmailDefaultProps emailDefaultProps;
@Transactional(readOnly = true)
public Page getTalentsPage(Integer page, Integer size) {
@@ -81,10 +102,10 @@ public Talent editTalent(long id, EditTalent editTalent, Authentication authenti
editableTalentDescription.setBio(editTalent.bio());
} else {
editableTalentDescription = TalentDescription.builder()
- .additionalInfo(editTalent.additionalInfo())
- .bio(editTalent.bio())
- .talent(editableTalent)
- .build();
+ .additionalInfo(editTalent.additionalInfo())
+ .bio(editTalent.bio())
+ .talent(editableTalent)
+ .build();
}
editableTalent.setTalentDescription(editableTalentDescription);
}
@@ -99,27 +120,27 @@ public Talent editTalent(long id, EditTalent editTalent, Authentication authenti
if (editTalent.links() != null) {
editableTalentLinks.clear();
editableTalentLinks.addAll(editTalent.links().stream().map(s -> TalentLink.builder()
- .talent(editableTalent)
- .link(s)
- .build()).toList());
+ .talent(editableTalent)
+ .link(s)
+ .build()).toList());
editableTalent.setTalentLinks(editableTalentLinks);
}
if (editTalent.contacts() != null) {
editableTalentContacts.clear();
editableTalentContacts.addAll(editTalent.contacts().stream().map(s -> TalentContact.builder()
- .talent(editableTalent)
- .contact(s)
- .build()).toList());
+ .talent(editableTalent)
+ .contact(s)
+ .build()).toList());
editableTalent.setTalentContacts(editableTalentContacts);
}
if (editTalent.attachedFiles() != null) {
editableTalentAttachedFiles.clear();
editableTalentAttachedFiles.addAll(editTalent.attachedFiles().stream().map(s -> TalentAttachedFile.builder()
- .talent(editableTalent)
- .attachedFile(
- s)
- .build())
- .toList());
+ .talent(editableTalent)
+ .attachedFile(
+ s)
+ .build())
+ .toList());
editableTalent.setTalentAttachedFiles(editableTalentAttachedFiles);
}
return talentRepository.save(editableTalent);
@@ -132,19 +153,163 @@ public SessionInfoDTO deleteTalentById(long id, Authentication authentication) {
validateTalentForCompliance.userVerification(talent, userInfo, id);
UserInfo user = userInfo.get();
- Talent entity = talent.get();
-
- user.getAuthorities().clear();
userInfoRepository.delete(user);
- talentRepository.delete(entity);
return new SessionInfoDTO("deleted", "null");
}
+ public void deactivateTalentById(long id, Authentication authentication) {
+ Optional talent = talentRepository.findById(id);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+
+ validateTalentForCompliance.userVerification(talent, userInfo, id);
+
+ UserInfo user = userInfo.get();
+ user.setIsLocked(true);
+ DeletedUser deletedUser = DeletedUser.builder()
+ .deletedUser(user)
+ .timeToDelete(Instant.now().plus(3, ChronoUnit.DAYS))
+ .uuidForActivate(UUID.randomUUID().toString())
+ .build();
+ deletedUserRepository.save(deletedUser);
+ userInfoRepository.save(user);
+
+ String userActivateAccountLink = serverInfoConfig.getFullServerAddress() + "/api/v5/activate?uuid=" + deletedUser.getUuidForActivate();
+
+ emailService.sendEmail(user.getLogin(),
+ emailDefaultProps.userDeletedSubject(),
+ emailDefaultProps.userDeleted().formatted(userActivateAccountLink));
+ }
+
private void checkEditTalentNull(EditTalent editTalent) {
if (editTalent.firstName() == null && editTalent.lastName() == null && editTalent.image() == null &&
- editTalent.specialization() == null && editTalent.additionalInfo() == null && editTalent.bio() == null &&
- editTalent.links() == null && editTalent.contacts() == null && editTalent.attachedFiles() == null)
+ editTalent.specialization() == null && editTalent.additionalInfo() == null && editTalent.bio() == null &&
+ editTalent.links() == null && editTalent.contacts() == null && editTalent.attachedFiles() == null)
throw new ResponseStatusException(BAD_REQUEST, "you did not provide information to make changes");
}
+
+ public void addSkillOnTalent(long id, SkillIdDTO skillIdDTO, Authentication authentication) {
+ Optional talent = talentRepository.findById(id);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+ validateTalentForCompliance.userVerification(talent, userInfo, id);
+ Talent talentObject = talent.get();
+
+ Set skillsFromRepo = skillIdDTO.id().stream()
+ .map(element -> skillsRepository.findById(element)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Skill with id = %d not found".formatted(element))))
+ .collect(Collectors.toSet());
+
+ Set skillsFromProofs = talentObject.getTalentProofs().stream()
+ .flatMap(talentProof -> talentProof.getProofSkills()
+ .stream().map(skill -> skill.getSkill())).collect(Collectors.toSet());
+
+ for (Skill skill : talentObject.getSkills()) {
+ for (Skill skillForAdd : skillsFromRepo) {
+ if (skill.equals(skillForAdd)) {
+ throw new ResponseStatusException(CONFLICT,
+ "Skill with id = %d found in talent's skills".formatted(skill.getId()));
+ }
+ }
+ }
+ skillsFromRepo.stream()
+ .filter(skill -> !skillsFromProofs.contains(skill))
+ .findFirst()
+ .ifPresent(skill -> {
+ throw new ResponseStatusException(FORBIDDEN,
+ "Skill with id = %d not found in talent's proofs".formatted(skill.getId()));
+ });
+
+ skillsFromRepo.stream()
+ .forEach(skill -> talentObject.getSkills().add(skill));
+ }
+
+ public void deleteSkillFromTalent(long talentId, long skillId, Authentication authentication) {
+ Optional talent = talentRepository.findById(talentId);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+ Skill skill = skillsRepository.findById(skillId)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
+ "Skill with id = %d not found".formatted(skillId)));
+ validateTalentForCompliance.userVerification(talent, userInfo, talentId);
+ Talent talentObject = talent.get();
+ if (!talentObject.getSkills().remove(skill)) {
+ throw new ResponseStatusException(NOT_FOUND,
+ "Skill with id = %d not found".formatted(skillId));
+ }
+ }
+
+ @Transactional(readOnly = true)
+ public Page getFilteredBySkillsTalentsPage(@PositiveOrZero Integer page,
+ @Min(1) @Max(1000) Integer size,
+ String... filterBy) {
+ return filterBy != null ?
+ talentRepository.findBySkills_SkillsInIgnoreCase(PageRequest.of(page, size), Arrays.stream(filterBy).map(String::toUpperCase).toList())
+ : talentRepository.findAll(PageRequest.of(page, size));
+ }
+
+ public StatisticsDTO getStatisticsForTalent(long talentId, Authentication authentication) {
+ Optional talent = talentRepository.findById(talentId);
+ Optional userInfo = userInfoRepository.findByLogin(authentication.getName());
+ validateTalentForCompliance.userVerification(talent, userInfo, talentId);
+ Talent talentObject = talent.get();
+ return StatisticsDTO.builder()
+ .allKudosOnTalent(getAllKudosOnTalent(talentObject))
+ .skillWithLargestNumberOfKudos(getSkillWithLargestNumberOfKudos(talentObject))
+ .proofWithLargestNumberOfKudos(getProofWithLargestNumberOfKudos(talentObject))
+ .build();
+ }
+
+ public Long getAllKudosOnTalent(Talent talent) {
+ return talent.getTalentProofs()
+ .stream()
+ .flatMap(x -> x.getProofSkills().stream())
+ .flatMap(y -> y.getKudos().stream())
+ .mapToLong(q -> q.getAmount())
+ .sum();
+ }
+
+ public Map getSkillWithLargestNumberOfKudos(Talent talent) {
+ Map numberKudosOnSkill = new HashMap<>();
+ for (TalentProof talentProof : talent.getTalentProofs()) {
+ for (ProofSkill proofSkill : talentProof.getProofSkills()) {
+ for (Kudos kudos : proofSkill.getKudos()) {
+ if (numberKudosOnSkill.containsKey(proofSkill.getSkill().getSkill())) {
+ Long amountKudosOnSkill = numberKudosOnSkill.get(proofSkill.getSkill().getSkill());
+ numberKudosOnSkill.remove(proofSkill.getSkill().getSkill());
+ numberKudosOnSkill.put(proofSkill.getSkill().getSkill(), amountKudosOnSkill + kudos.getAmount());
+ } else {
+ numberKudosOnSkill.put(proofSkill.getSkill().getSkill(), kudos.getAmount());
+ }
+ }
+ }
+ }
+ Long max = Collections.max(numberKudosOnSkill.values());
+ Map result = new HashMap<>();
+ for (Map.Entry entry : numberKudosOnSkill.entrySet()) {
+ if (entry.getValue().equals(max)) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ return result;
+ }
+
+ public Map getProofWithLargestNumberOfKudos(Talent talent) {
+ Map result = new HashMap<>();
+ Long maxForResult = 0L;
+ for (TalentProof talentProof : talent.getTalentProofs()) {
+ Long amountKudosOnSkills = 0L;
+ for (ProofSkill proofSkill : talentProof.getProofSkills()) {
+ for (Kudos kudos : proofSkill.getKudos()) {
+ amountKudosOnSkills += kudos.getAmount();
+ }
+ }
+ if (amountKudosOnSkills > maxForResult) {
+ maxForResult = amountKudosOnSkills;
+ result.clear();
+ result.put(talentProofMapper.toProofDTO(talentProof), amountKudosOnSkills);
+ }
+ }
+ return result;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/talent/service/TalentSkillsService.java b/src/main/java/com/provedcode/talent/service/TalentSkillsService.java
deleted file mode 100644
index 3926eb6..0000000
--- a/src/main/java/com/provedcode/talent/service/TalentSkillsService.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.provedcode.talent.service;
-
-import com.provedcode.talent.model.ProofStatus;
-import com.provedcode.talent.model.dto.ProofSkillsDTO;
-import com.provedcode.talent.model.dto.SkillsOnProofDTO;
-import com.provedcode.talent.model.entity.Skills;
-import com.provedcode.talent.model.entity.Talent;
-import com.provedcode.talent.model.entity.TalentProof;
-import com.provedcode.talent.repo.SkillsRepository;
-import com.provedcode.talent.repo.TalentProofRepository;
-import com.provedcode.talent.repo.TalentRepository;
-import com.provedcode.user.model.entity.UserInfo;
-import com.provedcode.user.repo.UserInfoRepository;
-import lombok.AllArgsConstructor;
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.server.ResponseStatusException;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.function.BiConsumer;
-
-import static org.springframework.http.HttpStatus.*;
-
-@Transactional
-@Service
-@AllArgsConstructor
-public class TalentSkillsService {
- SkillsRepository skillsRepository;
- TalentRepository talentRepository;
- UserInfoRepository userInfoRepository;
- TalentProofRepository talentProofRepository;
-
- static BiConsumer isValidUserEditTalent = (talentId, userInfo) -> {
- if (!userInfo.getTalent().getId().equals(talentId)) {
- throw new ResponseStatusException(CONFLICT, "you can`t change another talent");
- }
- };
-
- public void addSkillsOnProof(long talentId, long proofId, ProofSkillsDTO skills, Authentication authentication) {
- if (!talentRepository.existsById(talentId)) {
- throw new ResponseStatusException(NOT_FOUND, "talent with id = %s not found".formatted(talentId));
- }
- UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
- TalentProof talentProof = talentProofRepository.findById(proofId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "proof with id = %s not found".formatted(proofId)));
- if (!talentProof.getStatus().equals(ProofStatus.DRAFT)) {
- throw new ResponseStatusException(CONFLICT, "proof status must be DRAFT");
- }
-
- isValidUserEditTalent.accept(talentId, userInfo);
- skills.skills().forEach(skillId -> {
- if (!skillsRepository.existsById(skillId))
- throw new ResponseStatusException(NOT_FOUND, "no such skill with id = " + skillId);
- });
-
- Set skillsSet = new HashSet<>(skillsRepository.findAllById(skills.skills()));
- talentProof.getSkills().forEach(skill -> {
- if (skillsSet.contains(skill))
- throw new ResponseStatusException(CONFLICT,
- "skill with id = %s already on skill".formatted(skill.getId()));
- });
-
- talentProof.getSkills().addAll(skillsSet);
- talentProofRepository.save(talentProof);
- }
-
- @Transactional(readOnly = true)
- public SkillsOnProofDTO getAllSkillsOnProof(long proofId, Authentication authentication) {
- TalentProof talentProof = talentProofRepository.findById(proofId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "proof with id = %s not found".formatted(proofId)));
- if (talentProof.getStatus().equals(ProofStatus.PUBLISHED)) {
- return SkillsOnProofDTO.builder().skills(talentProof.getSkills()).build();
- } else if (authentication != null) {
- UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
- if (userInfo.getTalent().getId().equals(talentProof.getTalent().getId())) {
- return SkillsOnProofDTO.builder().skills(talentProof.getSkills()).build();
- } else {
- throw new ResponseStatusException(FORBIDDEN, "you can't see proofs in DRAFT and HIDDEN status");
- }
- } else {
- throw new ResponseStatusException(FORBIDDEN, "you can't see proofs in DRAFT and HIDDEN status");
- }
- }
-
- public void deleteSkillOnProof(long talentId, long proofId, long skillId, Authentication authentication) {
- Talent talent = talentRepository.findById(talentId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "talent with id = %s not found".formatted(talentId)));
- UserInfo userInfo = userInfoRepository.findByLogin(authentication.getName())
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
- TalentProof talentProof = talentProofRepository.findById(proofId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND, "proof with id = %s not found".formatted(proofId)));
- if (!talentProof.getStatus().equals(ProofStatus.DRAFT)) {
- throw new ResponseStatusException(CONFLICT, "proof status must be DRAFT");
- }
- if (!talent.getId().equals(talentProof.getTalent().getId())) {
- throw new ResponseStatusException(BAD_REQUEST,
- "talentId with id = %s and proofId with id = %s do not match".formatted(talentId, proofId));
- }
- isValidUserEditTalent.accept(talentId, userInfo);
- Skills skills = skillsRepository.findById(skillId)
- .orElseThrow(() -> new ResponseStatusException(NOT_FOUND,
- "skill with id = %s not found".formatted(skillId)));
- if (!talentProof.getSkills().contains(skills)) {
- throw new ResponseStatusException(NOT_FOUND,
- "you dont have skill with id = %s on proof with id = %s".formatted(skillId, proofId));
- }
- talentProof.getSkills().remove(skills);
- }
-}
diff --git a/src/main/java/com/provedcode/user/controller/AuthenticationController.java b/src/main/java/com/provedcode/user/controller/AuthenticationController.java
index b30ee13..e25f35b 100644
--- a/src/main/java/com/provedcode/user/controller/AuthenticationController.java
+++ b/src/main/java/com/provedcode/user/controller/AuthenticationController.java
@@ -1,5 +1,6 @@
package com.provedcode.user.controller;
+import com.provedcode.talent.service.TalentService;
import com.provedcode.user.model.dto.SponsorRegistrationDTO;
import com.provedcode.user.model.dto.TalentRegistrationDTO;
import com.provedcode.user.model.dto.UserInfoDTO;
@@ -40,4 +41,9 @@ UserInfoDTO register(@RequestBody @Valid TalentRegistrationDTO user) {
UserInfoDTO register(@RequestBody @Valid SponsorRegistrationDTO user) {
return authenticationService.register(user);
}
+
+ @GetMapping("/v5/activate")
+ void activateAccount(@RequestParam("uuid") String uuid) {
+ authenticationService.activateAccount(uuid);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/model/dto/UserInfoDTO.java b/src/main/java/com/provedcode/user/model/dto/UserInfoDTO.java
index 4c2671d..67985e9 100644
--- a/src/main/java/com/provedcode/user/model/dto/UserInfoDTO.java
+++ b/src/main/java/com/provedcode/user/model/dto/UserInfoDTO.java
@@ -4,8 +4,6 @@
@Builder
public record UserInfoDTO(
- String token,
- Long id,
- String role
+ String token
) {
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/model/entity/Authority.java b/src/main/java/com/provedcode/user/model/entity/Authority.java
index 03b7bac..7473afd 100644
--- a/src/main/java/com/provedcode/user/model/entity/Authority.java
+++ b/src/main/java/com/provedcode/user/model/entity/Authority.java
@@ -1,23 +1,33 @@
package com.provedcode.user.model.entity;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
import com.provedcode.user.model.Role;
-import jakarta.persistence.*;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.Table;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
@Getter
@Setter
@Entity
-@Table(name = "authority")
+@Table(name = "authorities")
public class Authority {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false)
+ @Column(name = "id", nullable = false, insertable = false, updatable = false)
private Long id;
@Enumerated(EnumType.STRING)
@NotEmpty
diff --git a/src/main/java/com/provedcode/user/model/entity/DeletedUser.java b/src/main/java/com/provedcode/user/model/entity/DeletedUser.java
new file mode 100644
index 0000000..105f920
--- /dev/null
+++ b/src/main/java/com/provedcode/user/model/entity/DeletedUser.java
@@ -0,0 +1,25 @@
+package com.provedcode.user.model.entity;
+
+import jakarta.persistence.*;
+import lombok.*;
+import lombok.extern.slf4j.Slf4j;
+
+import java.time.Instant;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Getter
+@Setter
+@Slf4j
+@Builder
+@Entity
+public class DeletedUser {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+ private Instant timeToDelete;
+ @OneToOne
+ @JoinColumn(name = "user_id", referencedColumnName = "id")
+ private UserInfo deletedUser;
+ private String uuidForActivate;
+}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/model/entity/UserInfo.java b/src/main/java/com/provedcode/user/model/entity/UserInfo.java
index 852d0b8..7250e83 100644
--- a/src/main/java/com/provedcode/user/model/entity/UserInfo.java
+++ b/src/main/java/com/provedcode/user/model/entity/UserInfo.java
@@ -1,14 +1,30 @@
package com.provedcode.user.model.entity;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
import com.provedcode.sponsor.model.entity.Sponsor;
import com.provedcode.talent.model.entity.Talent;
-import jakarta.persistence.*;
+
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
-import lombok.*;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
@Builder
@AllArgsConstructor
@@ -16,7 +32,7 @@
@Getter
@Setter
@Entity
-@Table(name = "user_info")
+@Table(name = "users_info")
public class UserInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -37,8 +53,9 @@ public class UserInfo {
@Column(name = "password")
private String password;
@ManyToMany(fetch = FetchType.EAGER)
- @JoinTable(name = "user_authorities",
- joinColumns = @JoinColumn(name = "user_id"),
- inverseJoinColumns = @JoinColumn(name = "authority_id"))
+ @JoinTable(name = "users_authorities", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "authority_id"))
private Set authorities = new LinkedHashSet<>();
+
+ @Column(columnDefinition = "FALSE")
+ private Boolean isLocked;
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/repo/DeletedUserRepository.java b/src/main/java/com/provedcode/user/repo/DeletedUserRepository.java
new file mode 100644
index 0000000..de3478a
--- /dev/null
+++ b/src/main/java/com/provedcode/user/repo/DeletedUserRepository.java
@@ -0,0 +1,15 @@
+package com.provedcode.user.repo;
+
+import com.provedcode.user.model.entity.DeletedUser;
+import com.provedcode.user.model.entity.UserInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Optional;
+
+public interface DeletedUserRepository extends JpaRepository {
+ @Query("select d from DeletedUser d where d.uuidForActivate = ?1")
+ Optional findByUUID(String uuidForActivate);
+ Optional findByUuidForActivate(String uuidForActivate);
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/service/AuthenticationService.java b/src/main/java/com/provedcode/user/service/AuthenticationService.java
index 57b7bcd..277af5d 100644
--- a/src/main/java/com/provedcode/user/service/AuthenticationService.java
+++ b/src/main/java/com/provedcode/user/service/AuthenticationService.java
@@ -9,6 +9,10 @@
public interface AuthenticationService {
UserInfoDTO login(String name, Collection extends GrantedAuthority> authorities);
+
UserInfoDTO register(TalentRegistrationDTO user);
+
UserInfoDTO register(SponsorRegistrationDTO user);
+
+ void activateAccount(String uuid);
}
diff --git a/src/main/java/com/provedcode/user/service/impl/AuthenticationServiceImpl.java b/src/main/java/com/provedcode/user/service/impl/AuthenticationServiceImpl.java
index 9fbd2b2..2adc01f 100644
--- a/src/main/java/com/provedcode/user/service/impl/AuthenticationServiceImpl.java
+++ b/src/main/java/com/provedcode/user/service/impl/AuthenticationServiceImpl.java
@@ -9,8 +9,10 @@
import com.provedcode.user.model.dto.TalentRegistrationDTO;
import com.provedcode.user.model.dto.UserInfoDTO;
import com.provedcode.user.model.entity.Authority;
+import com.provedcode.user.model.entity.DeletedUser;
import com.provedcode.user.model.entity.UserInfo;
import com.provedcode.user.repo.AuthorityRepository;
+import com.provedcode.user.repo.DeletedUserRepository;
import com.provedcode.user.repo.UserInfoRepository;
import com.provedcode.user.service.AuthenticationService;
import lombok.AllArgsConstructor;
@@ -18,6 +20,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.jwt.JwtClaimsSet;
import org.springframework.security.oauth2.jwt.JwtEncoder;
import org.springframework.security.oauth2.jwt.JwtEncoderParameters;
@@ -28,6 +31,7 @@
import java.time.Instant;
import java.util.Collection;
import java.util.Set;
+import java.util.function.BiFunction;
import java.util.stream.Collectors;
import static java.time.temporal.ChronoUnit.MINUTES;
@@ -44,6 +48,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
SponsorRepository sponsorRepository;
AuthorityRepository authorityRepository;
PasswordEncoder passwordEncoder;
+ DeletedUserRepository deletedUserRepository;
@Transactional(readOnly = true)
public UserInfoDTO login(String name, Collection extends GrantedAuthority> authorities) {
@@ -53,12 +58,10 @@ public UserInfoDTO login(String name, Collection extends GrantedAuthority> aut
Role userRole = userInfo.getAuthorities().stream().findFirst().orElseThrow().getAuthority();
- return UserInfoDTO.builder()
- .token(generateJWTToken(name, authorities))
- .id(userRole.equals(Role.TALENT) ? userInfo.getTalent().getId()
- : userInfo.getSponsor().getId())
- .role(userRole.name())
- .build();
+ BiFunction getUserIdFunction = (user, role) -> role.equals(Role.TALENT) ? user.getTalent().getId()
+ : user.getSponsor().getId();
+
+ return new UserInfoDTO(generateJWTToken(getUserIdFunction.apply(userInfo, userRole), name, authorities).getTokenValue());
}
public UserInfoDTO register(TalentRegistrationDTO user) {
@@ -79,6 +82,7 @@ public UserInfoDTO register(TalentRegistrationDTO user) {
.login(user.login())
.password(passwordEncoder.encode(user.password()))
.authorities(Set.of(authorityRepository.findByAuthority(Role.TALENT).orElseThrow()))
+ .isLocked(false)
.build();
userInfoRepository.save(userInfo);
@@ -88,11 +92,7 @@ public UserInfoDTO register(TalentRegistrationDTO user) {
log.info("user with login {%s} was saved, his authorities: %s".formatted(userLogin, userAuthorities));
- return UserInfoDTO.builder()
- .token(generateJWTToken(userLogin, userAuthorities))
- .id(talent.getId())
- .role(Role.TALENT.name())
- .build();
+ return new UserInfoDTO(generateJWTToken(talent.getId(), userLogin, userAuthorities).getTokenValue());
}
public UserInfoDTO register(SponsorRegistrationDTO user) {
@@ -114,6 +114,7 @@ public UserInfoDTO register(SponsorRegistrationDTO user) {
.password(passwordEncoder.encode(user.password()))
.authorities(
Set.of(authorityRepository.findByAuthority(Role.SPONSOR).orElseThrow()))
+ .isLocked(false)
.build();
userInfoRepository.save(userInfo);
@@ -123,25 +124,33 @@ public UserInfoDTO register(SponsorRegistrationDTO user) {
log.info("user with login {%s} was saved, his authorities: %s".formatted(userLogin, userAuthorities));
- return UserInfoDTO.builder()
- .token(generateJWTToken(userLogin, userAuthorities))
- .id(sponsor.getId())
- .role(Role.SPONSOR.name())
- .build();
+ return new UserInfoDTO(generateJWTToken(sponsor.getId(), userLogin, userAuthorities).getTokenValue());
+ }
+
+ public void activateAccount(String uuid) {
+ DeletedUser deletedUser = deletedUserRepository.findByUUID(uuid)
+ .orElseThrow(() -> new ResponseStatusException(NOT_FOUND));
+ UserInfo user = deletedUser.getDeletedUser();
+ user.setIsLocked(false);
+ deletedUserRepository.deleteById(deletedUser.getId());
+ userInfoRepository.save(user);
}
- private String generateJWTToken(String name, Collection extends GrantedAuthority> authorities) {
- log.info("=== POST /login === auth.name = {}", name);
+ private Jwt generateJWTToken(Long id, String login, Collection extends GrantedAuthority> authorities) {
+ log.info("=== POST /login === auth.login = {}", login);
log.info("=== POST /login === auth = {}", authorities);
var now = Instant.now();
var claims = JwtClaimsSet.builder()
.issuer("self")
.issuedAt(now)
.expiresAt(now.plus(60, MINUTES))
- .subject(name)
+ .subject(login)
.claim("scope", authorities.stream().map(GrantedAuthority::getAuthority)
.collect(Collectors.joining(" ")))
+ .claim("role", authorities.stream().map(GrantedAuthority::getAuthority)
+ .collect(Collectors.joining(" ")).replace("ROLE_", ""))
+ .claim("id", id)
.build();
- return jwtEncoder.encode(JwtEncoderParameters.from(claims)).getTokenValue();
+ return jwtEncoder.encode(JwtEncoderParameters.from(claims));
}
}
\ No newline at end of file
diff --git a/src/main/java/com/provedcode/user/service/impl/EmailService.java b/src/main/java/com/provedcode/user/service/impl/EmailService.java
new file mode 100644
index 0000000..c497427
--- /dev/null
+++ b/src/main/java/com/provedcode/user/service/impl/EmailService.java
@@ -0,0 +1,25 @@
+package com.provedcode.user.service.impl;
+
+import com.provedcode.config.EmailConfig;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.mail.SimpleMailMessage;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+@Slf4j
+public class EmailService {
+ private JavaMailSender javaMailSender;
+ private EmailConfig emailConfig;
+
+ public void sendEmail(String to, String subject, String text) {
+ SimpleMailMessage message = new SimpleMailMessage();
+ message.setFrom(emailConfig.getDefaultEmail());
+ message.setTo(to);
+ message.setSubject(subject);
+ message.setText(text);
+ javaMailSender.send(message);
+ }
+}
diff --git a/src/main/java/com/provedcode/user/util/UsersSchedulerService.java b/src/main/java/com/provedcode/user/util/UsersSchedulerService.java
new file mode 100644
index 0000000..63285dd
--- /dev/null
+++ b/src/main/java/com/provedcode/user/util/UsersSchedulerService.java
@@ -0,0 +1,64 @@
+package com.provedcode.user.util;
+
+import com.provedcode.user.repo.DeletedUserRepository;
+import com.provedcode.user.repo.UserInfoRepository;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.Instant;
+import java.util.concurrent.TimeUnit;
+
+@Service
+@EnableScheduling
+@AllArgsConstructor
+@Transactional
+@Slf4j
+public class UsersSchedulerService {
+ UserInfoRepository userInfoRepository;
+ DeletedUserRepository deletedUsersRepository;
+
+ @Scheduled(timeUnit = TimeUnit.HOURS, fixedRate = 1)
+ void deleteUser() {
+ deletedUsersRepository.findAll()
+ .forEach(userToDelete -> {
+ if (userToDelete.getTimeToDelete().isAfter(Instant.now())) {
+ log.info("deleting user: id = {}", userToDelete.getDeletedUser().getId());
+ deletedUsersRepository.delete(userToDelete);
+ userInfoRepository.delete(userToDelete.getDeletedUser());
+ }
+ });
+ }
+
+// @Async
+// public void scheduleDeletingMethod(String uuid) {
+// try {
+// TimeUnit.MINUTES.sleep(3);
+// log.info("scheduleDeletingMethod = {}", uuid);
+// deletedUsersRepository.findByUUID(uuid)
+// .ifPresent(deleted -> {
+// deletedUsersRepository.delete(deleted);
+// deleteUser(deleted.getDeletedUser());
+// });
+// } catch (InterruptedException e) {
+// Thread.currentThread().interrupt();
+// }
+// }
+//
+// private void deleteUser(UserInfo user) {
+// if (user.getSponsor() != null) {
+// List kudosList = user.getSponsor().getKudoses().stream().map(i -> {
+// i.setSponsor(null);
+// return i;
+// }).toList();
+// user.getSponsor().setKudoses(kudosList);
+// userInfoRepository.delete(user);
+// }
+// if (user.getTalent() != null) {
+// userInfoRepository.delete(user);
+// }
+// }
+}
diff --git a/src/main/java/com/provedcode/util/annotations/doc/controller/proof/DeleteProofApiDoc.java b/src/main/java/com/provedcode/util/annotations/doc/controller/proof/DeleteProofApiDoc.java
index 5f77466..f2e8868 100644
--- a/src/main/java/com/provedcode/util/annotations/doc/controller/proof/DeleteProofApiDoc.java
+++ b/src/main/java/com/provedcode/util/annotations/doc/controller/proof/DeleteProofApiDoc.java
@@ -19,9 +19,7 @@
description = "As a talent I want to have an opportunity to delete my personal proofs")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
- description = "SUCCESS",
- content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
- schema = @Schema(implementation = StatusDTO.class))),
+ description = "SUCCESS"),
@ApiResponse(responseCode = "404",
description = "NOT FOUND",
content = @Content),
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index 6bd5814..21ea24c 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -1,5 +1,6 @@
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.url=jdbc:h2:mem:./testdb;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH
-#logging.level.web=DEBUG
-#logging.level.sql=DEBUG
\ No newline at end of file
+# logging.level.web=DEBUG
+# logging.level.sql=DEBUG
+# spring.jpa.show-sql=true
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index f91aa56..d3d2982 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -38,4 +38,14 @@ page-config.default-page-num=0
page-config.default-page-size=5
page-config.default-sort-by=created
##
-spring.liquibase.enabled=true
\ No newline at end of file
+spring.liquibase.enabled=true
+##
+spring.mail.host=smtp.gmail.com
+spring.mail.port=587
+spring.mail.username=${EMAIL_USER}
+spring.mail.password=${EMAIL_PASSWORD}
+spring.mail.properties.mail.smtp.auth=true
+spring.mail.properties.mail.smtp.starttls.enable=true
+# Default email response
+default-email.user-deleted=Your account has been suspended, it will be deleted after 24 hours, click on the link to restore it:\n%s\nBest wishes from the test team.
+default-email.user-deleted-subject=Your account has been suspended, TestTeam.
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V4/data-V4.1.sql b/src/main/resources/db/changelog/changeset/V4/data-V4.1.sql
index 9261f0d..2f86411 100644
--- a/src/main/resources/db/changelog/changeset/V4/data-V4.1.sql
+++ b/src/main/resources/db/changelog/changeset/V4/data-V4.1.sql
@@ -1,19 +1,18 @@
--liquibase formatted sql
--changeset dennis:3
--- Skill
-INSERT INTO talent_skill (proof_id, skill_id)
+-- Skill in proof
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (1, 1);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (1, 2);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (1, 3);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (1, 4);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (4, 1);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (5, 2);
-INSERT INTO talent_skill (proof_id, skill_id)
+INSERT INTO proof_skill (proof_id, skill_id)
VALUES (6, 3);
-
diff --git a/src/main/resources/db/changelog/changeset/V4/data-V4.2.sql b/src/main/resources/db/changelog/changeset/V4/data-V4.2.sql
new file mode 100644
index 0000000..09cd767
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V4/data-V4.2.sql
@@ -0,0 +1,25 @@
+--liquibase formatted sql
+--changeset mykhailo:3
+
+-- Skill on proof
+
+
+-- Skill on talent
+INSERT INTO talent_skill (talent_id, skill_id)
+VALUES(1, 1);
+INSERT INTO talent_skill (talent_id, skill_id)
+VALUES(1, 2);
+INSERT INTO talent_skill (talent_id, skill_id)
+VALUES(5, 1);
+INSERT INTO talent_skill (talent_id, skill_id)
+VALUES(5, 2);
+INSERT INTO talent_skill (talent_id, skill_id)
+VALUES(5, 3);
+
+-- Skills on proof
+INSERT INTO proof_skill (proof_id, skill_id)
+VALUES (13, 1);
+INSERT INTO proof_skill (proof_id, skill_id)
+VALUES (13, 2);
+INSERT INTO proof_skill (proof_id, skill_id)
+VALUES (13, 3);
diff --git a/src/main/resources/db/changelog/changeset/V4/data-V4.sql b/src/main/resources/db/changelog/changeset/V4/data-V4.sql
index 4f08749..c1b0ebb 100644
--- a/src/main/resources/db/changelog/changeset/V4/data-V4.sql
+++ b/src/main/resources/db/changelog/changeset/V4/data-V4.sql
@@ -35,2036 +35,1619 @@ values (13, 'Angular');
-- Talent
-- Serhii Soloviov
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Serhii',
+values ('Serhii',
'Soloviov',
'Java-Developer',
- 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg'
- );
+ 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'My cat`s name is Igor'
- );
+ ),
+ 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.',
+ 'My cat`s name is Igor');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'first_contact'
- );
+ ), 'first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'second_contact'
- );
+ ), 'second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'third_contact'
- );
+ ), 'third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I wrote a program that transforms the written code into music', 'PUBLISHED', '2022-01-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
+ 'Here I wrote a program that transforms the written code into music', 'PUBLISHED', '2022-01-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-03-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-03-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2021-06-08 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2021-06-08 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'SerhiiSoloviov@gmail.com', '$2a$10$EzYxG1DEUek/veK.HzP7B.ynSKE42VbLb4pvFd/v4OwGPNol6buEC'
- );
+ ), 'SerhiiSoloviov@gmail.com', '$2a$10$EzYxG1DEUek/veK.HzP7B.ynSKE42VbLb4pvFd/v4OwGPNol6buEC');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Mykhailo Ordyntsev
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Mykhailo',
+values ('Mykhailo',
'Ordyntsev',
'Java-Developer',
- 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg'
- );
+ 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I very like anime'
- );
+ ),
+ 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.',
+ 'I very like anime');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MykhailoOrdyntsev_first_contact'
- );
+ ), 'MykhailoOrdyntsev_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MykhailoOrdyntsev_second_contact'
- );
+ ), 'MykhailoOrdyntsev_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MykhailoOrdyntsev_third_contact'
- );
+ ), 'MykhailoOrdyntsev_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-08-07 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-08-07 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2022-04-08 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2022-04-08 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2022-09-02 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2022-09-02 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MykhailoOrdyntsev@gmail.com', '$2a$10$XD60M86n1MDf3AMIixgnnOQq9JVYnnX/umlNFcre0GoC2XgSN/Cfq'
- );
+ ), 'MykhailoOrdyntsev@gmail.com', '$2a$10$XD60M86n1MDf3AMIixgnnOQq9JVYnnX/umlNFcre0GoC2XgSN/Cfq');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Denis Boyko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Denis',
+values ('Denis',
'Boyko',
'Java-Developer',
- 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg'
- );
+ 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I`m a student '
- );
+ ),
+ 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.',
+ 'I`m a student ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DenisBoyko_first_contact'
- );
+ ), 'DenisBoyko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DenisBoyko_second_contact'
- );
+ ), 'DenisBoyko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DenisBoyko_third_contact'
- );
+ ), 'DenisBoyko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-02-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-02-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-09-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-09-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-04-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-04-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DenisBoyko@gmail.com', '$2a$10$tLm27FGH8Sabz57eNkTwm.bSnhmJHINcqt7dNfZI0NfOwD2o/Drse'
- );
+ ), 'DenisBoyko@gmail.com', '$2a$10$tLm27FGH8Sabz57eNkTwm.bSnhmJHINcqt7dNfZI0NfOwD2o/Drse');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Ihor Schurenko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Ihor',
+values ('Ihor',
'Schurenko',
'Java-Developer',
- 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg'
- );
+ 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I will get married soon'
- );
+ ),
+ 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.',
+ 'I will get married soon');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorShchurenko_first_contact'
- );
+ ), 'IhorShchurenko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorShchurenko_second_contact'
- );
+ ), 'IhorShchurenko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorShchurenko_third_contact'
- );
+ ), 'IhorShchurenko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I describe my rest api project in java', 'PUBLISHED', '2021-08-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I describe my rest api project in java',
+ 'PUBLISHED', '2021-08-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2022-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2022-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-05-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-05-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorShchurenko@gmail.com', '$2a$10$X.d4hR.yRf3cK0Go20aTTukOI9u/Zu2cj5WU0iTcDihyhJ5vUHXkq'
- );
+ ), 'IhorShchurenko@gmail.com', '$2a$10$X.d4hR.yRf3cK0Go20aTTukOI9u/Zu2cj5WU0iTcDihyhJ5vUHXkq');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Dmytro Uzun
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Dmytro',
+values ('Dmytro',
'Uzun',
'Dev-Ops',
- 'https://i.pinimg.com/564x/1c/af/87/1caf8771ef3edf351f6f2bf6f1c0a276.jpg'
- );
+ 'https://i.pinimg.com/564x/1c/af/87/1caf8771ef3edf351f6f2bf6f1c0a276.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'I am instructing a team that is currently writing my own biography for me.', 'He-he-he, hello everyone!'
- );
+ ), 'I am instructing a team that is currently writing my own biography for me.',
+ 'He-he-he, hello everyone!');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DmytroUzun_first_contact'
- );
+ ), 'DmytroUzun_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DmytroUzun_second_contact'
- );
+ ), 'DmytroUzun_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DmytroUzun_third_contact'
- );
+ ), 'DmytroUzun_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://github.com/ProvedCode', 'My project where I am a team mentor', 'PUBLISHED', '2023-02-08 16:00:19'
- );
+ ), 'https://github.com/ProvedCode', 'My project where I am a team mentor', 'PUBLISHED',
+ '2023-02-08 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-03-03 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-03-03 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-09-05 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-09-05 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DmytroUzun@gmail.com', '$2a$10$J2Yuh10BWHy8XYk.T5rd2uOwk/h5EYG1eVXTAOkTkTdQcc5Qzd9.y'
- );
+ ), 'DmytroUzun@gmail.com', '$2a$10$J2Yuh10BWHy8XYk.T5rd2uOwk/h5EYG1eVXTAOkTkTdQcc5Qzd9.y');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Viktor Voloshko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Viktor',
+values ('Viktor',
'Voloshko',
'Dev-Ops',
- 'https://i.pinimg.com/564x/a9/51/ab/a951ab682413b89617235e65564c1e5e.jpg'
- );
+ 'https://i.pinimg.com/564x/a9/51/ab/a951ab682413b89617235e65564c1e5e.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is dev-ops.', 'I like videogames!'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is dev-ops.', 'I like videogames!');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ViktorVoloshko_first_contact'
- );
+ ), 'ViktorVoloshko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ViktorVoloshko_second_contact'
- );
+ ), 'ViktorVoloshko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ViktorVoloshko_third_contact'
- );
+ ), 'ViktorVoloshko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2022-02-09 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2022-02-09 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2020-04-02 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2020-04-02 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-08-06 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-08-06 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ViktorVoloshko@gmail.com', '$2a$10$eZX3hBvllxkmH.juZzN72uvFYtphkrxsj14K5BnHHKy4coRV9FMvq'
- );
+ ), 'ViktorVoloshko@gmail.com', '$2a$10$eZX3hBvllxkmH.juZzN72uvFYtphkrxsj14K5BnHHKy4coRV9FMvq');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Olha Moiseienko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Olha',
+values ('Olha',
'Moiseienko',
'QA',
- 'https://i.pinimg.com/564x/6d/9d/43/6d9d437baf4db114c047d927307beb84.jpg'
- );
+ 'https://i.pinimg.com/564x/6d/9d/43/6d9d437baf4db114c047d927307beb84.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'OlhaMoiseienko_first_contact'
- );
+ ), 'OlhaMoiseienko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'OlhaMoiseienko_second_contact'
- );
+ ), 'OlhaMoiseienko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'OlhaMoiseienko_third_contact'
- );
+ ), 'OlhaMoiseienko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My QA Jira project', 'PUBLISHED', '2022-09-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My QA Jira project', 'PUBLISHED', '2022-09-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2021-01-09 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2021-01-09 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'OlhaMoiseienko@gmail.com', '$2a$10$lvvX7DZOwCS/Q7zSo.k.oeayTcKHh8rO1yBBkgIbU4VAC7abPfIa2'
- );
+ ), 'OlhaMoiseienko@gmail.com', '$2a$10$lvvX7DZOwCS/Q7zSo.k.oeayTcKHh8rO1yBBkgIbU4VAC7abPfIa2');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Maxim Kiyashko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Maxim',
+values ('Maxim',
'Kiyashko',
'QA',
- 'https://i.pinimg.com/564x/80/2d/58/802d58b0302985f9486893d499d3634d.jpg'
- );
+ 'https://i.pinimg.com/564x/80/2d/58/802d58b0302985f9486893d499d3634d.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MaximKiyashko_first_contact'
- );
+ ), 'MaximKiyashko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MaximKiyashko_second_contact'
- );
+ ), 'MaximKiyashko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MaximKiyashko_third_contact'
- );
+ ), 'MaximKiyashko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My custom Arduino OS', 'PUBLISHED', '2023-08-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My custom Arduino OS', 'PUBLISHED',
+ '2023-08-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-01-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-01-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'PUBLISHED', '2023-02-09 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'PUBLISHED',
+ '2023-02-09 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'MaximKiyashko@gmail.com', '$2a$10$y.g9qHYUOPEkIL8xDc2h1.EdVAG5DYh6OKxf9CRb6s16oHHbr8Bny'
- );
+ ), 'MaximKiyashko@gmail.com', '$2a$10$y.g9qHYUOPEkIL8xDc2h1.EdVAG5DYh6OKxf9CRb6s16oHHbr8Bny');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Nikolaiev Oleksii
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Nikolaiev',
+values ('Nikolaiev',
'Oleksii',
'QA',
- 'https://i.pinimg.com/564x/54/d1/0d/54d10dfce64afefabc9fbbce5de82c87.jpg'
- );
+ 'https://i.pinimg.com/564x/54/d1/0d/54d10dfce64afefabc9fbbce5de82c87.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'NikolaievOleksii_first_contact'
- );
+ ), 'NikolaievOleksii_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'NikolaievOleksii_second_contact'
- );
+ ), 'NikolaievOleksii_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'NikolaievOleksii_third_contact'
- );
+ ), 'NikolaievOleksii_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Link to my magnum opus:', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Link to my magnum opus:', 'PUBLISHED',
+ '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'NikolaievOleksiio@gmail.com', '$2a$10$nDObO3nDlhWev29qCnzNuOszdg/.ANaMlTirDVWVyLMapYmtSSqza'
- );
+ ), 'NikolaievOleksiio@gmail.com', '$2a$10$nDObO3nDlhWev29qCnzNuOszdg/.ANaMlTirDVWVyLMapYmtSSqza');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Artem Lytvynenko
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Artem',
+values ('Artem',
'Lytvynenko',
'QA',
- 'https://i.pinimg.com/564x/87/63/55/87635509c5fa7ee496ec351fa7e67eaa.jpg'
- );
+ 'https://i.pinimg.com/564x/87/63/55/87635509c5fa7ee496ec351fa7e67eaa.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ArtemLytvynenko_first_contact'
- );
+ ), 'ArtemLytvynenko_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ArtemLytvynenko_second_contact'
- );
+ ), 'ArtemLytvynenko_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ArtemLytvynenko_third_contact'
- );
+ ), 'ArtemLytvynenko_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I wrote tasks for the project', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I wrote tasks for the project', 'PUBLISHED',
+ '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'ArtemLytvynenko@gmail.com', '$2a$10$.M2fHh9NXbkbnrVHeT.lYeInA8K2khuMUL08iG4NuXs18KIeFBmwG'
- );
+ ), 'ArtemLytvynenko@gmail.com', '$2a$10$.M2fHh9NXbkbnrVHeT.lYeInA8K2khuMUL08iG4NuXs18KIeFBmwG');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Daniil Yevtukhov
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Daniil',
+values ('Daniil',
'Yevtukhov',
'Java-Script-Developer',
- 'https://i.pinimg.com/564x/fe/b1/37/feb137d88a3d1c8fb28796db6cbc576f.jpg'
- );
+ 'https://i.pinimg.com/564x/fe/b1/37/feb137d88a3d1c8fb28796db6cbc576f.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'I have my own Instagram'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.',
+ 'I have my own Instagram');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DaniilYevtukhov_first_contact'
- );
+ ), 'DaniilYevtukhov_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DaniilYevtukhov_second_contact'
- );
+ ), 'DaniilYevtukhov_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DaniilYevtukhov_third_contact'
- );
+ ), 'DaniilYevtukhov_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My main project where I am making REACT application', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My main project where I am making REACT application',
+ 'PUBLISHED', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'DaniilYevtukhov@gmail.com', '$2a$10$cDxp6U/YcObKMwZNgtEB5eZFLWXuwFU0lIUSPIkfPdvq9l8JUqGea'
- );
+ ), 'DaniilYevtukhov@gmail.com', '$2a$10$cDxp6U/YcObKMwZNgtEB5eZFLWXuwFU0lIUSPIkfPdvq9l8JUqGea');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Ruslan Morozov
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Ruslan',
+values ('Ruslan',
'Morozov',
'Java-Script-Developer',
- 'https://i.pinimg.com/736x/36/ae/0e/36ae0ea4aad656f7c3d3175bc33b8399.jpg'
- );
+ 'https://i.pinimg.com/736x/36/ae/0e/36ae0ea4aad656f7c3d3175bc33b8399.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.',
+ 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'RuslanMorozov_first_contact'
- );
+ ), 'RuslanMorozov_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'RuslanMorozov_second_contact'
- );
+ ), 'RuslanMorozov_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'RuslanMorozov_third_contact'
- );
+ ), 'RuslanMorozov_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here my container for styles', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here my container for styles', 'PUBLISHED',
+ '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'RuslanMorozov@gmail.com', '$2a$10$Hfzp4b6r825g1ZqGzxmal..VNKvo7F4v4YFpBZZ036hmO.7UIWlaK'
- );
+ ), 'RuslanMorozov@gmail.com', '$2a$10$Hfzp4b6r825g1ZqGzxmal..VNKvo7F4v4YFpBZZ036hmO.7UIWlaK');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Ihor Kopieichykov
insert into talent (first_name, last_name, specialization, image)
-values (
- 'Ihor',
+values ('Ihor',
'Kopieichykov',
'Java-Script-Developer',
- 'https://i.pinimg.com/564x/0d/f0/83/0df083121bac75f64e3d93c7c5682d04.jpg'
- );
+ 'https://i.pinimg.com/564x/0d/f0/83/0df083121bac75f64e3d93c7c5682d04.jpg');
insert into talent_description (talent_id, BIO, addition_info)
-values(
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'Glory to Ukraine'
- );
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.',
+ 'Glory to Ukraine');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_link (talent_id, link)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorKopieichykov_first_contact'
- );
+ ), 'IhorKopieichykov_first_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorKopieichykov_second_contact'
- );
+ ), 'IhorKopieichykov_second_contact');
insert into talent_contact (talent_id, contact)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorKopieichykov_third_contact'
- );
+ ), 'IhorKopieichykov_third_contact');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_attached_file (talent_id, attached_file)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my JavaScript library', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my JavaScript library', 'PUBLISHED',
+ '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my main project in Angular', 'PUBLISHED', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my main project in Angular', 'PUBLISHED',
+ '2023-06-04 16:00:19');
insert into talent_proofs (talent_id, link, text, status, created)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
- );
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19');
insert into user_info (talent_id, login, password)
-values (
- (
+values ((
select id
from talent
order by id desc
limit 1
- ), 'IhorKopieichykov@gmail.com', '$2a$10$D4KM50WemOahkFv1fkrPX.MvVESsE0TYWlkh5TypTE/q4nlv8ooyS'
- );
+ ), 'IhorKopieichykov@gmail.com', '$2a$10$D4KM50WemOahkFv1fkrPX.MvVESsE0TYWlkh5TypTE/q4nlv8ooyS');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 1
- )
- );
+ ));
-- Sponsor
-- Maksym Khudoliy
insert into sponsor (amount_kudos, first_name, last_name, image)
-values (
- 888,
+values (888,
'Maksym',
'Khudoliy',
- 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg'
- );
+ 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg');
insert into user_info (sponsor_id, login, password)
-values (
- (
+values ((
select id
from sponsor
order by id desc
limit 1
- ), 'MaksymKhudoliy@gmail.com', '$2a$10$pDrAuawhi3ADZpVDDr7C6eAcaQwDr5oQ9GdZUUZHSsqyM/vVkpruy'
- );
+ ), 'MaksymKhudoliy@gmail.com', '$2a$10$pDrAuawhi3ADZpVDDr7C6eAcaQwDr5oQ9GdZUUZHSsqyM/vVkpruy');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 2
- )
- );
+ ));
-- Oleksandr Butrym
insert into sponsor (amount_kudos, first_name, last_name, image)
-values (
- 888,
+values (888,
'Oleksandr',
'Butrym',
- 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg'
- );
+ 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg');
insert into user_info (sponsor_id, login, password)
-values (
- (
+values ((
select id
from sponsor
order by id desc
limit 1
- ), 'OleksandrButrym@gmail.com', '$2a$10$R0o8os0t86qyBvg0bO/a6ukuy9VesLapxIkZFLjNupWjvr5Hdjyge'
- );
+ ), 'OleksandrButrym@gmail.com', '$2a$10$R0o8os0t86qyBvg0bO/a6ukuy9VesLapxIkZFLjNupWjvr5Hdjyge');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 2
- )
- );
+ ));
-- Olha Shutylieva
insert into sponsor (amount_kudos, first_name, last_name, image)
-values (
- 888,
+values (888,
'Olha',
'Shutylieva',
- 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg'
- );
+ 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg');
insert into user_info (sponsor_id, login, password)
-values (
- (
+values ((
select id
from sponsor
order by id desc
limit 1
- ), 'OlhaShutylieva@gmail.com', '$2a$10$UzwVTVR7E2BW.5hA4XWgy.g0XcM.UbIMBoY1cDnYNPQDhCXEa7eGm'
- );
+ ), 'OlhaShutylieva@gmail.com', '$2a$10$UzwVTVR7E2BW.5hA4XWgy.g0XcM.UbIMBoY1cDnYNPQDhCXEa7eGm');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 2
- )
- );
+ ));
-- Vladyslav Khrychov
insert into sponsor (amount_kudos, first_name, last_name, image)
-values (
- 888,
+values (888,
'Vladyslav',
'Khrychov',
- 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg'
- );
+ 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg');
insert into user_info (sponsor_id, login, password)
-values (
- (
+values ((
select id
from sponsor
order by id desc
limit 1
- ), 'VladyslavKhrychov@gmail.com', '$2a$10$o2va23ZPVVSptyCaSBO/oubpML4xEPZo9Ie0ASt154zNVSKdFrN02'
- );
+ ), 'VladyslavKhrychov@gmail.com', '$2a$10$o2va23ZPVVSptyCaSBO/oubpML4xEPZo9Ie0ASt154zNVSKdFrN02');
insert into user_authorities (user_id, authority_id)
-values (
- (
+values ((
select id
from user_info
order by id desc
limit 1
- ), (
+ ), (
select authority.id
from authority
where id = 2
- )
- );
+ ));
-- Kudos
insert into kudos (amount, sponsor_id, proof_id)
values (100, 1, 1);
diff --git a/src/main/resources/db/changelog/changeset/V4/schema-V4.sql b/src/main/resources/db/changelog/changeset/V4/schema-V4.sql
index b49be00..7608822 100644
--- a/src/main/resources/db/changelog/changeset/V4/schema-V4.sql
+++ b/src/main/resources/db/changelog/changeset/V4/schema-V4.sql
@@ -2,119 +2,142 @@
-- changeset Ren:0
-- tables for sprint 4.1
-- Talent
-CREATE TABLE talent (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- first_name VARCHAR(20),
- last_name VARCHAR(20),
+CREATE TABLE talent
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ first_name VARCHAR(20),
+ last_name VARCHAR(20),
specialization VARCHAR(30),
- image VARCHAR(1000),
- image_name VARCHAR(100),
+ image VARCHAR(1000),
+ image_name VARCHAR(100),
CONSTRAINT pk_talent PRIMARY KEY (id)
);
-CREATE TABLE talent_attached_file (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT NOT NULL,
+CREATE TABLE talent_attached_file
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL,
attached_file VARCHAR(100),
CONSTRAINT pk_talent_attached_file PRIMARY KEY (id)
);
-CREATE TABLE talent_contact (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT NOT NULL,
- contact VARCHAR(255),
+CREATE TABLE talent_contact
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL,
+ contact VARCHAR(255),
CONSTRAINT pk_talent_contact PRIMARY KEY (id)
);
-CREATE TABLE talent_description (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT NOT NULL,
- bio VARCHAR(2000),
+CREATE TABLE talent_description
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL,
+ bio VARCHAR(2000),
addition_info VARCHAR(500),
CONSTRAINT pk_talent_description PRIMARY KEY (id)
);
-CREATE TABLE talent_link (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT NOT NULL,
- link VARCHAR(500),
+CREATE TABLE talent_link
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL,
+ link VARCHAR(500),
CONSTRAINT pk_talent_link PRIMARY KEY (id)
);
-CREATE TABLE talent_proofs (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT NOT NULL,
- link VARCHAR(100),
- text VARCHAR(1000),
- status VARCHAR(20) NOT NULL,
- created TIMESTAMP,
+CREATE TABLE talent_proofs
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL,
+ link VARCHAR(100),
+ text VARCHAR(1000),
+ status VARCHAR(20) NOT NULL,
+ created TIMESTAMP,
CONSTRAINT pk_talent_proofs PRIMARY KEY (id)
);
-CREATE TABLE talent_skill (
+CREATE TABLE talent_skill
+(
+ talent_id BIGINT NOT NULL,
+ skill_id BIGINT NOT NULL,
+ CONSTRAINT pk_talent_skill PRIMARY KEY (talent_id, skill_id)
+);
+CREATE TABLE proof_skill
+(
proof_id BIGINT NOT NULL,
skill_id BIGINT NOT NULL,
- CONSTRAINT pk_talent_skill PRIMARY KEY (proof_id, skill_id)
+ CONSTRAINT pk_proof_skill PRIMARY KEY (proof_id, skill_id)
);
-CREATE TABLE skill (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+CREATE TABLE skill
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
skill VARCHAR(30),
CONSTRAINT pk_skill PRIMARY KEY (id)
);
-- User
-CREATE TABLE user_info (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- talent_id BIGINT,
+CREATE TABLE user_info
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT,
sponsor_id BIGINT,
- login VARCHAR(100) NOT NULL,
- password VARCHAR(255) NOT NULL,
+ login VARCHAR(100) NOT NULL,
+ password VARCHAR(255) NOT NULL,
CONSTRAINT pk_user_info PRIMARY KEY (id)
);
-CREATE TABLE authority (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- authority VARCHAR(20) NOT NULL,
+CREATE TABLE authority
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ authority VARCHAR(20) NOT NULL,
CONSTRAINT pk_authority PRIMARY KEY (id)
);
-CREATE TABLE user_authorities (
- authority_id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- user_id BIGINT NOT NULL,
+CREATE TABLE user_authorities
+(
+ authority_id BIGINT NOT NULL,
+ user_id BIGINT NOT NULL,
CONSTRAINT pk_user_authorities PRIMARY KEY (authority_id, user_id)
);
-- Sponsor
-CREATE TABLE sponsor (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
- first_name VARCHAR(20),
- last_name VARCHAR(20),
- image VARCHAR(1000),
- image_name VARCHAR(100),
+CREATE TABLE sponsor
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ first_name VARCHAR(20),
+ last_name VARCHAR(20),
+ image VARCHAR(1000),
+ image_name VARCHAR(100),
amount_kudos BIGINT,
CONSTRAINT pk_sponsor PRIMARY KEY (id)
);
-CREATE TABLE kudos (
- id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+CREATE TABLE kudos
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
sponsor_id BIGINT,
- proof_id BIGINT,
- amount BIGINT,
+ proof_id BIGINT,
+ amount BIGINT,
CONSTRAINT pk_kudos PRIMARY KEY (id)
);
-- Foreign keys
ALTER TABLE talent_attached_file
-ADD CONSTRAINT FK_TALENT_ATTACHED_FILE_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_TALENT_ATTACHED_FILE_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE talent_contact
-ADD CONSTRAINT FK_TALENT_CONTACT_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_TALENT_CONTACT_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE talent_description
-ADD CONSTRAINT FK_TALENT_DESCRIPTION_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_TALENT_DESCRIPTION_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE talent_link
-ADD CONSTRAINT FK_TALENT_LINK_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_TALENT_LINK_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE talent_proofs
-ADD CONSTRAINT FK_TALENT_PROOFS_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_TALENT_PROOFS_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE user_info
-ADD CONSTRAINT FK_USER_INFO_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ ADD CONSTRAINT FK_USER_INFO_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE user_authorities
-ADD CONSTRAINT FK_useaut_on_authority FOREIGN KEY (authority_id) REFERENCES authority (id);
+ ADD CONSTRAINT FK_useaut_on_authority FOREIGN KEY (authority_id) REFERENCES authority (id);
ALTER TABLE user_authorities
-ADD CONSTRAINT FK_useaut_on_user_info FOREIGN KEY (user_id) REFERENCES user_info (id);
+ ADD CONSTRAINT FK_useaut_on_user_info FOREIGN KEY (user_id) REFERENCES user_info (id);
ALTER TABLE kudos
-ADD CONSTRAINT FK_KUDOS_ON_PROOF FOREIGN KEY (proof_id) REFERENCES talent_proofs (id);
+ ADD CONSTRAINT FK_KUDOS_ON_PROOF FOREIGN KEY (proof_id) REFERENCES talent_proofs (id);
ALTER TABLE kudos
-ADD CONSTRAINT FK_KUDOS_ON_SPONSOR FOREIGN KEY (sponsor_id) REFERENCES sponsor (id);
+ ADD CONSTRAINT FK_KUDOS_ON_SPONSOR FOREIGN KEY (sponsor_id) REFERENCES sponsor (id);
+ALTER TABLE proof_skill
+ ADD CONSTRAINT FK_proof_skill_ON_TALENT_PROOF FOREIGN KEY (proof_id) REFERENCES talent_proofs (id);
+ALTER TABLE proof_skill
+ ADD CONSTRAINT FK_proof_skill_ON_SKILL FOREIGN KEY (skill_id) REFERENCES skill (id);
ALTER TABLE talent_skill
-ADD CONSTRAINT FK_TALENT_SKILL_ON_TALENT_PROOF FOREIGN KEY (proof_id) REFERENCES talent_proofs (id);
+ ADD CONSTRAINT FK_talent_skill_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
ALTER TABLE talent_skill
-ADD CONSTRAINT FK_TALENT_SKILL_ON_SKILL FOREIGN KEY (skill_id) REFERENCES skill (id);
+ ADD CONSTRAINT FK_talent_skill_ON_SKILL FOREIGN KEY (skill_id) REFERENCES skill (id);
-- Indexes
CREATE UNIQUE INDEX idx_login ON user_info (login)
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/data-V5.sql b/src/main/resources/db/changelog/changeset/V5/data-V5.sql
new file mode 100644
index 0000000..2d63889
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/data-V5.sql
@@ -0,0 +1,2041 @@
+--liquibase formatted sql
+--changeset Ren:0
+-- Authority
+insert into authorities (id, authority)
+values (1, 'TALENT');
+insert into authorities (id, authority)
+values (2, 'SPONSOR');
+
+-- Talent
+-- Serhii Soloviov
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Serhii',
+ 'Soloviov',
+ 'Java-Developer',
+ 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'My cat`s name is Igor'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I wrote a program that transforms the written code into music', 'PUBLISHED', '2022-01-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-03-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2021-06-08 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'SerhiiSoloviov@gmail.com', '$2a$10$EzYxG1DEUek/veK.HzP7B.ynSKE42VbLb4pvFd/v4OwGPNol6buEC'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Mykhailo Ordyntsev
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Mykhailo',
+ 'Ordyntsev',
+ 'Java-Developer',
+ 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I very like anime'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MykhailoOrdyntsev_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MykhailoOrdyntsev_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MykhailoOrdyntsev_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-08-07 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2022-04-08 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2022-09-02 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MykhailoOrdyntsev@gmail.com', '$2a$10$XD60M86n1MDf3AMIixgnnOQq9JVYnnX/umlNFcre0GoC2XgSN/Cfq'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Denis Boyko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Denis',
+ 'Boyko',
+ 'Java-Developer',
+ 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I`m a student '
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DenisBoyko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DenisBoyko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DenisBoyko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'DRAFT', '2022-02-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-09-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-04-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DenisBoyko@gmail.com', '$2a$10$tLm27FGH8Sabz57eNkTwm.bSnhmJHINcqt7dNfZI0NfOwD2o/Drse'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Ihor Schurenko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Ihor',
+ 'Schurenko',
+ 'Java-Developer',
+ 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hello! I was born in Ukraine. My profession is Java Back-end developer. Now I`m developing a Java backend using Spring Boot.', 'I will get married soon'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorShchurenko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorShchurenko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorShchurenko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I describe my rest api project in java', 'PUBLISHED', '2021-08-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2022-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-05-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorShchurenko@gmail.com', '$2a$10$X.d4hR.yRf3cK0Go20aTTukOI9u/Zu2cj5WU0iTcDihyhJ5vUHXkq'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Dmytro Uzun
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Dmytro',
+ 'Uzun',
+ 'Dev-Ops',
+ 'https://i.pinimg.com/564x/1c/af/87/1caf8771ef3edf351f6f2bf6f1c0a276.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'I am instructing a team that is currently writing my own biography for me.', 'He-he-he, hello everyone!'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DmytroUzun_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DmytroUzun_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DmytroUzun_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://github.com/ProvedCode', 'My project where I am a team mentor', 'PUBLISHED', '2023-02-08 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2021-03-03 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-09-05 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DmytroUzun@gmail.com', '$2a$10$J2Yuh10BWHy8XYk.T5rd2uOwk/h5EYG1eVXTAOkTkTdQcc5Qzd9.y'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Viktor Voloshko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Viktor',
+ 'Voloshko',
+ 'Dev-Ops',
+ 'https://i.pinimg.com/564x/a9/51/ab/a951ab682413b89617235e65564c1e5e.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is dev-ops.', 'I like videogames!'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ViktorVoloshko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ViktorVoloshko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ViktorVoloshko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2022-02-09 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2020-04-02 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-08-06 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ViktorVoloshko@gmail.com', '$2a$10$eZX3hBvllxkmH.juZzN72uvFYtphkrxsj14K5BnHHKy4coRV9FMvq'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Olha Moiseienko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Olha',
+ 'Moiseienko',
+ 'QA',
+ 'https://i.pinimg.com/564x/6d/9d/43/6d9d437baf4db114c047d927307beb84.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'OlhaMoiseienko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'OlhaMoiseienko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'OlhaMoiseienko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to first proof', 'HIDDEN', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My QA Jira project', 'PUBLISHED', '2022-09-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2021-01-09 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'OlhaMoiseienko@gmail.com', '$2a$10$lvvX7DZOwCS/Q7zSo.k.oeayTcKHh8rO1yBBkgIbU4VAC7abPfIa2'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Maxim Kiyashko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Maxim',
+ 'Kiyashko',
+ 'QA',
+ 'https://i.pinimg.com/564x/80/2d/58/802d58b0302985f9486893d499d3634d.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MaximKiyashko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MaximKiyashko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MaximKiyashko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My custom Arduino OS', 'PUBLISHED', '2023-08-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-01-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'PUBLISHED', '2023-02-09 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'MaximKiyashko@gmail.com', '$2a$10$y.g9qHYUOPEkIL8xDc2h1.EdVAG5DYh6OKxf9CRb6s16oHHbr8Bny'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Nikolaiev Oleksii
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Nikolaiev',
+ 'Oleksii',
+ 'QA',
+ 'https://i.pinimg.com/564x/54/d1/0d/54d10dfce64afefabc9fbbce5de82c87.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'NikolaievOleksii_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'NikolaievOleksii_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'NikolaievOleksii_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Link to my magnum opus:', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'NikolaievOleksiio@gmail.com', '$2a$10$nDObO3nDlhWev29qCnzNuOszdg/.ANaMlTirDVWVyLMapYmtSSqza'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Artem Lytvynenko
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Artem',
+ 'Lytvynenko',
+ 'QA',
+ 'https://i.pinimg.com/564x/87/63/55/87635509c5fa7ee496ec351fa7e67eaa.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is QA.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ArtemLytvynenko_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ArtemLytvynenko_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ArtemLytvynenko_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here I wrote tasks for the project', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'HIDDEN', '2023-06-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'ArtemLytvynenko@gmail.com', '$2a$10$.M2fHh9NXbkbnrVHeT.lYeInA8K2khuMUL08iG4NuXs18KIeFBmwG'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Daniil Yevtukhov
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Daniil',
+ 'Yevtukhov',
+ 'Java-Script-Developer',
+ 'https://i.pinimg.com/564x/fe/b1/37/feb137d88a3d1c8fb28796db6cbc576f.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'I have my own Instagram'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DaniilYevtukhov_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DaniilYevtukhov_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DaniilYevtukhov_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'My main project where I am making REACT application', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'HIDDEN', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'DaniilYevtukhov@gmail.com', '$2a$10$cDxp6U/YcObKMwZNgtEB5eZFLWXuwFU0lIUSPIkfPdvq9l8JUqGea'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Ruslan Morozov
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Ruslan',
+ 'Morozov',
+ 'Java-Script-Developer',
+ 'https://i.pinimg.com/736x/36/ae/0e/36ae0ea4aad656f7c3d3175bc33b8399.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'RuslanMorozov_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'RuslanMorozov_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'RuslanMorozov_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here my container for styles', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to second proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'RuslanMorozov@gmail.com', '$2a$10$Hfzp4b6r825g1ZqGzxmal..VNKvo7F4v4YFpBZZ036hmO.7UIWlaK'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Ihor Kopieichykov
+insert into talents (first_name, last_name, specialization, image)
+values (
+ 'Ihor',
+ 'Kopieichykov',
+ 'Java-Script-Developer',
+ 'https://i.pinimg.com/564x/0d/f0/83/0df083121bac75f64e3d93c7c5682d04.jpg'
+ );
+insert into descriptions (talent_id, bio, addition_info)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'Hi all! I was born in Ukraine. I am a student. My profession is JavaScript developer.', 'Glory to Ukraine'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into links (talent_id, link)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorKopieichykov_first_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorKopieichykov_second_contact'
+ );
+insert into contacts (talent_id, contact)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorKopieichykov_third_contact'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into attached_files (talent_id, attached_file)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my JavaScript library', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'Here is my main project in Angular', 'PUBLISHED', '2023-06-04 16:00:19'
+ );
+insert into proofs (talent_id, link, text, status, created)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'text to third proof', 'DRAFT', '2023-06-04 16:00:19'
+ );
+insert into users_info (talent_id, login, password)
+values (
+ (
+ select id
+ from talents
+ order by id desc
+ limit 1
+ ), 'IhorKopieichykov@gmail.com', '$2a$10$D4KM50WemOahkFv1fkrPX.MvVESsE0TYWlkh5TypTE/q4nlv8ooyS'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 1
+ )
+ );
+-- Sponsor
+-- Maksym Khudoliy
+insert into sponsors (amount_kudos, first_name, last_name, image)
+values (
+ 888,
+ 'Maksym',
+ 'Khudoliy',
+ 'https://i.pinimg.com/564x/e1/08/49/e10849923a8b2e85a7adf494ebd063e6.jpg'
+ );
+insert into users_info (sponsor_id, login, password)
+values (
+ (
+ select id
+ from sponsors
+ order by id desc
+ limit 1
+ ), 'MaksymKhudoliy@gmail.com', '$2a$10$pDrAuawhi3ADZpVDDr7C6eAcaQwDr5oQ9GdZUUZHSsqyM/vVkpruy'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 2
+ )
+ );
+-- Oleksandr Butrym
+insert into sponsors (amount_kudos, first_name, last_name, image)
+values (
+ 888,
+ 'Oleksandr',
+ 'Butrym',
+ 'https://i.pinimg.com/564x/c2/41/31/c24131fe00218467721ba5bacdf0a256.jpg'
+ );
+insert into users_info (sponsor_id, login, password)
+values (
+ (
+ select id
+ from sponsors
+ order by id desc
+ limit 1
+ ), 'OleksandrButrym@gmail.com', '$2a$10$R0o8os0t86qyBvg0bO/a6ukuy9VesLapxIkZFLjNupWjvr5Hdjyge'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 2
+ )
+ );
+-- Olha Shutylieva
+insert into sponsors (amount_kudos, first_name, last_name, image)
+values (
+ 888,
+ 'Olha',
+ 'Shutylieva',
+ 'https://i.pinimg.com/564x/2a/0c/08/2a0c08c421e253ca895c3fdc8c9e08d9.jpg'
+ );
+insert into users_info (sponsor_id, login, password)
+values (
+ (
+ select id
+ from sponsors
+ order by id desc
+ limit 1
+ ), 'OlhaShutylieva@gmail.com', '$2a$10$UzwVTVR7E2BW.5hA4XWgy.g0XcM.UbIMBoY1cDnYNPQDhCXEa7eGm'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 2
+ )
+ );
+-- Vladyslav Khrychov
+insert into sponsors (amount_kudos, first_name, last_name, image)
+values (
+ 888,
+ 'Vladyslav',
+ 'Khrychov',
+ 'https://i.pinimg.com/564x/e1/11/2f/e1112f0b7b63644dc3e313084936dedb.jpg'
+ );
+insert into users_info (sponsor_id, login, password)
+values (
+ (
+ select id
+ from sponsors
+ order by id desc
+ limit 1
+ ), 'VladyslavKhrychov@gmail.com', '$2a$10$o2va23ZPVVSptyCaSBO/oubpML4xEPZo9Ie0ASt154zNVSKdFrN02'
+ );
+insert into users_authorities (user_id, authority_id)
+values (
+ (
+ select id
+ from users_info
+ order by id desc
+ limit 1
+ ), (
+ select id
+ from authorities
+ where id = 2
+ )
+ );
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/dataKudos-V5.sql b/src/main/resources/db/changelog/changeset/V5/dataKudos-V5.sql
new file mode 100644
index 0000000..7b94fe3
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/dataKudos-V5.sql
@@ -0,0 +1,12 @@
+--liquibase formatted sql
+--changeset dennis:5
+insert into kudos(amount, sponsor_id, proof_skill_id)
+values (10, 1, 1);
+insert into kudos(amount, sponsor_id, proof_skill_id)
+values (20, 2, 1);
+insert into kudos(amount, sponsor_id, proof_skill_id)
+values (30, 3, 3);
+insert into kudos(amount, sponsor_id, proof_skill_id)
+values (10, 4, 1);
+insert into kudos(amount, sponsor_id, proof_skill_id)
+values (10, 1, 4);
diff --git a/src/main/resources/db/changelog/changeset/V5/dataSkill-V5.sql b/src/main/resources/db/changelog/changeset/V5/dataSkill-V5.sql
new file mode 100644
index 0000000..8de1cc7
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/dataSkill-V5.sql
@@ -0,0 +1,25 @@
+--liquibase formatted sql
+--changeset dennis:5
+insert into proofs_skills (skill_id, proof_id)
+values (1, 1);
+insert into proofs_skills (skill_id, proof_id)
+values (2, 1);
+insert into proofs_skills (skill_id, proof_id)
+values (2, 2);
+insert into proofs_skills (skill_id, proof_id)
+values (3, 3);
+
+insert into talents_skills(talent_id, skill_id)
+values (1, 1);
+insert into talents_skills(talent_id, skill_id)
+values (1, 2);
+insert into talents_skills(talent_id, skill_id)
+values (1, 3);
+insert into talents_skills(talent_id, skill_id)
+values (2, 1);
+insert into talents_skills(talent_id, skill_id)
+values (2, 2);
+insert into talents_skills(talent_id, skill_id)
+values (2, 6);
+insert into talents_skills(talent_id, skill_id)
+values (3, 1);
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/deleted-user-schema.sql b/src/main/resources/db/changelog/changeset/V5/deleted-user-schema.sql
new file mode 100644
index 0000000..7f19179
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/deleted-user-schema.sql
@@ -0,0 +1,14 @@
+--liquibase formatted sql
+--changeset Maslyna:5
+
+CREATE TABLE deleted_user
+(
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ time_to_delete TIMESTAMP WITHOUT TIME ZONE,
+ user_id BIGINT,
+ uuid_for_activate VARCHAR(255),
+ CONSTRAINT pk_deleteduser PRIMARY KEY (id)
+);
+
+ALTER TABLE deleted_user
+ ADD CONSTRAINT FK_DELETEDUSER_ON_USER FOREIGN KEY (user_id) REFERENCES users_info (id);
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/drop-V5.sql b/src/main/resources/db/changelog/changeset/V5/drop-V5.sql
new file mode 100644
index 0000000..b2a74c6
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/drop-V5.sql
@@ -0,0 +1,19 @@
+--liquibase formatted sql
+--changeset Ren:0
+-- Talent
+drop table if exists talent cascade;
+drop table if exists talent_attached_file cascade;
+drop table if exists talent_contact cascade;
+drop table if exists talent_description cascade;
+drop table if exists talent_link cascade;
+drop table if exists talent_proofs cascade;
+drop table if exists talent_skill cascade;
+drop table if exists proof_skill cascade;
+drop table if exists skill cascade;
+-- User
+drop table if exists authority cascade;
+drop table if exists user_authorities cascade;
+drop table if exists user_info cascade;
+-- Sponsor
+drop table if exists sponsor cascade;
+drop table if exists kudos cascade;
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/schema-V5.sql b/src/main/resources/db/changelog/changeset/V5/schema-V5.sql
new file mode 100644
index 0000000..27d6855
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/schema-V5.sql
@@ -0,0 +1,50 @@
+-- User
+CREATE TABLE user_info (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT,
+ sponsor_id BIGINT,
+ login VARCHAR(100) NOT NULL,
+ password VARCHAR(255) NOT NULL,
+ CONSTRAINT pk_user_info PRIMARY KEY (id)
+);
+CREATE TABLE authority (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ authority VARCHAR(20) NOT NULL,
+ CONSTRAINT pk_authority PRIMARY KEY (id)
+);
+CREATE TABLE user_authorities (
+ authority_id BIGINT NOT NULL,
+ user_id BIGINT NOT NULL,
+ CONSTRAINT pk_user_authorities PRIMARY KEY (authority_id, user_id)
+);
+-- Foreign keys
+ALTER TABLE talent_attached_file
+ADD CONSTRAINT FK_TALENT_ATTACHED_FILE_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE talent_contact
+ADD CONSTRAINT FK_TALENT_CONTACT_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE talent_description
+ADD CONSTRAINT FK_TALENT_DESCRIPTION_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE talent_link
+ADD CONSTRAINT FK_TALENT_LINK_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE talent_proofs
+ADD CONSTRAINT FK_TALENT_PROOFS_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE user_info
+ADD CONSTRAINT FK_USER_INFO_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE user_authorities
+ADD CONSTRAINT FK_useaut_on_authority FOREIGN KEY (authority_id) REFERENCES authority (id);
+ALTER TABLE user_authorities
+ADD CONSTRAINT FK_useaut_on_user_info FOREIGN KEY (user_id) REFERENCES user_info (id);
+ALTER TABLE kudos
+ADD CONSTRAINT FK_KUDOS_ON_SPONSOR FOREIGN KEY (sponsor_id) REFERENCES sponsor (id);
+ALTER TABLE kudos
+ADD CONSTRAINT FK_KUDOS_ON_PROOF_SKILL FOREIGN KEY (proof_skill_id) REFERENCES proof_skill (id);
+ALTER TABLE proof_skill
+ADD CONSTRAINT FK_proof_skill_ON_TALENT_PROOF FOREIGN KEY (proof_id) REFERENCES talent_proofs (id);
+ALTER TABLE proof_skill
+ADD CONSTRAINT FK_proof_skill_ON_SKILL FOREIGN KEY (skill_id) REFERENCES skill (id);
+ALTER TABLE talent_skill
+ADD CONSTRAINT FK_talent_skill_ON_TALENT FOREIGN KEY (talent_id) REFERENCES talent (id);
+ALTER TABLE talent_skill
+ADD CONSTRAINT FK_talent_skill_ON_SKILL FOREIGN KEY (skill_id) REFERENCES skill (id);
+-- Indexes
+CREATE UNIQUE INDEX idx_login ON user_info (login)
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/skills-data.sql b/src/main/resources/db/changelog/changeset/V5/skills-data.sql
new file mode 100644
index 0000000..cd7848c
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/skills-data.sql
@@ -0,0 +1,223 @@
+--liquibase formatted sql
+--changeset Maslyna:0
+
+-- Skill
+insert into skills (id, skill)
+values (1, 'Java Core');
+insert into skills (id, skill)
+values (2, 'Spring Core');
+insert into skills (id, skill)
+values (3, 'Spring boot');
+insert into skills (id, skill)
+values (4, 'H2 Database');
+insert into skills (id, skill)
+values (5, 'Spring Security');
+insert into skills (id, skill)
+values (6, 'REST API');
+insert into skills (id, skill)
+values (7, 'Git');
+insert into skills (id, skill)
+values (8, 'Docker');
+insert into skills (id, skill)
+values (9, 'Jira');
+insert into skills (id, skill)
+values (10, 'JavaScript Core');
+insert into skills (id, skill)
+values (11, 'React');
+insert into skills (id, skill)
+values (12, 'Node.js');
+insert into skills (id, skill)
+values (13, 'Angular');
+--
+INSERT INTO skills (id, skill)
+VALUES (14, 'Java Development Kit (JDK)'),
+ (15, 'Servlet API'),
+ (16, 'JavaServer Pages (JSP)'),
+ (17, 'JavaServer Faces (JSF)'),
+ (18, 'Spring Framework'),
+ (19, 'Hibernate'),
+ (20, 'Apache Struts'),
+ (21, 'MySQL'),
+ (22, 'PostgreSQL'),
+ (23, 'Oracle'),
+ (24, 'SQL'),
+ (25, 'Eclipse'),
+ (26, 'IntelliJ IDEA'),
+ (27, 'NetBeans'),
+ (28, 'Apache Tomcat'),
+ (29, 'Jetty'),
+ (30, 'JBoss'),
+ (31, 'Git'),
+ (32, 'SVN'),
+ (33, 'Mercurial'),
+ (34, 'Algorithms and data structures'),
+ (35, 'SOAP'),
+ (36, 'REST'),
+ (37, 'JSON'),
+ (38, 'XML'),
+ (39, 'Multithreading and parallelism');
+INSERT INTO skills (id, skill)
+VALUES (40, 'Django'),
+ (41, 'Flask'),
+ (42, 'Pyramid'),
+ (43, 'SQLite'),
+ (44, 'NoSQL'),
+ (45, 'MongoDB'),
+ (46, 'Redis'),
+ (47, 'BeautifulSoup'),
+ (48, 'Scrapy'),
+ (49, 'asyncio'),
+ (50, 'Twisted'),
+ (51, 'NumPy'),
+ (52, 'SciPy'),
+ (53, 'Pandas'),
+ (54, 'scikit-learn'),
+ (55, 'TensorFlow'),
+ (56, 'PyTorch'),
+ (57, 'JavaScript'),
+ (58, 'HTML'),
+ (59, 'CSS'),
+ (60, 'DOM'),
+ (61, 'React'),
+ (62, 'Angular'),
+ (63, 'Vue.js'),
+ (64, 'jQuery'),
+ (65, 'AJAX'),
+ (66, 'XSS (Cross-Site Scripting)'),
+ (67, 'CSRF (Cross-Site Request Forgery)'),
+ (68, 'Swift'),
+ (69, 'UIKit'),
+ (70, 'AppKit'),
+ (71, 'Core Data'),
+ (72, 'Core Animation'),
+ (73, 'Core Location'),
+ (74, 'Core Graphics'),
+ (75, 'Storyboards'),
+ (76, 'Interface Builder'),
+ (77, 'Auto Layout'),
+ (78, 'CoreData'),
+ (79, 'Asynchronous programming'),
+ (80, 'MVC (Model-View-Controller)'),
+ (81, 'MVVM (Model-View-ViewModel)'),
+ (82, 'Clean Architecture'),
+ (83, 'Kotlin'),
+ (84, 'Android SDK'),
+ (85, 'Firebase'),
+ (86, 'Jenkins'),
+ (87, 'Docker'),
+ (88, 'UNIX'),
+ (89, 'Linux OS'),
+ (90, 'JPA'),
+ (91, 'JUnit'),
+ (92, 'OOP'),
+ (93, 'PHP'),
+ (94, 'Microservices'),
+ (95, 'Azure Service Bus'),
+ (96, 'Typescript'),
+ (97, 'WinForms'),
+ (98, 'Firebase Analytics'),
+ (99, 'Appsflyer'),
+ (100, 'Amplitude');
+INSERT INTO skills (id, skill)
+VALUES (101, 'Marketing'),
+ (102, 'Sales'),
+ (103, 'Content Writing'),
+ (104, 'Graphic Design'),
+ (105, 'Video Editing'),
+ (106, 'Project Management'),
+ (107, 'Leadership'),
+ (108, 'Negotiation'),
+ (109, 'Public Speaking'),
+ (110, 'Time Management'),
+ (111, 'Critical Thinking'),
+ (112, 'Problem Solving'),
+ (113, 'Customer Service'),
+ (114, 'Data Analysis'),
+ (115, 'Financial Planning'),
+ (116, 'Event Planning'),
+ (117, 'Foreign Languages'),
+ (118, 'Photography'),
+ (119, 'Cooking'),
+ (120, 'Yoga'),
+ (121, 'Creative Writing');
+INSERT INTO skills (id, skill)
+VALUES (122, 'Leadership Development'),
+ (123, 'Emotional Intelligence'),
+ (124, 'Teamwork'),
+ (125, 'Conflict Resolution'),
+ (126, 'Decision Making'),
+ (127, 'Presentation Skills'),
+ (128, 'Networking'),
+ (129, 'Research Skills'),
+ (130, 'Problem-solving'),
+ (131, 'Analytical Thinking'),
+ (132, 'Creativity'),
+ (133, 'Attention to Detail'),
+ (134, 'Organizational Skills'),
+ (135, 'Time Management'),
+ (136, 'Adaptability'),
+ (137, 'Stress Management'),
+ (138, 'Interpersonal Skills'),
+ (139, 'Communication Skills'),
+ (140, 'Customer Relationship Management'),
+ (141, 'Sales Techniques'),
+ (142, 'Market Research'),
+ (143, 'Digital Marketing'),
+ (144, 'Social Media Marketing'),
+ (145, 'Search Engine Optimization'),
+ (146, 'Content Marketing'),
+ (147, 'Data Analytics'),
+ (148, 'Financial Analysis'),
+ (149, 'Budgeting'),
+ (150, 'Project Planning'),
+ (151, 'Quality Assurance'),
+ (152, 'Risk Management'),
+ (153, 'Supply Chain Management'),
+ (154, 'Logistics'),
+ (155, 'Business Strategy'),
+ (156, 'Entrepreneurship'),
+ (157, 'Innovation'),
+ (158, 'Customer Service'),
+ (159, 'Hospitality'),
+ (160, 'Event Management');
+INSERT INTO skills (id, skill)
+VALUES (161, 'Teaching'),
+ (162, 'Tutoring'),
+ (163, 'Curriculum Development'),
+ (164, 'Instructional Design'),
+ (165, 'Classroom Management'),
+ (166, 'Educational Technology'),
+ (167, 'Language Teaching'),
+ (168, 'Music'),
+ (169, 'Art'),
+ (170, 'Sports'),
+ (171, 'Fitness'),
+ (172, 'Nutrition'),
+ (173, 'Counseling'),
+ (174, 'Life Coaching'),
+ (175, 'Meditation'),
+ (176, 'Mindfulness'),
+ (177, 'Research'),
+ (178, 'Data Entry'),
+ (179, 'Virtual Assistance'),
+ (180, 'Project Coordination'),
+ (181, 'Event Coordination'),
+ (182, 'Office Management'),
+ (183, 'Translation'),
+ (184, 'Transcription'),
+ (185, 'Proofreading'),
+ (186, 'Editing'),
+ (187, 'Copywriting'),
+ (188, 'Content Creation'),
+ (189, 'Social Media Management'),
+ (190, 'Graphic Design'),
+ (191, 'Video Editing'),
+ (192, 'Photography'),
+ (193, 'Web Development'),
+ (194, 'Mobile App Development'),
+ (195, 'Game Development'),
+ (196, 'UI/UX Design'),
+ (197, 'Product Management'),
+ (198, 'Agile Methodology'),
+ (199, 'Scrum'),
+ (200, 'Lean Manufacturing');
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/sponsor-schema-V5.sql b/src/main/resources/db/changelog/changeset/V5/sponsor-schema-V5.sql
new file mode 100644
index 0000000..e73f302
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/sponsor-schema-V5.sql
@@ -0,0 +1,20 @@
+-- liquibase formatted sql
+-- changeset Ren:0
+-- tables for sprint 5
+-- Sponsor
+CREATE TABLE sponsors (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ first_name VARCHAR(20),
+ last_name VARCHAR(20),
+ image VARCHAR(1000),
+ image_name VARCHAR(100),
+ amount_kudos BIGINT,
+ PRIMARY KEY (id)
+);
+CREATE TABLE kudos (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ sponsor_id BIGINT REFERENCES sponsors,
+ proof_skill_id BIGINT REFERENCES proofs_skills,
+ amount BIGINT,
+ PRIMARY KEY (id)
+);
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/talent-schema-V5.sql b/src/main/resources/db/changelog/changeset/V5/talent-schema-V5.sql
new file mode 100644
index 0000000..2eca374
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/talent-schema-V5.sql
@@ -0,0 +1,65 @@
+-- liquibase formatted sql
+-- changeset Ren:0
+-- tables for sprint 5
+-- Talent
+CREATE TABLE talents (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ first_name VARCHAR(20),
+ last_name VARCHAR(20),
+ specialization VARCHAR(30),
+ image VARCHAR(1000),
+ image_name VARCHAR(100),
+ PRIMARY KEY (id)
+);
+CREATE TABLE attached_files (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ attached_file VARCHAR(100),
+ PRIMARY KEY (id)
+);
+CREATE TABLE contacts (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ contact VARCHAR(255),
+ PRIMARY KEY (id)
+);
+CREATE TABLE descriptions (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ bio VARCHAR(2000),
+ addition_info VARCHAR(500),
+ PRIMARY KEY (id)
+);
+CREATE TABLE links (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ link VARCHAR(500),
+ PRIMARY KEY (id)
+);
+CREATE TABLE proofs (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ link VARCHAR(500),
+ text VARCHAR(1000),
+ status VARCHAR(20) NOT NULL,
+ created TIMESTAMP,
+ PRIMARY KEY (id)
+);
+CREATE TABLE skills (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ skill VARCHAR(50),
+ PRIMARY KEY (id)
+);
+CREATE TABLE talents_skills (
+ talent_id BIGINT NOT NULL REFERENCES talents,
+ skill_id BIGINT NOT NULL REFERENCES skills,
+ PRIMARY KEY (talent_id, skill_id)
+);
+CREATE TABLE proofs_skills (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ proof_id BIGINT NOT NULL REFERENCES proofs,
+ skill_id BIGINT NOT NULL REFERENCES skills,
+ PRIMARY KEY (id)
+);
+-- Створення складеного унікального індексу
+CREATE UNIQUE INDEX ON proofs_skills (id, proof_id, skill_id);
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/changeset/V5/user-info-schema-V5.sql b/src/main/resources/db/changelog/changeset/V5/user-info-schema-V5.sql
new file mode 100644
index 0000000..3028fe7
--- /dev/null
+++ b/src/main/resources/db/changelog/changeset/V5/user-info-schema-V5.sql
@@ -0,0 +1,23 @@
+-- liquibase formatted sql
+-- changeset Ren:0
+-- tables for sprint 5
+-- User
+CREATE TABLE users_info (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ talent_id BIGINT REFERENCES talents,
+ sponsor_id BIGINT REFERENCES sponsors,
+ login VARCHAR(100) NOT NULL,
+ password VARCHAR(255) NOT NULL,
+ is_locked BOOLEAN,
+ PRIMARY KEY (id)
+);
+CREATE TABLE authorities (
+ id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
+ authority VARCHAR(20) NOT NULL,
+ PRIMARY KEY (id)
+);
+CREATE TABLE users_authorities (
+ authority_id BIGINT NOT NULL REFERENCES authorities,
+ user_id BIGINT NOT NULL REFERENCES users_info,
+ PRIMARY KEY (authority_id, user_id)
+);
\ No newline at end of file
diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml
index d85eb97..49cbdae 100644
--- a/src/main/resources/db/changelog/db.changelog-master.yaml
+++ b/src/main/resources/db/changelog/db.changelog-master.yaml
@@ -10,6 +10,25 @@ databaseChangeLog:
- include:
file: db/changelog/changeset/V4/data-V4.sql
- include:
- file: db/changelog/changeset/V4/data-V4.1.sql
+ file: db/changelog/changeset/V4/data-V4.1.sql
- include:
- file: db/changelog/changeset/V4/skill-update.sql
+ file: db/changelog/changeset/V4/data-V4.2.sql
+ - include:
+ file: db/changelog/changeset/V5/drop-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/talent-schema-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/sponsor-schema-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/user-info-schema-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/data-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/skills-data.sql
+ - include:
+ file: db/changelog/changeset/V5/dataSkill-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/dataKudos-V5.sql
+ - include:
+ file: db/changelog/changeset/V5/deleted-user-schema.sql
+