Skip to content

Commit

Permalink
[Feat] : Schedule 엔티티 & 레포지토리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Aug 14, 2024
1 parent fb505b7 commit 11f2435
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/main/java/side/onetime/domain/Schedule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package side.onetime.domain;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import side.onetime.global.common.dao.BaseEntity;

import java.time.LocalDateTime;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Table(name = "schedules")
public class Schedule extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "schedules_id")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "members_id", foreignKey = @ForeignKey(name = "schedules_fk_members_id"))
private Member member;

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

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

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

@Column(name = "is_selected", nullable = false)
private Boolean isSelected;

@Builder
public Schedule(Member member, LocalDateTime date, String day, LocalDateTime time) {
this.member = member;
this.date = date;
this.day = day;
this.time = time;
this.isSelected = false;
}

public void updateIsSelected(boolean isSelected) {
this.isSelected = isSelected;
}
}
7 changes: 7 additions & 0 deletions src/main/java/side/onetime/repository/ScheduleRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package side.onetime.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import side.onetime.domain.Schedule;

public interface ScheduleRepository extends JpaRepository<Schedule,Long> {
}

0 comments on commit 11f2435

Please sign in to comment.