moving event.gql to dataconnect new folder

This commit is contained in:
José Salazar
2025-11-17 15:24:03 -05:00
parent 455713acef
commit 28b50f81a4
4 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1,74 @@
scalar UUID
scalar Timestamp
scalar JSON
enum EventStatus {
DRAFT
ACTIVE
PENDING
ASSIGNED
CONFIRMED
COMPLETED
CANCELED
}
enum RecurrenceType {
SINGLE
DATE_RANGE
SCATTER
}
type Event @table(name: "events") {
id: UUID! @default(expr: "uuidV4()")
eventName: String!
isRecurring: Boolean!
recurrenceType: RecurrenceType
businessId: UUID!
vendorId: UUID
status: EventStatus!
date: Timestamp!
shifts: JSON @col(dataType: "jsonb")
total: Float
requested: Int
assignedStaff: JSON @col(dataType: "jsonb")
createdDate: Timestamp @default(expr: "now()")
updatedDate: Timestamp @updatedAt
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
}
}

View File

@@ -1,52 +0,0 @@
# Example schema for simple movie review app
# User table is keyed by Firebase Auth UID.
type User @table {
# `@default(expr: "auth.uid")` sets it to Firebase Auth UID during insert and upsert.
id: String! @default(expr: "auth.uid")
username: String! @col(dataType: "varchar(50)")
# The `user: User!` field in the Review table generates the following one-to-many query field.
# reviews_on_user: [Review!]!
# The `Review` join table the following many-to-many query field.
# movies_via_Review: [Movie!]!
}
# Movie is keyed by a randomly generated UUID.
type Movie @table {
# If you do not pass a 'key' to `@table`, Data Connect automatically adds the following 'id' column.
# Feel free to uncomment and customize it.
# id: UUID! @default(expr: "uuidV4()")
title: String!
imageUrl: String!
genre: String
}
# MovieMetadata is a metadata attached to a Movie.
# Movie <-> MovieMetadata is a one-to-one relationship
type MovieMetadata @table {
# @unique ensures each Movie can only one MovieMetadata.
movie: Movie! @unique
# The movie field adds the following foreign key field. Feel free to uncomment and customize it.
# movieId: UUID!
rating: Float
releaseYear: Int
description: String
}
# Reviews is a join table between User and Movie.
# It has a composite primary keys `userUid` and `movieId`.
# A user can leave reviews for many movies. A movie can have reviews from many users.
# User <-> Review is a one-to-many relationship
# Movie <-> Review is a one-to-many relationship
# Movie <-> User is a many-to-many relationship
type Review @table(name: "Reviews", key: ["movie", "user"]) {
user: User!
# The user field adds the following foreign key field. Feel free to uncomment and customize it.
# userUid: String!
movie: Movie!
# The movie field adds the following foreign key field. Feel free to uncomment and customize it.
# movieId: UUID!
rating: Int
reviewText: String
reviewDate: Date! @default(expr: "request.time")
}