diff --git a/dataconnect/connector/business/mutations.gql b/dataconnect/connector/business/mutations.gql new file mode 100644 index 00000000..9be33782 --- /dev/null +++ b/dataconnect/connector/business/mutations.gql @@ -0,0 +1,47 @@ +mutation CreateBusiness( + $businessName: String!, + $contactName: String!, + $email: String, + $sector: BusinessSector, + $rateGroup: BusinessRateGroup!, + $status: BusinessStatus +) @auth(level: USER) { + business_insert( + data: { + businessName: $businessName + contactName: $contactName + email: $email + sector: $sector + rateGroup: $rateGroup + status: $status + } + ) +} + +mutation UpdateBusiness( + $id: UUID!, + $businessName: String, + $contactName: String, + $email: String, + $sector: BusinessSector, + $rateGroup: BusinessRateGroup, + $status: BusinessStatus +) @auth(level: USER) { + business_update( + id: $id, + data: { + businessName: $businessName + contactName: $contactName + email: $email + sector: $sector + rateGroup: $rateGroup + status: $status + } + ) +} + +mutation DeleteBusiness( + $id: UUID! +) @auth(level: USER) { + business_delete(id: $id) +} diff --git a/dataconnect/connector/business/queries.gql b/dataconnect/connector/business/queries.gql new file mode 100644 index 00000000..3b721dc8 --- /dev/null +++ b/dataconnect/connector/business/queries.gql @@ -0,0 +1,51 @@ +query listBusiness @auth(level: USER) { + business { + id + businessName + contactName + email + sector + rateGroup + status + } +} + +query getBusinessById( + $id: UUID! +) @auth(level: USER) { + business(id: $id) { + id + businessName + contactName + email + sector + rateGroup + status + } +} + +query filterBusiness( + $businessName: String, + $contactName: String, + $sector: BusinessSector, + $rateGroup: BusinessRateGroup, + $status: BusinessStatus +) @auth(level: USER) { + business( + where: { + businessName: { eq: $businessName } + contactName: { eq: $contactName } + sector: { eq: $sector } + rateGroup: { eq: $rateGroup } + status: { eq: $status } + } + ) { + id + businessName + contactName + email + sector + rateGroup + status + } +} diff --git a/dataconnect/schema/business.gql b/dataconnect/schema/business.gql new file mode 100644 index 00000000..b517aaf6 --- /dev/null +++ b/dataconnect/schema/business.gql @@ -0,0 +1,34 @@ +enum BusinessSector { + BON_APPETIT + EUREST + ARAMARK + EPICUREAN_GROUP + CHARTWELLS + OTHER +} + +enum BusinessRateGroup { + STANDARD + PREMIUM + ENTERPRISE + CUSTOM +} + +enum BusinessStatus { + ACTIVE + INACTIVE + PENDING +} + +type Business @table(name: "business") { + id: UUID! @default(expr: "uuidV4()") + businessName: String! + contactName: String! + email: String + sector: BusinessSector + rateGroup: BusinessRateGroup! + status: BusinessStatus + createdDate: Timestamp @default(expr: "request.time") + updatedDate: Timestamp @default(expr: "request.time") + createdBy: String @default(expr: "auth.uid") +}