Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
devyubin committed Sep 4, 2023
2 parents 6c39957 + 418a119 commit 3a2691b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

@Configuration
public class SpringConfig {

private final ScheduleRepository scheduleRepository;

public SpringConfig(ScheduleRepository scheduleRepository) {this.scheduleRepository = scheduleRepository;}
public SpringConfig(ScheduleRepository scheduleRepository){
this.scheduleRepository = scheduleRepository;
}

@Bean
public ScheduleService scheduleService(){
return new ScheduleService(scheduleRepository);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.haemil.backend.schedule.dto;

import com.haemil.backend.schedule.entity.RepeatType;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalTime;

//schedule에 데이터를 넣을 때의 입력 요청 값을 받음
@NoArgsConstructor
@Getter
public class ScheduleRequestDto {

private Long id;

private LocalDate localDate;

private DayOfWeek dayOfWeek;

private LocalTime time;

private String content;

private Boolean done;

private String place;

private String medicine;

private RepeatType repeatType;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.haemil.backend.schedule.entity;


public enum RepeatType {
DAILY,
WEEKLY,
MONTHLY,
NONE
}
31 changes: 11 additions & 20 deletions src/main/java/com/haemil/backend/schedule/entity/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@
@Getter
@NoArgsConstructor
public class Schedule {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

//일정 생성(year, month, day)
@Column(name = "creationDate", nullable = false)
private LocalDate creationDate;

//일정 수정(year, month, day)
@Column(name = "modificationDate", nullable = false)
private LocalDate modificationDate;

//일정의 실제 날짜 정보(year, month, day)
@Column(nullable = false)
private LocalDate localDate;
Expand All @@ -43,24 +36,22 @@ public class Schedule {
@Column(nullable = false, length = 100)
private String content;

//일정 완료 여부
@Column(nullable = false)
private Boolean done;

//장소
@Column(nullable = true, length = 50)
private String place;

//중요 일정
@Column(nullable = false)
private Boolean important_schedule;
//
@Column(nullable = true, length = 50)
private String medicine;

//고정 일정
//반복 routine
@Enumerated(value = EnumType.STRING)
@Column(nullable = false)
private Boolean fixed_schedule;

public Boolean isImportant(){
return important_schedule;
}
public Boolean isFixed(){
return fixed_schedule;
}
private RepeatType repeatType;

private String mapUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@
public class ScheduleService {
private final ScheduleRepository scheduleRepository;

public ScheduleService(ScheduleRepository scheduleRepository){
public ScheduleService(ScheduleRepository scheduleRepository) {
this.scheduleRepository = scheduleRepository;
}

//일정 생성
public ScheduleResponseDto createSchedule(ScheduleRequestDto scheduleRequestDto) throws BaseException {
try {
Expand Down Expand Up @@ -139,13 +140,6 @@ public Long deleteSchedule(Long scheduleId) throws BaseException {
}
}

//오늘에 해당하는 일정 조회
public List<Schedule> getTodaySchedules(){
LocalDate today = LocalDate.now();
DayOfWeek dayOfWeek = today.getDayOfWeek();
return scheduleRepository.findByLocalDate(today);
}

//일정 수정
@Transactional
public Schedule updateSchedule(Long id, ScheduleRequestDto requestDto) {
Expand Down

0 comments on commit 3a2691b

Please sign in to comment.