best way to create schema with gql
This commit is contained in:
8
dataconnect/connector/connector.yaml
Normal file
8
dataconnect/connector/connector.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
connectorId: krow-connector
|
||||||
|
generate:
|
||||||
|
javascriptSdk:
|
||||||
|
- outputDir: ../../frontend-web/src/dataconnect-generated
|
||||||
|
package: "@dataconnect/generated"
|
||||||
|
packageJsonDir: ../../frontend-web
|
||||||
|
react: true
|
||||||
|
angular: false
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
specVersion: "v1"
|
|
||||||
serviceId: "krow-workforce"
|
|
||||||
location: "us-central1"
|
|
||||||
schema:
|
|
||||||
source: "./schema"
|
|
||||||
datasource:
|
|
||||||
postgresql:
|
|
||||||
database: "fdcdb"
|
|
||||||
cloudSql:
|
|
||||||
instanceId: "krow-workforce-fdc"
|
|
||||||
# schemaValidation: "STRICT" # STRICT mode makes Postgres schema match Data Connect exactly.
|
|
||||||
# schemaValidation: "COMPATIBLE" # COMPATIBLE mode makes Postgres schema compatible with Data Connect.
|
|
||||||
connectorDirs: ["./example"]
|
|
||||||
29
dataconnect/connector/event/mutations.gql
Normal file
29
dataconnect/connector/event/mutations.gql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
mutation CreateEvent(
|
||||||
|
$eventName: String!,
|
||||||
|
$isRecurring: Boolean!,
|
||||||
|
$recurrenceType: RecurrenceType,
|
||||||
|
$businessId: UUID!,
|
||||||
|
$vendorId: UUID,
|
||||||
|
$status: EventStatus!,
|
||||||
|
$date: Timestamp!,
|
||||||
|
$shifts: String,
|
||||||
|
$total: Float,
|
||||||
|
$requested: Int,
|
||||||
|
$assignedStaff: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
event_insert(
|
||||||
|
data: {
|
||||||
|
eventName: $eventName
|
||||||
|
isRecurring: $isRecurring
|
||||||
|
recurrenceType: $recurrenceType
|
||||||
|
businessId: $businessId
|
||||||
|
vendorId: $vendorId
|
||||||
|
status: $status
|
||||||
|
date: $date
|
||||||
|
shifts: $shifts
|
||||||
|
total: $total
|
||||||
|
requested: $requested
|
||||||
|
assignedStaff: $assignedStaff
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
14
dataconnect/connector/event/queries.gql
Normal file
14
dataconnect/connector/event/queries.gql
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
query listEvents @auth(level: USER) {
|
||||||
|
events {
|
||||||
|
id
|
||||||
|
eventName
|
||||||
|
status
|
||||||
|
date
|
||||||
|
isRecurring
|
||||||
|
recurrenceType
|
||||||
|
businessId
|
||||||
|
vendorId
|
||||||
|
total
|
||||||
|
requested
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
specVersion: "v1"
|
specVersion: "v1"
|
||||||
serviceId: "krow-workforce"
|
serviceId: "krow-workforce-db"
|
||||||
location: "us-central1"
|
location: "us-central1"
|
||||||
schema:
|
schema:
|
||||||
source: "./schema"
|
source: "./schema"
|
||||||
datasource:
|
datasource:
|
||||||
postgresql:
|
postgresql:
|
||||||
database: "fdcdb"
|
database: "krow_db"
|
||||||
cloudSql:
|
cloudSql:
|
||||||
instanceId: "krow-workforce-fdc"
|
instanceId: "krow-sql"
|
||||||
# schemaValidation: "STRICT" # STRICT mode makes Postgres schema match Data Connect exactly.
|
# schemaValidation: "STRICT" # STRICT mode makes Postgres schema match Data Connect exactly.
|
||||||
# schemaValidation: "COMPATIBLE" # COMPATIBLE mode makes Postgres schema compatible with Data Connect.
|
# schemaValidation: "COMPATIBLE" # COMPATIBLE mode makes Postgres schema compatible with Data Connect.
|
||||||
connectorDirs: ["./connector"]
|
connectorDirs: ["./connector"]
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
scalar UUID
|
|
||||||
scalar Timestamp
|
|
||||||
scalar JSON
|
|
||||||
|
|
||||||
enum EventStatus {
|
enum EventStatus {
|
||||||
DRAFT
|
DRAFT
|
||||||
@@ -28,47 +25,14 @@ type Event @table(name: "events") {
|
|||||||
vendorId: UUID
|
vendorId: UUID
|
||||||
status: EventStatus!
|
status: EventStatus!
|
||||||
date: Timestamp!
|
date: Timestamp!
|
||||||
shifts: JSON @col(dataType: "jsonb")
|
shifts: String @col(dataType: "jsonb")
|
||||||
total: Float
|
total: Float
|
||||||
requested: Int
|
requested: Int
|
||||||
assignedStaff: JSON @col(dataType: "jsonb")
|
assignedStaff: String @col(dataType: "jsonb")
|
||||||
createdDate: Timestamp @default(expr: "now()")
|
createdDate: Timestamp @default(expr: "request.time")
|
||||||
updatedDate: Timestamp @updatedAt
|
updatedDate: Timestamp @default(expr: "request.time")
|
||||||
createdBy: String
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user