Merge pull request #115 from Oloodi/114-backend-define-and-deploy-shift-schema
new shift entity
This commit is contained in:
39
dataconnect/connector/shift/mutations.gql
Normal file
39
dataconnect/connector/shift/mutations.gql
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
mutation CreateShift(
|
||||||
|
$shiftName: String!,
|
||||||
|
$startDate: Timestamp!,
|
||||||
|
$endDate: Timestamp,
|
||||||
|
$assignedStaff: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
shift_insert(
|
||||||
|
data: {
|
||||||
|
shiftName: $shiftName
|
||||||
|
startDate: $startDate
|
||||||
|
endDate: $endDate
|
||||||
|
assignedStaff: $assignedStaff
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation UpdateShift(
|
||||||
|
$id: UUID!,
|
||||||
|
$shiftName: String,
|
||||||
|
$startDate: Timestamp,
|
||||||
|
$endDate: Timestamp,
|
||||||
|
$assignedStaff: String
|
||||||
|
) @auth(level: USER) {
|
||||||
|
shift_update(
|
||||||
|
id: $id,
|
||||||
|
data: {
|
||||||
|
shiftName: $shiftName
|
||||||
|
startDate: $startDate
|
||||||
|
endDate: $endDate
|
||||||
|
assignedStaff: $assignedStaff
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation DeleteShift(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
shift_delete(id: $id)
|
||||||
|
}
|
||||||
44
dataconnect/connector/shift/queries.gql
Normal file
44
dataconnect/connector/shift/queries.gql
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
query listShift @auth(level: USER) {
|
||||||
|
shifts {
|
||||||
|
id
|
||||||
|
shiftName
|
||||||
|
startDate
|
||||||
|
endDate
|
||||||
|
assignedStaff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query getShiftById(
|
||||||
|
$id: UUID!
|
||||||
|
) @auth(level: USER) {
|
||||||
|
shift(id: $id) {
|
||||||
|
id
|
||||||
|
shiftName
|
||||||
|
startDate
|
||||||
|
endDate
|
||||||
|
assignedStaff
|
||||||
|
createdDate
|
||||||
|
updatedDate
|
||||||
|
createdBy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query filterShift(
|
||||||
|
$shiftName: String,
|
||||||
|
$startDate: Timestamp,
|
||||||
|
$endDate: Timestamp
|
||||||
|
) @auth(level: USER) {
|
||||||
|
shifts(
|
||||||
|
where: {
|
||||||
|
shiftName: { eq: $shiftName }
|
||||||
|
startDate: { eq: $startDate }
|
||||||
|
endDate: { eq: $endDate }
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
shiftName
|
||||||
|
startDate
|
||||||
|
endDate
|
||||||
|
assignedStaff
|
||||||
|
}
|
||||||
|
}
|
||||||
10
dataconnect/schema/shift.gql
Normal file
10
dataconnect/schema/shift.gql
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
type Shift @table(name: "shifts") {
|
||||||
|
id: UUID! @default(expr: "uuidV4()")
|
||||||
|
shiftName: String!
|
||||||
|
startDate: Timestamp!
|
||||||
|
endDate: Timestamp
|
||||||
|
assignedStaff: String # assigned_staff (jsonb -> String, array de objects)
|
||||||
|
createdDate: Timestamp @default(expr: "request.time")
|
||||||
|
updatedDate: Timestamp @default(expr: "request.time")
|
||||||
|
createdBy: String @default(expr: "auth.uid")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user