Skip to content

Commit

Permalink
Merge pull request #12 from SOPT-33-iOS-Team-1/feat/#10-create-progra…
Browse files Browse the repository at this point in the history
…m-entity

feat: 봉사 프로그램, 취업 프로그램 엔티티 생성
  • Loading branch information
kseysh authored Nov 25, 2023
2 parents 76d9870 + 560c2f2 commit ed70233
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
이러한 사회적 낙인은 범죄자들이 방치되며 재범으로 이어지는 악순환을 반복시킨다. <br/>
따라서 우리는 이들의 변화 의지를 일으켜 일상을 회복하도록 돕고, 더 나은 사회를 만드는 것에 이바지하려 한다.


<br/>

## 📌 Tech Stacks
Expand All @@ -43,6 +44,7 @@
- **Version Control** : Git



<br/>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.sopt.sopkerton.common.domain;

import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import java.time.LocalDateTime;
Expand All @@ -14,10 +13,8 @@
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity {
@CreatedDate
@Column(name = "register_at")
private LocalDateTime registerAt;

@LastModifiedDate
@Column(name = "done_at")
private LocalDateTime doneAt;
}
14 changes: 14 additions & 0 deletions src/main/java/org/sopt/sopkerton/program/domain/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.sopt.sopkerton.program.domain;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum Category {
VOLUNTEERING("봉사"),
EMPLOYMENT("취업");

private final String value;
}
15 changes: 15 additions & 0 deletions src/main/java/org/sopt/sopkerton/program/domain/Employment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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;
}
47 changes: 47 additions & 0 deletions src/main/java/org/sopt/sopkerton/program/domain/Program.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.sopt.sopkerton.program.domain;

import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorColumn;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.sopt.sopkerton.common.domain.BaseEntity;

@Getter
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "programs")
public abstract class Program extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private String title;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Category category;

@Column(nullable = false)
private String organizationName;

@Column(nullable = false)
private String region;

@Column(nullable = false)
private String content;
}
14 changes: 14 additions & 0 deletions src/main/java/org/sopt/sopkerton/program/domain/Volunteering.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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;
}

0 comments on commit ed70233

Please sign in to comment.