-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
7
src/main/java/side/onetime/repository/ScheduleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { | ||
} |