generated from pricelees/issue-pr-template
feat: 새로운 예약 / 취소된 예약 Schema & Entity 정의
This commit is contained in:
parent
04d1510bd1
commit
0ac0277714
@ -0,0 +1,27 @@
|
|||||||
|
package roomescape.reservation_v2.infrastructure.persistence
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.EnumType
|
||||||
|
import jakarta.persistence.Enumerated
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
import roomescape.common.entity.BaseEntityV2
|
||||||
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "canceled_reservation")
|
||||||
|
class CanceledReservationEntity(
|
||||||
|
id: Long,
|
||||||
|
|
||||||
|
val reservationId: Long,
|
||||||
|
val canceledBy: Long,
|
||||||
|
val cancelReason: String,
|
||||||
|
val canceledAt: LocalDateTime,
|
||||||
|
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
val status: CanceledReservationStatus,
|
||||||
|
|
||||||
|
): BaseEntityV2(id)
|
||||||
|
|
||||||
|
enum class CanceledReservationStatus {
|
||||||
|
PROCESSING, FAILED, COMPLETED
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
package roomescape.reservation_v2.infrastructure.persistence
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
interface CanceledReservationRepository: JpaRepository<CanceledReservationEntity, Long>
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package roomescape.reservation_v2.infrastructure.persistence
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.EnumType
|
||||||
|
import jakarta.persistence.Enumerated
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
import roomescape.common.entity.AuditingBaseEntity
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "reservation")
|
||||||
|
class ReservationEntityV2(
|
||||||
|
id: Long,
|
||||||
|
|
||||||
|
val memberId: Long,
|
||||||
|
val scheduleId: Long,
|
||||||
|
val reserverName: String,
|
||||||
|
val reserverContact: String,
|
||||||
|
val participantCount: Short,
|
||||||
|
val requirement: String,
|
||||||
|
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
var status: ReservationStatusV2,
|
||||||
|
|
||||||
|
): AuditingBaseEntity(id) {
|
||||||
|
fun confirm() { this.status = ReservationStatusV2.CONFIRMED }
|
||||||
|
fun fail() { this.status = ReservationStatusV2.FAILED }
|
||||||
|
fun cancel() { this.status = ReservationStatusV2.CANCELED }
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ReservationStatusV2 {
|
||||||
|
PENDING, CONFIRMED, CANCELED, FAILED, EXPIRED
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package roomescape.reservation_v2.infrastructure.persistence
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
interface ReservationRepositoryV2 : JpaRepository<ReservationEntityV2, Long> {
|
||||||
|
|
||||||
|
fun findAllByMemberId(memberId: Long): List<ReservationEntityV2>
|
||||||
|
}
|
||||||
@ -88,6 +88,37 @@ create table if not exists reservations (
|
|||||||
constraint fk_reservations__timeId foreign key (time_id) references times (time_id)
|
constraint fk_reservations__timeId foreign key (time_id) references times (time_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table if not exists reservation (
|
||||||
|
id bigint primary key,
|
||||||
|
member_id bigint not null,
|
||||||
|
schedule_id bigint not null,
|
||||||
|
reserver_name varchar(30) not null,
|
||||||
|
reserver_contact varchar(30) not null,
|
||||||
|
participant_count smallint not null,
|
||||||
|
requirement varchar(255) not null,
|
||||||
|
status varchar(30) not null,
|
||||||
|
created_at timestamp not null,
|
||||||
|
created_by bigint not null,
|
||||||
|
updated_at timestamp not null,
|
||||||
|
updated_by bigint not null,
|
||||||
|
|
||||||
|
constraint fk_reservation__member_id foreign key (member_id) references members (member_id),
|
||||||
|
constraint fk_reservation__schedule_id foreign key (schedule_id) references schedule (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table if not exists canceled_reservation (
|
||||||
|
id bigint primary key,
|
||||||
|
reservation_id bigint not null,
|
||||||
|
canceled_by bigint not null,
|
||||||
|
cancel_reason varchar(50) not null,
|
||||||
|
canceled_at timestamp not null,
|
||||||
|
status varchar(30) not null,
|
||||||
|
|
||||||
|
constraint uk_canceled_reservations__reservation_id unique (reservation_id),
|
||||||
|
constraint fk_canceled_reservations__reservation_id foreign key (reservation_id) references reservation (id),
|
||||||
|
constraint fk_canceled_reservations__canceled_by foreign key (canceled_by) references members (member_id)
|
||||||
|
);
|
||||||
|
|
||||||
create table if not exists payments (
|
create table if not exists payments (
|
||||||
payment_id bigint primary key,
|
payment_id bigint primary key,
|
||||||
approved_at timestamp not null,
|
approved_at timestamp not null,
|
||||||
@ -127,7 +158,7 @@ create table if not exists payment1 (
|
|||||||
approved_at timestamp not null,
|
approved_at timestamp not null,
|
||||||
|
|
||||||
constraint uk_payment__reservationId unique (reservation_id),
|
constraint uk_payment__reservationId unique (reservation_id),
|
||||||
constraint fk_payment__reservationId foreign key (reservation_id) references reservations (reservation_id)
|
constraint fk_payment__reservationId foreign key (reservation_id) references reservation (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists payment_detail(
|
create table if not exists payment_detail(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user