From da4ed104b4303ae3dd4896bb10c2668ff5d9e55f Mon Sep 17 00:00:00 2001 From: transfer_kk Date: Sun, 26 Nov 2023 05:00:31 +0900 Subject: [PATCH] =?UTF-8?q?git=20commit=20-m=20"feat/#13=20program=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?status=20=EC=B6=94=EA=B0=80"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/sopkerton/program/domain/Employment.java | 15 --------------- .../sopt/sopkerton/program/domain/Program.java | 9 ++++++--- .../org/sopt/sopkerton/program/domain/Status.java | 5 ++++- .../sopkerton/program/domain/Volunteering.java | 14 -------------- .../program/dto/response/ProgramListResponse.java | 1 + .../sopkerton/program/service/ProgramService.java | 1 + 6 files changed, 12 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/org/sopt/sopkerton/program/domain/Employment.java delete mode 100644 src/main/java/org/sopt/sopkerton/program/domain/Volunteering.java diff --git a/src/main/java/org/sopt/sopkerton/program/domain/Employment.java b/src/main/java/org/sopt/sopkerton/program/domain/Employment.java deleted file mode 100644 index 2c01d35..0000000 --- a/src/main/java/org/sopt/sopkerton/program/domain/Employment.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.sopt.sopkerton.program.domain; - -import jakarta.persistence.DiscriminatorValue; -import jakarta.persistence.Entity; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; - - -@Entity -@DiscriminatorValue("EMPLOYMENT") -@NoArgsConstructor -@AllArgsConstructor -public class Employment extends Program{ - private int salary; -} diff --git a/src/main/java/org/sopt/sopkerton/program/domain/Program.java b/src/main/java/org/sopt/sopkerton/program/domain/Program.java index e8fd2a3..f839c10 100644 --- a/src/main/java/org/sopt/sopkerton/program/domain/Program.java +++ b/src/main/java/org/sopt/sopkerton/program/domain/Program.java @@ -19,12 +19,10 @@ @Getter @Entity -@Inheritance(strategy = InheritanceType.SINGLE_TABLE) -@DiscriminatorColumn(name = "program_type") @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor(access = AccessLevel.PROTECTED) @Table(name = "programs") -public abstract class Program extends BaseEntity { +public class Program extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "program_id") @@ -34,7 +32,9 @@ public abstract class Program extends BaseEntity { private String title; private String imageUrl; + private String type; + @Enumerated(value = EnumType.STRING) private Status status; @@ -46,4 +46,7 @@ public abstract class Program extends BaseEntity { @Column(nullable = false) private String content; + + private int volunteerHours; + private int salary; } diff --git a/src/main/java/org/sopt/sopkerton/program/domain/Status.java b/src/main/java/org/sopt/sopkerton/program/domain/Status.java index 621c9af..551bf3b 100644 --- a/src/main/java/org/sopt/sopkerton/program/domain/Status.java +++ b/src/main/java/org/sopt/sopkerton/program/domain/Status.java @@ -7,5 +7,8 @@ @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum Status { - REGISTER, DONE; + REGISTER("지원"), + DONE("완료"); + + private final String value; } diff --git a/src/main/java/org/sopt/sopkerton/program/domain/Volunteering.java b/src/main/java/org/sopt/sopkerton/program/domain/Volunteering.java deleted file mode 100644 index d19fa8f..0000000 --- a/src/main/java/org/sopt/sopkerton/program/domain/Volunteering.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sopt.sopkerton.program.domain; - -import jakarta.persistence.DiscriminatorValue; -import jakarta.persistence.Entity; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; - -@Entity -@DiscriminatorValue("VOLUNTEERING") -@NoArgsConstructor -@AllArgsConstructor -public class Volunteering extends Program{ - private int volunteerHours; -} diff --git a/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramListResponse.java b/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramListResponse.java index 707e054..1e43bdb 100644 --- a/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramListResponse.java +++ b/src/main/java/org/sopt/sopkerton/program/dto/response/ProgramListResponse.java @@ -9,6 +9,7 @@ public record ProgramListResponse( String title, String registerAt, String imageUrl, + String status, String Region ) { diff --git a/src/main/java/org/sopt/sopkerton/program/service/ProgramService.java b/src/main/java/org/sopt/sopkerton/program/service/ProgramService.java index bc29012..9aca4db 100644 --- a/src/main/java/org/sopt/sopkerton/program/service/ProgramService.java +++ b/src/main/java/org/sopt/sopkerton/program/service/ProgramService.java @@ -24,6 +24,7 @@ public List getProgramListByProgramType(String programType) program.getTitle(), formatToLocalDate(program.getRegisterAt()), program.getImageUrl(), + program.getStatus().getValue(), program.getRegion() )) .collect(Collectors.toList());