best way to create schema with gql

This commit is contained in:
José Salazar
2025-11-17 19:53:58 -05:00
parent 28b50f81a4
commit b3ff3f14ed
6 changed files with 58 additions and 56 deletions

View File

@@ -1,6 +1,3 @@
scalar UUID
scalar Timestamp
scalar JSON
enum EventStatus {
DRAFT
@@ -28,47 +25,14 @@ type Event @table(name: "events") {
vendorId: UUID
status: EventStatus!
date: Timestamp!
shifts: JSON @col(dataType: "jsonb")
shifts: String @col(dataType: "jsonb")
total: Float
requested: Int
assignedStaff: JSON @col(dataType: "jsonb")
createdDate: Timestamp @default(expr: "now()")
updatedDate: Timestamp @updatedAt
assignedStaff: String @col(dataType: "jsonb")
createdDate: Timestamp @default(expr: "request.time")
updatedDate: Timestamp @default(expr: "request.time")
createdBy: String
}
input CreateEventInput {
eventName: String!
isRecurring: Boolean!
recurrenceType: RecurrenceType
businessId: UUID!
vendorId: UUID
status: EventStatus!
date: Timestamp!
shifts: JSON
total: Float
requested: Int
assignedStaff: JSON
}
query listEvents @auth(level: USER) {
events {
id
eventName
status
date
isRecurring
recurrenceType
businessId
vendorId
total
requested
}
}
mutation createEvent($input: CreateEventInput!) @auth(level: USER) {
event_insert(data: $input) {
id
}
}