feat: Integrate Data Connect and Implement Staff List View Directory
This commit is contained in:
43
backend/dataconnect/example/staffDocument/mutations.gql
Normal file
43
backend/dataconnect/example/staffDocument/mutations.gql
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
mutation createStaffDocument(
|
||||
$staffId: UUID!
|
||||
$staffName: String!
|
||||
$documentId: UUID!
|
||||
$status: DocumentStatus!
|
||||
$documentUrl: String
|
||||
$expiryDate: Timestamp
|
||||
) @auth(level: USER) {
|
||||
staffDocument_insert(
|
||||
data: {
|
||||
staffId: $staffId
|
||||
staffName: $staffName
|
||||
documentId: $documentId
|
||||
status: $status
|
||||
documentUrl: $documentUrl
|
||||
expiryDate: $expiryDate
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation updateStaffDocument(
|
||||
$staffId: UUID!
|
||||
$documentId: UUID!
|
||||
$status: DocumentStatus
|
||||
$documentUrl: String
|
||||
$expiryDate: Timestamp
|
||||
) @auth(level: USER) {
|
||||
staffDocument_update(
|
||||
key: { staffId: $staffId, documentId: $documentId }
|
||||
data: {
|
||||
status: $status
|
||||
documentUrl: $documentUrl
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation deleteStaffDocument(
|
||||
$staffId: UUID!
|
||||
$documentId: UUID!
|
||||
) @auth(level: USER) {
|
||||
staffDocument_delete(key: { staffId: $staffId, documentId: $documentId })
|
||||
}
|
||||
100
backend/dataconnect/example/staffDocument/queries.gql
Normal file
100
backend/dataconnect/example/staffDocument/queries.gql
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
query getStaffDocumentByKey(
|
||||
$staffId: UUID!
|
||||
$documentId: UUID!
|
||||
) @auth(level: USER) {
|
||||
staffDocument(key: { staffId: $staffId, documentId: $documentId }) {
|
||||
id
|
||||
staffId
|
||||
staffName
|
||||
documentId
|
||||
status
|
||||
documentUrl
|
||||
expiryDate
|
||||
createdAt
|
||||
updatedAt
|
||||
document {
|
||||
id
|
||||
name
|
||||
documentType
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query listStaffDocumentsByStaffId(
|
||||
$staffId: UUID!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffDocuments(
|
||||
where: { staffId: { eq: $staffId } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
staffName
|
||||
documentId
|
||||
status
|
||||
documentUrl
|
||||
expiryDate
|
||||
createdAt
|
||||
updatedAt
|
||||
document {
|
||||
id
|
||||
name
|
||||
documentType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query listStaffDocumentsByDocumentType(
|
||||
$documentType: DocumentType!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffDocuments(
|
||||
where: { document: { documentType: { eq: $documentType } } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
staffName
|
||||
documentId
|
||||
status
|
||||
documentUrl
|
||||
expiryDate
|
||||
document {
|
||||
id
|
||||
name
|
||||
documentType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query listStaffDocumentsByStatus(
|
||||
$status: DocumentStatus!
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
) @auth(level: USER) {
|
||||
staffDocuments(
|
||||
where: { status: { eq: $status } }
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
) {
|
||||
id
|
||||
staffId
|
||||
staffName
|
||||
documentId
|
||||
status
|
||||
documentUrl
|
||||
expiryDate
|
||||
document {
|
||||
id
|
||||
name
|
||||
documentType
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user