ViSnezh
This commit is contained in:
1 parent
c5df48f563
commit
f379db0516
5 files changed
+128
No files matched your search
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package site.easystartup.easystartupcore.pojects.controller;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/project")
|
||||||
|
public class ProjectController {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package site.easystartup.easystartupcore.pojects.domain.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import site.easystartup.easystartupcore.domain.User;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "participant")
|
||||||
|
public class Participant {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "participant_id")
|
||||||
|
private Long participantId;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "project_id")
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
@Column(name = "technology")
|
||||||
|
@NotNull
|
||||||
|
private String technology;
|
||||||
|
|
||||||
|
@Column(name = "name_of_position")
|
||||||
|
private String nameOfPosition;
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "user_id")
|
||||||
|
private User userId;
|
||||||
|
|
||||||
|
@OneToMany
|
||||||
|
private Set<User> requests;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package site.easystartup.easystartupcore.pojects.domain.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import site.easystartup.easystartupcore.domain.User;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Table(name = "project")
|
||||||
|
public class Project {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "project_id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@Column(name = "cover_link")
|
||||||
|
private String coverLink;
|
||||||
|
|
||||||
|
@Column(name = "title")
|
||||||
|
@Size(min = 3, max = 100, message = "Title should be no less 3 and no more 100 signs")
|
||||||
|
@NotNull
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Column(name = "description")
|
||||||
|
@Size(min = 50, message = "Description should be no less 50 signs")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Column(name = "commercial_status") // 1 - commercial, 0 - non-commercial
|
||||||
|
private int commercialStatus;
|
||||||
|
|
||||||
|
@Column(name = "technology")
|
||||||
|
@NotNull
|
||||||
|
private String technology;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "owner_id")
|
||||||
|
private User owner;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "project")
|
||||||
|
private List<Participant> participants;
|
||||||
|
|
||||||
|
@Column(name = "created_date")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createdDate;
|
||||||
|
|
||||||
|
@PrePersist
|
||||||
|
private void createdDate() {
|
||||||
|
this.createdDate = LocalDateTime.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package site.easystartup.easystartupcore.pojects.repo;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import site.easystartup.easystartupcore.pojects.domain.model.Project;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ProjectRepo extends JpaRepository<Project, Long> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package site.easystartup.easystartupcore.pojects.service;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import site.easystartup.easystartupcore.pojects.repo.ProjectRepo;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ProjectService {
|
||||||
|
private final ProjectRepo projectRepo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user