From 2c130a413a0610f8824d9e51243b4e5830588dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:58:03 -0500 Subject: [PATCH] new event schema with full crud --- dataconnect/connector/event/mutations.gql | 135 +++++++++++++++++++++- dataconnect/connector/event/queries.gql | 135 +++++++++++++++++++++- dataconnect/schema/event.gql | 34 +++++- 3 files changed, 299 insertions(+), 5 deletions(-) diff --git a/dataconnect/connector/event/mutations.gql b/dataconnect/connector/event/mutations.gql index a5a4aa22..8f1e048f 100644 --- a/dataconnect/connector/event/mutations.gql +++ b/dataconnect/connector/event/mutations.gql @@ -1,29 +1,160 @@ mutation CreateEvent( $eventName: String!, - $isRecurring: Boolean!, + $isRapid: Boolean, + $isRecurring: Boolean, + $isMultiDay: Boolean, $recurrenceType: RecurrenceType, + $recurrenceStartDate: Timestamp, + $recurrenceEndDate: Timestamp, + $scatterDates: String, + $multiDayStartDate: Timestamp, + $multiDayEndDate: Timestamp, + $bufferTimeBefore: Float, + $bufferTimeAfter: Float, + $conflictDetectionEnabled: Boolean, + $detectedConflicts: String, $businessId: UUID!, + $businessName: String, $vendorId: UUID, + $vendorName: String, + $hub: String, + $eventLocation: String, + $contractType: ContractType, + $poReference: String, $status: EventStatus!, $date: Timestamp!, $shifts: String, + $addons: String, $total: Float, + $clientName: String, + $clientEmail: String, + $clientPhone: String, + $invoiceId: UUID, + $notes: String, $requested: Int, $assignedStaff: String ) @auth(level: USER) { event_insert( data: { eventName: $eventName + isRapid: $isRapid isRecurring: $isRecurring + isMultiDay: $isMultiDay recurrenceType: $recurrenceType + recurrenceStartDate: $recurrenceStartDate + recurrenceEndDate: $recurrenceEndDate + scatterDates: $scatterDates + multiDayStartDate: $multiDayStartDate + multiDayEndDate: $multiDayEndDate + bufferTimeBefore: $bufferTimeBefore + bufferTimeAfter: $bufferTimeAfter + conflictDetectionEnabled: $conflictDetectionEnabled + detectedConflicts: $detectedConflicts businessId: $businessId + businessName: $businessName vendorId: $vendorId + vendorName: $vendorName + hub: $hub + eventLocation: $eventLocation + contractType: $contractType + poReference: $poReference status: $status date: $date shifts: $shifts + addons: $addons total: $total + clientName: $clientName + clientEmail: $clientEmail + clientPhone: $clientPhone + invoiceId: $invoiceId + notes: $notes requested: $requested assignedStaff: $assignedStaff } ) -} \ No newline at end of file +} + + +mutation UpdateEvent( + $id: UUID!, + $eventName: String, + $isRapid: Boolean, + $isRecurring: Boolean, + $isMultiDay: Boolean, + $recurrenceType: RecurrenceType, + $recurrenceStartDate: Timestamp, + $recurrenceEndDate: Timestamp, + $scatterDates: String, + $multiDayStartDate: Timestamp, + $multiDayEndDate: Timestamp, + $bufferTimeBefore: Float, + $bufferTimeAfter: Float, + $conflictDetectionEnabled: Boolean, + $detectedConflicts: String, + $businessId: UUID, + $businessName: String, + $vendorId: UUID, + $vendorName: String, + $hub: String, + $eventLocation: String, + $contractType: ContractType, + $poReference: String, + $status: EventStatus, + $date: Timestamp, + $shifts: String, + $addons: String, + $total: Float, + $clientName: String, + $clientEmail: String, + $clientPhone: String, + $invoiceId: UUID, + $notes: String, + $requested: Int, + $assignedStaff: String +) @auth(level: USER) { + event_update( + id: $id, + data: { + eventName: $eventName + isRapid: $isRapid + isRecurring: $isRecurring + isMultiDay: $isMultiDay + recurrenceType: $recurrenceType + recurrenceStartDate: $recurrenceStartDate + recurrenceEndDate: $recurrenceEndDate + scatterDates: $scatterDates + multiDayStartDate: $multiDayStartDate + multiDayEndDate: $multiDayEndDate + bufferTimeBefore: $bufferTimeBefore + bufferTimeAfter: $bufferTimeAfter + conflictDetectionEnabled: $conflictDetectionEnabled + detectedConflicts: $detectedConflicts + businessId: $businessId + businessName: $businessName + vendorId: $vendorId + vendorName: $vendorName + hub: $hub + eventLocation: $eventLocation + contractType: $contractType + poReference: $poReference + status: $status + date: $date + shifts: $shifts + addons: $addons + total: $total + clientName: $clientName + clientEmail: $clientEmail + clientPhone: $clientPhone + invoiceId: $invoiceId + notes: $notes + requested: $requested + assignedStaff: $assignedStaff + } + ) +} + +mutation DeleteEvent( + $id: UUID! +) @auth(level: USER) { + event_delete(id: $id) +} diff --git a/dataconnect/connector/event/queries.gql b/dataconnect/connector/event/queries.gql index 1c7103d5..c8c1c98b 100644 --- a/dataconnect/connector/event/queries.gql +++ b/dataconnect/connector/event/queries.gql @@ -4,11 +4,144 @@ query listEvents @auth(level: USER) { eventName status date + isRapid isRecurring + isMultiDay recurrenceType + recurrenceStartDate + recurrenceEndDate + scatterDates + multiDayStartDate + multiDayEndDate + bufferTimeBefore + bufferTimeAfter + conflictDetectionEnabled + detectedConflicts businessId + businessName vendorId + vendorName + hub + eventLocation + contractType + poReference + shifts + addons total + clientName + clientEmail + clientPhone + invoiceId + notes requested + assignedStaff } -} \ No newline at end of file +} + +query getEventById( + $id: UUID! +) @auth(level: USER) { + event(id: $id) { + id + eventName + status + date + isRapid + isRecurring + isMultiDay + recurrenceType + recurrenceStartDate + recurrenceEndDate + scatterDates + multiDayStartDate + multiDayEndDate + bufferTimeBefore + bufferTimeAfter + conflictDetectionEnabled + detectedConflicts + businessId + businessName + vendorId + vendorName + hub + eventLocation + contractType + poReference + shifts + addons + total + clientName + clientEmail + clientPhone + invoiceId + notes + requested + assignedStaff + } +} + +query filterEvents( + $status: EventStatus, + $businessId: UUID, + $vendorId: UUID, + $isRecurring: Boolean, + $isRapid: Boolean, + $isMultiDay: Boolean, + $recurrenceType: RecurrenceType, + $date: Timestamp, + $hub: String, + $eventLocation: String, + $contractType: ContractType, + $clientEmail: String +) @auth(level: USER) { + events(where: { + status: { eq: $status } + businessId: { eq: $businessId } + vendorId: { eq: $vendorId } + isRecurring: { eq: $isRecurring } + isRapid: { eq: $isRapid } + isMultiDay: { eq: $isMultiDay } + recurrenceType: { eq: $recurrenceType } + date: { eq: $date } + hub: { eq: $hub } + eventLocation: { eq: $eventLocation } + contractType: { eq: $contractType } + clientEmail: { eq: $clientEmail } + }) { + id + eventName + status + date + isRapid + isRecurring + isMultiDay + recurrenceType + recurrenceStartDate + recurrenceEndDate + scatterDates + multiDayStartDate + multiDayEndDate + bufferTimeBefore + bufferTimeAfter + conflictDetectionEnabled + detectedConflicts + businessId + businessName + vendorId + vendorName + hub + eventLocation + contractType + poReference + shifts + addons + total + clientName + clientEmail + clientPhone + invoiceId + notes + requested + assignedStaff + } +} diff --git a/dataconnect/schema/event.gql b/dataconnect/schema/event.gql index 96d4f67a..1767fbc2 100644 --- a/dataconnect/schema/event.gql +++ b/dataconnect/schema/event.gql @@ -15,19 +15,49 @@ enum RecurrenceType { SCATTER } +#enums cant start by a number, reason of _1099 +enum ContractType { + W2 + _1099 + TEMP + CONTRACT +} + type Event @table(name: "events") { id: UUID! @default(expr: "uuidV4()") eventName: String! - isRecurring: Boolean! + isRapid: Boolean @default(expr: "false") + isRecurring: Boolean @default(expr: "false") + isMultiDay: Boolean @default(expr: "false") recurrenceType: RecurrenceType + recurrenceStartDate: Timestamp + recurrenceEndDate: Timestamp + scatterDates: String + multiDayStartDate: Timestamp + multiDayEndDate: Timestamp + bufferTimeBefore: Float @default(expr: "0") + bufferTimeAfter: Float @default(expr: "0") + conflictDetectionEnabled: Boolean @default(expr: "true") + detectedConflicts: String businessId: UUID! + businessName: String vendorId: UUID + vendorName: Stringhub: String + eventLocation: String + contractType: ContractType + poReference: String status: EventStatus! date: Timestamp! shifts: String + addons: String total: Float - requested: Int + clientName: String + clientEmail: String + clientPhone: String + invoiceId: UUID + notes: String + requested: Int @default(expr: "0") assignedStaff: String createdDate: Timestamp @default(expr: "request.time") updatedDate: Timestamp @default(expr: "request.time")