feat: Integrate Data Connect and Implement Staff List View Directory
This commit is contained in:
41
backend/dataconnect/example/workForce/mutations.gql
Normal file
41
backend/dataconnect/example/workForce/mutations.gql
Normal file
@@ -0,0 +1,41 @@
|
||||
mutation createWorkforce(
|
||||
$vendorId: UUID!
|
||||
$staffId: UUID!
|
||||
$workforceNumber: String!
|
||||
$employmentType: WorkforceEmploymentType
|
||||
) @auth(level: USER) {
|
||||
workforce_insert(
|
||||
data: {
|
||||
vendorId: $vendorId
|
||||
staffId: $staffId
|
||||
workforceNumber: $workforceNumber
|
||||
employmentType: $employmentType
|
||||
status: ACTIVE
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation updateWorkforce(
|
||||
$id: UUID!
|
||||
$workforceNumber: String
|
||||
$employmentType: WorkforceEmploymentType
|
||||
$status: WorkforceStatus
|
||||
) @auth(level: USER) {
|
||||
workforce_update(
|
||||
id: $id
|
||||
data: {
|
||||
workforceNumber: $workforceNumber
|
||||
employmentType: $employmentType
|
||||
status: $status
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation deactivateWorkforce(
|
||||
$id: UUID!
|
||||
) @auth(level: USER) {
|
||||
workforce_update(
|
||||
id: $id
|
||||
data: { status: INACTIVE }
|
||||
)
|
||||
}
|
||||
116
backend/dataconnect/example/workForce/queries.gql
Normal file
116
backend/dataconnect/example/workForce/queries.gql
Normal file
@@ -0,0 +1,116 @@
|
||||
# ------------------------------------------------------------
|
||||
# GET Workforce by ID
|
||||
# ------------------------------------------------------------
|
||||
query getWorkforceById($id: UUID!) @auth(level: USER) {
|
||||
workforce(id: $id) {
|
||||
id
|
||||
vendorId
|
||||
staffId
|
||||
workforceNumber
|
||||
employmentType
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
staff { id fullName }
|
||||
vendor { id companyName }
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# GET Workforce by Vendor + Staff (was "by key")
|
||||
# ------------------------------------------------------------
|
||||
query getWorkforceByVendorAndStaff(
|
||||
$vendorId: UUID!
|
||||
$staffId: UUID!
|
||||
) @auth(level: USER) {
|
||||
workforces(
|
||||
where: {
|
||||
vendorId: { eq: $vendorId }
|
||||
staffId: { eq: $staffId }
|
||||
}
|
||||
limit: 1
|
||||
) {
|
||||
id
|
||||
vendorId
|
||||
staffId
|
||||
workforceNumber
|
||||
employmentType
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
staff { id fullName }
|
||||
vendor { id companyName }
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST Workforce by Vendor
|
||||
# ------------------------------------------------------------
|
||||
query listWorkforceByVendorId(
|
||||
$vendorId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
workforces(
|
||||
where: { vendorId: { eq: $vendorId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
workforceNumber
|
||||
employmentType
|
||||
status
|
||||
createdAt
|
||||
|
||||
staff { id fullName }
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# LIST Workforce by Staff
|
||||
# ------------------------------------------------------------
|
||||
query listWorkforceByStaffId(
|
||||
$staffId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
workforces(
|
||||
where: { staffId: { eq: $staffId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
vendorId
|
||||
workforceNumber
|
||||
employmentType
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
vendor { id companyName }
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# CHECK workforceNumber uniqueness within a Vendor (optional)
|
||||
# ------------------------------------------------------------
|
||||
query getWorkforceByVendorAndNumber(
|
||||
$vendorId: UUID!
|
||||
$workforceNumber: String!
|
||||
) @auth(level: USER) {
|
||||
workforces(
|
||||
where: {
|
||||
vendorId: { eq: $vendorId }
|
||||
workforceNumber: { eq: $workforceNumber }
|
||||
}
|
||||
limit: 1
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
workforceNumber
|
||||
status
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user