new event schema with full crud
This commit is contained in:
@@ -1,29 +1,160 @@
|
|||||||
mutation CreateEvent(
|
mutation CreateEvent(
|
||||||
$eventName: String!,
|
$eventName: String!,
|
||||||
$isRecurring: Boolean!,
|
$isRapid: Boolean,
|
||||||
|
$isRecurring: Boolean,
|
||||||
|
$isMultiDay: Boolean,
|
||||||
$recurrenceType: RecurrenceType,
|
$recurrenceType: RecurrenceType,
|
||||||
|
$recurrenceStartDate: Timestamp,
|
||||||
|
$recurrenceEndDate: Timestamp,
|
||||||
|
$scatterDates: String,
|
||||||
|
$multiDayStartDate: Timestamp,
|
||||||
|
$multiDayEndDate: Timestamp,
|
||||||
|
$bufferTimeBefore: Float,
|
||||||
|
$bufferTimeAfter: Float,
|
||||||
|
$conflictDetectionEnabled: Boolean,
|
||||||
|
$detectedConflicts: String,
|
||||||
$businessId: UUID!,
|
$businessId: UUID!,
|
||||||
|
$businessName: String,
|
||||||
$vendorId: UUID,
|
$vendorId: UUID,
|
||||||
|
$vendorName: String,
|
||||||
|
$hub: String,
|
||||||
|
$eventLocation: String,
|
||||||
|
$contractType: ContractType,
|
||||||
|
$poReference: String,
|
||||||
$status: EventStatus!,
|
$status: EventStatus!,
|
||||||
$date: Timestamp!,
|
$date: Timestamp!,
|
||||||
$shifts: String,
|
$shifts: String,
|
||||||
|
$addons: String,
|
||||||
$total: Float,
|
$total: Float,
|
||||||
|
$clientName: String,
|
||||||
|
$clientEmail: String,
|
||||||
|
$clientPhone: String,
|
||||||
|
$invoiceId: UUID,
|
||||||
|
$notes: String,
|
||||||
$requested: Int,
|
$requested: Int,
|
||||||
$assignedStaff: String
|
$assignedStaff: String
|
||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
event_insert(
|
event_insert(
|
||||||
data: {
|
data: {
|
||||||
eventName: $eventName
|
eventName: $eventName
|
||||||
|
isRapid: $isRapid
|
||||||
isRecurring: $isRecurring
|
isRecurring: $isRecurring
|
||||||
|
isMultiDay: $isMultiDay
|
||||||
recurrenceType: $recurrenceType
|
recurrenceType: $recurrenceType
|
||||||
|
recurrenceStartDate: $recurrenceStartDate
|
||||||
|
recurrenceEndDate: $recurrenceEndDate
|
||||||
|
scatterDates: $scatterDates
|
||||||
|
multiDayStartDate: $multiDayStartDate
|
||||||
|
multiDayEndDate: $multiDayEndDate
|
||||||
|
bufferTimeBefore: $bufferTimeBefore
|
||||||
|
bufferTimeAfter: $bufferTimeAfter
|
||||||
|
conflictDetectionEnabled: $conflictDetectionEnabled
|
||||||
|
detectedConflicts: $detectedConflicts
|
||||||
businessId: $businessId
|
businessId: $businessId
|
||||||
|
businessName: $businessName
|
||||||
vendorId: $vendorId
|
vendorId: $vendorId
|
||||||
|
vendorName: $vendorName
|
||||||
|
hub: $hub
|
||||||
|
eventLocation: $eventLocation
|
||||||
|
contractType: $contractType
|
||||||
|
poReference: $poReference
|
||||||
status: $status
|
status: $status
|
||||||
date: $date
|
date: $date
|
||||||
shifts: $shifts
|
shifts: $shifts
|
||||||
|
addons: $addons
|
||||||
total: $total
|
total: $total
|
||||||
|
clientName: $clientName
|
||||||
|
clientEmail: $clientEmail
|
||||||
|
clientPhone: $clientPhone
|
||||||
|
invoiceId: $invoiceId
|
||||||
|
notes: $notes
|
||||||
requested: $requested
|
requested: $requested
|
||||||
assignedStaff: $assignedStaff
|
assignedStaff: $assignedStaff
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,11 +4,144 @@ query listEvents @auth(level: USER) {
|
|||||||
eventName
|
eventName
|
||||||
status
|
status
|
||||||
date
|
date
|
||||||
|
isRapid
|
||||||
isRecurring
|
isRecurring
|
||||||
|
isMultiDay
|
||||||
recurrenceType
|
recurrenceType
|
||||||
|
recurrenceStartDate
|
||||||
|
recurrenceEndDate
|
||||||
|
scatterDates
|
||||||
|
multiDayStartDate
|
||||||
|
multiDayEndDate
|
||||||
|
bufferTimeBefore
|
||||||
|
bufferTimeAfter
|
||||||
|
conflictDetectionEnabled
|
||||||
|
detectedConflicts
|
||||||
businessId
|
businessId
|
||||||
|
businessName
|
||||||
vendorId
|
vendorId
|
||||||
|
vendorName
|
||||||
|
hub
|
||||||
|
eventLocation
|
||||||
|
contractType
|
||||||
|
poReference
|
||||||
|
shifts
|
||||||
|
addons
|
||||||
total
|
total
|
||||||
|
clientName
|
||||||
|
clientEmail
|
||||||
|
clientPhone
|
||||||
|
invoiceId
|
||||||
|
notes
|
||||||
requested
|
requested
|
||||||
|
assignedStaff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,19 +15,49 @@ enum RecurrenceType {
|
|||||||
SCATTER
|
SCATTER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#enums cant start by a number, reason of _1099
|
||||||
|
enum ContractType {
|
||||||
|
W2
|
||||||
|
_1099
|
||||||
|
TEMP
|
||||||
|
CONTRACT
|
||||||
|
}
|
||||||
|
|
||||||
type Event @table(name: "events") {
|
type Event @table(name: "events") {
|
||||||
|
|
||||||
id: UUID! @default(expr: "uuidV4()")
|
id: UUID! @default(expr: "uuidV4()")
|
||||||
eventName: String!
|
eventName: String!
|
||||||
isRecurring: Boolean!
|
isRapid: Boolean @default(expr: "false")
|
||||||
|
isRecurring: Boolean @default(expr: "false")
|
||||||
|
isMultiDay: Boolean @default(expr: "false")
|
||||||
recurrenceType: RecurrenceType
|
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!
|
businessId: UUID!
|
||||||
|
businessName: String
|
||||||
vendorId: UUID
|
vendorId: UUID
|
||||||
|
vendorName: Stringhub: String
|
||||||
|
eventLocation: String
|
||||||
|
contractType: ContractType
|
||||||
|
poReference: String
|
||||||
status: EventStatus!
|
status: EventStatus!
|
||||||
date: Timestamp!
|
date: Timestamp!
|
||||||
shifts: String
|
shifts: String
|
||||||
|
addons: String
|
||||||
total: Float
|
total: Float
|
||||||
requested: Int
|
clientName: String
|
||||||
|
clientEmail: String
|
||||||
|
clientPhone: String
|
||||||
|
invoiceId: UUID
|
||||||
|
notes: String
|
||||||
|
requested: Int @default(expr: "0")
|
||||||
assignedStaff: String
|
assignedStaff: String
|
||||||
createdDate: Timestamp @default(expr: "request.time")
|
createdDate: Timestamp @default(expr: "request.time")
|
||||||
updatedDate: Timestamp @default(expr: "request.time")
|
updatedDate: Timestamp @default(expr: "request.time")
|
||||||
|
|||||||
Reference in New Issue
Block a user