security
This commit is contained in:
1 parent
2064ed5abc
commit
9efd7b3fb4
33 files changed
+595
-91
No files matched your search
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import site.easystartup.web.project.domain.model.Project;
|
||||
import site.easystartup.web.project.domain.requst.ParticipantRequest;
|
||||
import site.easystartup.web.project.domain.requst.ProjectRequest;
|
||||
import site.easystartup.web.domain.response.ResponseMessage;
|
||||
import site.easystartup.web.domain.response.MessageResponse;
|
||||
import site.easystartup.web.domain.validation.ResponseErrorValidation;
|
||||
import site.easystartup.web.project.dto.ParticipantDto;
|
||||
import site.easystartup.web.project.dto.ProjectDto;
|
||||
@@ -55,7 +55,7 @@ public class ProjectController {
|
||||
public ResponseEntity<Object> deleteProject(@PathVariable("projectId") Long projectId,
|
||||
Principal principal) {
|
||||
projectService.deleteProject(projectId, principal);
|
||||
return ResponseEntity.ok(new ResponseMessage("Project was deleted!"));
|
||||
return ResponseEntity.ok(new MessageResponse("Project was deleted!"));
|
||||
}
|
||||
|
||||
@GetMapping("/{projectId}")
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Project {
|
||||
private int commercialStatus;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(
|
||||
@JoinTable(name = "project_tag",
|
||||
joinColumns = @JoinColumn(name = "project_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "tag_id")
|
||||
)
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
package site.easystartup.web.project.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import site.easystartup.web.domain.model.Role;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class UserDto implements Serializable {
|
||||
private final long id;
|
||||
private final String username;
|
||||
private final String password;
|
||||
private final boolean active;
|
||||
private final String full_name;
|
||||
private final String status;
|
||||
private final String iconPath;
|
||||
private final String email;
|
||||
private final Set<String> tags;
|
||||
private final Set<String> professions;
|
||||
private final Set<Long> projects;
|
||||
private final Set<Role> roles;
|
||||
private long id;
|
||||
private String username;
|
||||
private String password;
|
||||
private boolean active;
|
||||
private String full_name;
|
||||
private String status;
|
||||
private String iconPath;
|
||||
private String email;
|
||||
private Set<String> tags;
|
||||
private Set<String> professions;
|
||||
private Set<Long> projects;
|
||||
private Set<Role> roles;
|
||||
}
|
||||
@@ -11,6 +11,6 @@ import java.util.LinkedHashSet;
|
||||
|
||||
@Repository
|
||||
public interface ParticipantRepo extends JpaRepository<Participant, Long> {
|
||||
@Query ("SELECT Project FROM Participant WHERE nameOfPosition = :nameOfPosition")
|
||||
@Query ("SELECT p FROM Participant p WHERE p.nameOfPosition = :nameOfPosition")
|
||||
LinkedHashSet<Project> findAllByNameOfPosition(@Param("nameOfPosition") String name);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import site.easystartup.web.domain.model.User;
|
||||
import site.easystartup.web.project.domain.model.Project;
|
||||
import site.easystartup.web.project.domain.model.Tag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,9 +14,7 @@ import java.util.List;
|
||||
public interface ProjectRepo extends JpaRepository<Project, Long> {
|
||||
|
||||
List<Project> findAllByOwnerOrderByCreatedDate(User owner);
|
||||
|
||||
@Query("SELECT p from Project p WHERE p.technology LIKE %:technology%")
|
||||
List<Project> findAllByTechnology(@Param("technology") String tech);
|
||||
List<Project> findAllByTechnology(Tag tag);
|
||||
|
||||
List<Project> findAllByCommercialStatusOrderByCreatedDateAsc(int commercialStatus);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ProjectService {
|
||||
}
|
||||
|
||||
public List<Project> getAllProjectsWithTechnology(String technology) {
|
||||
return projectRepo.findAllByTechnology(technology.trim());
|
||||
return projectRepo.findAllByTechnology(tagService.getTechnologyByName(technology.trim()));
|
||||
}
|
||||
|
||||
public List<Project> getAllProjectsForCurrentUser(Principal principal) {
|
||||
|
||||
@@ -31,4 +31,8 @@ public class TagService {
|
||||
});
|
||||
return tags;
|
||||
}
|
||||
|
||||
public Tag getTechnologyByName(String tag) {
|
||||
return tagRepo.findTagByTagNameIgnoreCase(tag).orElseThrow(() -> new RuntimeException("Technolohy not found"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user