Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 봉사 프로그램, 취업 프로그램 엔티티 생성 #12

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}