Skip to content
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.project.growfit.domain.Goal.entity;

import com.project.growfit.global.entity.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
Expand All @@ -10,25 +9,29 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.time.LocalDateTime;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Entity
@Table(name = "goal_cert_days")
@Table(name = "goal")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class GoalCertDays extends BaseEntity {
public class Certification {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "cert_day_id")
@Column(name = "id")
private Long id;

@Column(name = "day", nullable = false, length = 5)
private String day;
@Column(name = "image_url", nullable = false)
private String imageUrl;

@Column(name = "certified_at", nullable = false)
private LocalDateTime certifiedAt;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_id")
@JoinColumn(name = "goal_id", nullable = false)
private Goal goal;
}
22 changes: 8 additions & 14 deletions src/main/java/com/project/growfit/domain/Goal/entity/Goal.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,20 @@ public class Goal extends BaseEntity {
@Column(name = "goal_id")
private Long id;

@Column(name = "name", nullable = false, length = 100)
@Column(name = "name", length = 100, nullable = false)
private String name;

@Column(name = "count", nullable = false)
private int count;
@Column(name = "icon_id", nullable = false)
private int iconId;

@Column(name = "cert_type", nullable = false)
@Column(name = "status", nullable = false)
@Enumerated(EnumType.STRING)
private CertType certType;

@Column(name = "state", nullable = false)
private GoalState state;
private GoalStatus status;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_type_id")
private GoalType goalType;

@OneToMany(mappedBy = "goal", cascade = CascadeType.ALL, orphanRemoval = true)
private List<GoalCertDays> certDaysList = new ArrayList<>();
@JoinColumn(name = "weekly_goal_id", nullable = false)
private WeeklyGoal weeklyGoal;

@OneToMany(mappedBy = "goal", cascade = CascadeType.ALL, orphanRemoval = true)
private List<GoalAcc> goalAccList = new ArrayList<>();
private List<Certification> certificationList = new ArrayList<>();
}
40 changes: 0 additions & 40 deletions src/main/java/com/project/growfit/domain/Goal/entity/GoalAcc.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.project.growfit.domain.Goal.entity;

public enum GoalStatus {
PENDING, PROGRESS, COMPLETE
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.project.growfit.domain.Goal.entity;

import com.project.growfit.domain.User.entity.Parent;
import com.project.growfit.global.entity.BaseEntity;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand All @@ -23,13 +22,13 @@

@Getter
@Entity
@Table(name = "goal_type")
@Table(name = "weekly_goal")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class GoalType extends BaseEntity {
public class WeeklyGoal extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "goal_type_id")
@Column(name = "weekly_goal_id")
private Long id;

@Column(name = "start_date", nullable = false)
Expand All @@ -38,14 +37,16 @@ public class GoalType extends BaseEntity {
@Column(name = "end_date", nullable = false)
private LocalDate endDate;

@Column(name = "type", nullable = false)
@Enumerated(EnumType.STRING)
private PeriodType type;
@Column(name = "certification_count", nullable = false)
private int certificationCount;

@Column(name = "is_letter_sent", nullable = false)
private boolean isLetterSent = false;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_board_id")
private GoalBoard goalBoard;
@JoinColumn(name = "parent_id", nullable = false)
private Parent parent;

@OneToMany(mappedBy = "goalType", cascade = CascadeType.ALL, orphanRemoval = true)
@OneToMany(mappedBy = "weeklyGoal", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Goal> goalList = new ArrayList<>();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.project.growfit.domain.User.entity;

import com.project.growfit.domain.Diet.entity.Diet;
import com.project.growfit.domain.Goal.entity.GoalBoard;
import com.project.growfit.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
Expand Down Expand Up @@ -57,10 +56,6 @@ public class Child extends BaseEntity {
@OneToMany(mappedBy = "child", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Diet> dietList = new ArrayList<>();

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_board_id")
private GoalBoard goalBoard;

@OneToMany(mappedBy = "child", cascade = CascadeType.ALL, orphanRemoval = true)
private List<BmiAnalysis> analysisList = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.project.growfit.domain.User.entity;

import com.project.growfit.domain.Goal.entity.WeeklyGoal;
import com.project.growfit.domain.board.dto.request.ProfileRequestDto;
import com.project.growfit.domain.board.entity.Bookmark;
import com.project.growfit.domain.board.entity.Comment;
Expand Down Expand Up @@ -63,6 +64,9 @@ public class Parent extends BaseEntity {
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Bookmark> bookmarkList = new ArrayList<>();

@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
private List<WeeklyGoal> weeklyGoalList = new ArrayList<>();

public Parent(String email, String name, String profileImage, String provider, ROLE role) {
this.email = email;
this.nickname = name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.project.growfit.domain.notice.entity;

public enum NoticeType {
LETTER,
GOAL_COMPLETED, // 아이가 주간 목표를 모두 달성 완료한 경우: 아이 -> 부모
PRAISE_LETTER, // 부모가 아이에게 편지를 작성 완료한 경우: 부모 -> 아이
MEAL,
GOAL
}