feat: 完善课程订阅
This commit is contained in:
@@ -38,6 +38,7 @@ enum TimeSlotSource {
|
||||
}
|
||||
|
||||
enum BookingStatus {
|
||||
PENDING_CONFIRMATION
|
||||
CONFIRMED
|
||||
CANCELLED
|
||||
COMPLETED
|
||||
@@ -152,8 +153,11 @@ model Booking {
|
||||
userId String @map("user_id")
|
||||
timeSlotId String @map("time_slot_id")
|
||||
membershipId String @map("membership_id")
|
||||
status BookingStatus @default(CONFIRMED)
|
||||
status BookingStatus @default(PENDING_CONFIRMATION)
|
||||
cancelledAt DateTime? @map("cancelled_at")
|
||||
confirmedAt DateTime? @map("confirmed_at")
|
||||
completedAt DateTime? @map("completed_at")
|
||||
operatorId String? @map("operator_id")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -161,12 +165,29 @@ model Booking {
|
||||
timeSlot TimeSlot @relation(fields: [timeSlotId], references: [id])
|
||||
membership Membership @relation(fields: [membershipId], references: [id])
|
||||
|
||||
statusHistory BookingStatusHistory[]
|
||||
|
||||
@@unique([userId, timeSlotId])
|
||||
@@index([userId])
|
||||
@@index([status])
|
||||
@@map("bookings")
|
||||
}
|
||||
|
||||
model BookingStatusHistory {
|
||||
id String @id @default(uuid())
|
||||
bookingId String @map("booking_id")
|
||||
fromStatus String? @map("from_status")
|
||||
toStatus String @map("to_status")
|
||||
operatorId String? @map("operator_id")
|
||||
remark String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
booking Booking @relation(fields: [bookingId], references: [id])
|
||||
|
||||
@@index([bookingId])
|
||||
@@map("booking_status_history")
|
||||
}
|
||||
|
||||
model Order {
|
||||
id String @id @default(uuid())
|
||||
userId String @map("user_id")
|
||||
|
||||
Reference in New Issue
Block a user