feat: Integrate Data Connect and Implement Staff List View Directory
This commit is contained in:
142
backend/dataconnect/example/staffRole/queries.gql
Normal file
142
backend/dataconnect/example/staffRole/queries.gql
Normal file
@@ -0,0 +1,142 @@
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# LIST ALL (admin/debug)
|
||||
# ----------------------------------------------------------
|
||||
query listStaffRoles(
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffRoles(offset: $offset, limit: $limit) {
|
||||
id
|
||||
staffId
|
||||
roleId
|
||||
createdAt
|
||||
roleType
|
||||
|
||||
staff {
|
||||
id
|
||||
fullName
|
||||
userId
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
role {
|
||||
id
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# GET BY COMPOSITE KEY (staffId + roleId)
|
||||
# ----------------------------------------------------------
|
||||
query getStaffRoleByKey(
|
||||
$staffId: UUID!
|
||||
$roleId: UUID!
|
||||
) @auth(level: USER) {
|
||||
staffRole(key: { staffId: $staffId, roleId: $roleId }) {
|
||||
id
|
||||
staffId
|
||||
roleId
|
||||
createdAt
|
||||
roleType
|
||||
|
||||
staff {
|
||||
id
|
||||
fullName
|
||||
userId
|
||||
email
|
||||
phone
|
||||
}
|
||||
|
||||
role {
|
||||
id
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# LIST BY STAFF (most common)
|
||||
# ----------------------------------------------------------
|
||||
query listStaffRolesByStaffId(
|
||||
$staffId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffRoles(
|
||||
where: { staffId: { eq: $staffId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
roleId
|
||||
createdAt
|
||||
roleType
|
||||
|
||||
role {
|
||||
id
|
||||
name
|
||||
costPerHour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# LIST BY ROLE (who has this skill)
|
||||
# ----------------------------------------------------------
|
||||
query listStaffRolesByRoleId(
|
||||
$roleId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffRoles(
|
||||
where: { roleId: { eq: $roleId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
roleId
|
||||
createdAt
|
||||
roleType
|
||||
|
||||
staff {
|
||||
id
|
||||
fullName
|
||||
userId
|
||||
email
|
||||
phone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# FILTER (optional)
|
||||
# Useful when you want both conditions without using key lookup
|
||||
# ----------------------------------------------------------
|
||||
query filterStaffRoles(
|
||||
$staffId: UUID
|
||||
$roleId: UUID
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffRoles(
|
||||
where: {
|
||||
staffId: { eq: $staffId }
|
||||
roleId: { eq: $roleId }
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
roleId
|
||||
createdAt
|
||||
roleType
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user