### Task List #### Database Implementation - [ ] **Design and Setup**: - [ ] Design the schema for mapping templates to verified templates. - [ ] Implement a minimal database setup for the small dataset. - [ ] **CRUD Operations**: - [ ] Implement database operations for `template`, `schema`, and `certificate`. --- #### `/schema` APIs - [ ] **GET** `/schema/?{schemaId}`: - [ ] Query all schemas if `schemaId` is not provided. - [ ] Query a specific schema by `schemaId` if provided. - [ ] **Tests**: - [ ] Retrieve all schemas successfully. - [ ] Retrieve a specific schema by ID. - [ ] Handle invalid `schemaId` gracefully. --- #### `/template` APIs - [ ] **GET** `/template`: - [ ] Fetch a template by `ID` or `schemaID`. - [ ] **Tests**: - [ ] Retrieve a template by ID. - [ ] Retrieve templates by `schemaID`. - [ ] Handle cases where no templates match the criteria. - [ ] **POST** `/template`: - [ ] Add a new template with metadata and HTML content. - [ ] **Tests**: - [ ] Successfully create a new template. - [ ] Validate metadata and HTML content. - [ ] Handle duplicate template creation gracefully. - [ ] **DELETE** `/template`: - [ ] Delete a template by ID. - [ ] **Tests**: - [ ] Successfully delete a template. - [ ] Handle cases where the template ID does not exist. - [ ] **PUT** `/template`: - [ ] Update metadata and HTML content for a template. - [ ] **Tests**: - [ ] Successfully update a template. - [ ] Handle invalid template IDs or input. --- #### `/certificate` APIs - [ ] **GET** `/certificate`: - [ ] Fetch certificates by `certID`, `templateID`, or `schemaID`. - [ ] **Tests**: - [ ] Retrieve certificates by `certID`, `templateID`, or `schemaID`. - [ ] Handle cases where no certificates match the criteria. - [ ] **PATCH** `/certificate`: - [ ] Update the status of a certificate (`enable` or `disable`). - [ ] **Tests**: - [ ] Successfully update a certificate's status. - [ ] Handle invalid certificate IDs or statuses. - [ ] **POST** `/certificate`: - [ ] Render and save a certificate using `templateId`, returning a link for sharing. - [ ] **Tests**: - [ ] Successfully render and save a certificate. - [ ] Validate `templateId` and optional `puppeteerConfig`. - [ ] Handle cases where rendering or saving fails. - [ ] **POST** `/certificate/preview`: - [ ] Render a certificate PDF without saving it. - [ ] **Tests**: - [ ] Successfully render a certificate preview. - [ ] Validate `templateId` and optional `puppeteerConfig`. - [ ] Handle cases where rendering fails. - [ ] **DELETE** `/certificate`: - [ ] Delete a certificate record and its saved PDF file. - [ ] **Tests**: - [ ] Successfully delete a certificate. - [ ] Handle cases where the certificate ID does not exist. --- #### `/rcw/verify/{credentialID}` API - [ ] **GET** `/rcw/verify/{credentialID}`: - [ ] Render the certificate in a verified format as an HTML page. - [ ] **Tests**: - [ ] Successfully render a verified certificate by `credentialID`. - [ ] Handle cases where the `credentialID` is invalid. - [ ] Verify legacy compatibility for historical certificates.
Task List
Database Implementation
Design and Setup:
CRUD Operations:
template,schema, andcertificate./schemaAPIs/schema/?{schemaId}:schemaIdis not provided.schemaIdif provided.schemaIdgracefully./templateAPIsGET
/template:IDorschemaID.schemaID.POST
/template:DELETE
/template:PUT
/template:/certificateAPIsGET
/certificate:certID,templateID, orschemaID.certID,templateID, orschemaID.PATCH
/certificate:enableordisable).POST
/certificate:templateId, returning a link for sharing.templateIdand optionalpuppeteerConfig.POST
/certificate/preview:templateIdand optionalpuppeteerConfig.DELETE
/certificate:/rcw/verify/{credentialID}API/rcw/verify/{credentialID}:credentialID.credentialIDis invalid.