Add support for verificationId throughout the certificate flow: schema, GraphQL mutations/queries, domain, repositories, service implementation, and UI. - Backend: add verificationId to Certificate schema and include it in upsert/create mutations; add auth insecureReason notes to related connector operations. - Data layer: add verificationId parameter to StaffConnectorRepository API and propagation in implementation (SDK call remains commented with FIXME until dataconnect SDK is regenerated). - Domain: add verificationId field to StaffCertificate (constructor, copyWith, props). - Certificates flow: create verification via verificationService, pass returned verificationId to upsertStaffCertificate so the verification record is persisted with the certificate. - UI: update certificate upload page to show existing file path, disable editing of name/issuer/number, rearrange fields, move remove button, change file icon and text style. - Misc: minor lambda formatting cleanup in benefits mapping. Note: the generated dataconnect SDK must be refreshed to enable the new .verificationId(...) call (there is a commented FIXME in the connector implementation).
108 lines
3.2 KiB
GraphQL
108 lines
3.2 KiB
GraphQL
mutation CreateCertificate(
|
|
$name: String!
|
|
$description: String
|
|
$expiry: Timestamp
|
|
$status: CertificateStatus!
|
|
$fileUrl: String
|
|
$icon: String
|
|
$certificationType: ComplianceType!
|
|
$issuer: String
|
|
$staffId: UUID!
|
|
$validationStatus: ValidationStatus
|
|
$certificateNumber: String
|
|
) @auth(level: USER, insecureReason: "The staffId refers to the staff being modified. Ownership is verified at the application layer.") {
|
|
certificate_insert(
|
|
data: {
|
|
name: $name
|
|
description: $description
|
|
expiry: $expiry
|
|
status: $status
|
|
fileUrl: $fileUrl
|
|
icon: $icon
|
|
staffId: $staffId
|
|
certificationType: $certificationType
|
|
issuer: $issuer
|
|
validationStatus: $validationStatus
|
|
certificateNumber: $certificateNumber
|
|
}
|
|
)
|
|
}
|
|
|
|
mutation UpdateCertificate(
|
|
$staffId: UUID!
|
|
$certificationType: ComplianceType!
|
|
$name: String
|
|
$description: String
|
|
$expiry: Timestamp
|
|
$status: CertificateStatus
|
|
$fileUrl: String
|
|
$icon: String
|
|
$issuer: String
|
|
$validationStatus: ValidationStatus
|
|
$certificateNumber: String
|
|
) @auth(level: USER, insecureReason: "The staffId refers to the staff being modified. Ownership is verified at the application layer.") {
|
|
certificate_update(
|
|
key: { staffId: $staffId, certificationType: $certificationType }
|
|
data: {
|
|
name: $name
|
|
description: $description
|
|
expiry: $expiry
|
|
status: $status
|
|
fileUrl: $fileUrl
|
|
icon: $icon
|
|
issuer: $issuer
|
|
validationStatus: $validationStatus
|
|
certificateNumber: $certificateNumber
|
|
}
|
|
)
|
|
}
|
|
|
|
mutation DeleteCertificate($staffId: UUID!, $certificationType: ComplianceType!)
|
|
@auth(level: USER, insecureReason: "The staffId refers to the staff being modified. Ownership is verified at the application layer.") {
|
|
certificate_delete(
|
|
key: { staffId: $staffId, certificationType: $certificationType }
|
|
)
|
|
}
|
|
|
|
# UPSERT STAFF CERTIFICATE
|
|
# Creates the certificate record if it does not exist, or updates
|
|
# it if it already exists (matched by staffId + certificationType key).
|
|
# Use this when uploading a certificate for the first time or
|
|
# updating an existing one.
|
|
#
|
|
# To update multiple certificates in a single network call, use
|
|
# aliased mutations in one GraphQL request from the client:
|
|
#
|
|
# mutation {
|
|
# cert1: upsertStaffCertificate(staffId: $id, certificationType: BACKGROUND_CHECK, ...)
|
|
# cert2: upsertStaffCertificate(staffId: $id, certificationType: FOOD_HANDLER, ...)
|
|
# }
|
|
# ------------------------------------------------------------
|
|
mutation upsertStaffCertificate(
|
|
$staffId: UUID!
|
|
$certificationType: ComplianceType!
|
|
$name: String!
|
|
$status: CertificateStatus!
|
|
$fileUrl: String
|
|
$expiry: Timestamp
|
|
$issuer: String
|
|
$certificateNumber: String
|
|
$validationStatus: ValidationStatus
|
|
$verificationId: String
|
|
) @auth(level: USER, insecureReason: "The staffId refers to the staff being modified. Ownership is verified at the application layer.") {
|
|
certificate_upsert(
|
|
data: {
|
|
staffId: $staffId
|
|
certificationType: $certificationType
|
|
name: $name
|
|
status: $status
|
|
fileUrl: $fileUrl
|
|
expiry: $expiry
|
|
issuer: $issuer
|
|
certificateNumber: $certificateNumber
|
|
validationStatus: $validationStatus
|
|
verificationId: $verificationId
|
|
}
|
|
)
|
|
}
|