Skip to content

Commit

Permalink
Merge pull request #38 from KCY-Fit-a-Pet/feat/37
Browse files Browse the repository at this point in the history
โœจ User profile ์กฐํšŒ ๋ฐ ID/PW ๊ธฐ๋Šฅ ์ถ”๊ฐ€
  • Loading branch information
heejinnn authored Dec 1, 2023
2 parents 9e62695 + 80da98f commit d875b32
Show file tree
Hide file tree
Showing 82 changed files with 1,137 additions and 474 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/todo_bot.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
- Naver Cloud Platform Cloud DB for Redis
- Naver Cloud Platform Object Storage
- Naver Cloud Platform Simple & Easy Notification Service
- Naver Cloud Platform API Gateway & Cloud Functions
- Goorm IDE (for DB Server)

## Project Check List
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/kcy/fitapet/FitapetApplication.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.kcy.fitapet;

import com.kcy.fitapet.global.common.repository.ExtendedJpaRepositoryFactory;
import jakarta.annotation.PostConstruct;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import java.util.TimeZone;

@SpringBootApplication
@EnableJpaRepositories(repositoryFactoryBeanClass = ExtendedJpaRepositoryFactory.class)

public class FitapetApplication {
public static void main(String[] args) {
SpringApplication.run(FitapetApplication.class, args);
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/com/kcy/fitapet/api/page/api/MainPageApi.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/com/kcy/fitapet/api/page/dto/MainPageReq.java

This file was deleted.

This file was deleted.

23 changes: 14 additions & 9 deletions src/main/java/com/kcy/fitapet/domain/care/domain/Care.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.kcy.fitapet.domain.care.domain;

import com.kcy.fitapet.domain.care.type.CareType;
import com.kcy.fitapet.domain.care.type.CareTypeConverter;
import com.kcy.fitapet.domain.care.type.WeekType;
import com.kcy.fitapet.domain.care.type.WeekTypeConverter;
import com.kcy.fitapet.domain.member.domain.Member;
import com.kcy.fitapet.domain.model.Auditable;
import com.kcy.fitapet.domain.pet.domain.PetCare;
import jakarta.persistence.*;
import lombok.*;

import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -21,9 +22,12 @@ public class Care extends Auditable {
private Long id;
@Column(name = "care_name")
private String careName;
@Column(name = "dtype")
@Convert(converter = CareTypeConverter.class)
private CareType dtype;
@Column(name = "week")
@Convert(converter = WeekTypeConverter.class)
private WeekType week;
@Column(name = "limit_time")
@Temporal(TemporalType.TIME)
private LocalTime limitTime;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "author_id", updatable = false)
Expand All @@ -37,15 +41,16 @@ public class Care extends Auditable {
private List<CareDetail> careDetails = new ArrayList<>();

@Builder
private Care(String careName, CareType dtype) {
private Care(String careName, WeekType week, LocalTime limitTime) {
this.careName = careName;
this.dtype = dtype;
this.week = week;
this.limitTime = limitTime;
}

public static Care of(String careName, CareType dtype) {
public static Care of(String careName, WeekType week) {
return Care.builder()
.careName(careName)
.dtype(dtype)
.week(week)
.build();
}
}
37 changes: 11 additions & 26 deletions src/main/java/com/kcy/fitapet/domain/care/domain/CareDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;

@Entity
@Table(name = "CARE_DETAIL")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@ToString(of = {"careDetailName", "careTime", "limitTime", "isDone", "clearedAt"})
public class CareDetail extends Auditable {
@Id @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
Expand All @@ -23,47 +23,32 @@ public class CareDetail extends Auditable {
@Temporal(TemporalType.TIME)
@Column(name = "care_time")
private LocalTime careTime;
@Temporal(TemporalType.TIME)
@Column(name = "limit_time")
private LocalTime limitTime;
@Column(name = "is_done") @ColumnDefault("false")
private Boolean isDone;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "cleared_at")
private LocalDateTime clearedAt;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "care_id")
private Care care;
@OneToOne(mappedBy = "careDetail")
private DayOfWeek dayOfWeek;

@OneToMany(mappedBy = "careDetail")
private List<CareLog> careLogs;

@Builder
private CareDetail(String careDetailName, LocalTime careTime, LocalTime limitTime, Boolean isDone, LocalDateTime clearedAt) {
private CareDetail(String careDetailName, LocalTime careTime) {
this.careDetailName = careDetailName;
this.careTime = careTime;
this.limitTime = limitTime;
this.isDone = isDone;
this.clearedAt = clearedAt;
}

public static CareDetail of(String careDetailName, LocalTime careTime, LocalTime limitTime, Boolean isDone, LocalDateTime clearedAt) {
return CareDetail.builder()
.careDetailName(careDetailName)
.careTime(careTime)
.limitTime(limitTime)
.isDone(isDone)
.clearedAt(clearedAt)
.build();
}

public void isDone() {
this.isDone = Boolean.TRUE;
this.clearedAt = LocalDateTime.now();
}

public void cancelDone() {
this.isDone = Boolean.FALSE;
this.clearedAt = null;
@Override public String toString() {
return "CareDetail{" +
"id=" + id +
", careDetailName='" + careDetailName + '\'' +
", careTime=" + careTime +
'}';
}
}
35 changes: 35 additions & 0 deletions src/main/java/com/kcy/fitapet/domain/care/domain/CareLog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.kcy.fitapet.domain.care.domain;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

@Entity
@Table(name = "CARE_LOG")
@Getter
@EntityListeners(AuditingEntityListener.class)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class CareLog {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@CreatedDate
private LocalDateTime createdAt;

@ManyToOne
@JoinColumn(name = "care_detail_id")
private CareDetail careDetail;

private CareLog(CareDetail careDetail) {
this.careDetail = careDetail;
}

public static CareLog of(CareDetail careDetail) {
return new CareLog(careDetail);
}
}
54 changes: 0 additions & 54 deletions src/main/java/com/kcy/fitapet/domain/care/domain/DayOfWeek.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
import static java.util.stream.Collectors.toMap;

@RequiredArgsConstructor
public enum CareType implements LegacyCommonType {
DAILY("1", "D"),
WEEKLY("2", "W");
public enum WeekType implements LegacyCommonType {
MON("1", "์›”"),
TUE("2", "ํ™”"),
WED("3", "์ˆ˜"),
THU("4", "๋ชฉ"),
FRI("5", "๊ธˆ"),
SAT("6", "ํ† "),
SUN("7", "์ผ");

private final String code;
private final String type;

private static final Map<String, CareType> stringToEnum =
private static final Map<String, WeekType> stringToEnum =
Stream.of(values()).collect(toMap(Object::toString, e -> e));

@Override public String getCode() {
Expand All @@ -29,7 +34,7 @@ public enum CareType implements LegacyCommonType {
}

@JsonCreator
public static CareType fromString(String type) {
public static WeekType fromString(String type) {
return stringToEnum.get(type.toUpperCase());
}
@Override public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import jakarta.persistence.Converter;

@Converter
public class CareTypeConverter extends AbstractLegacyEnumAttributeConverter<CareType> {
public class WeekTypeConverter extends AbstractLegacyEnumAttributeConverter<WeekType> {
private static final String ENUM_NAME = "๋Œ๋ด„ํƒ€์ž…";

public CareTypeConverter() {
super(CareType.class, false, ENUM_NAME);
public WeekTypeConverter() {
super(WeekType.class, false, ENUM_NAME);
}
}
Loading

0 comments on commit d875b32

Please sign in to comment.