zalsaeed / cgav

Certificate Generation and Verification
GNU General Public License v3.0
3 stars 1 forks source link

What if a template configuration are reset or a template is deleted? #67

Open zalsaeed opened 2 weeks ago

zalsaeed commented 2 weeks ago

An important behavior that we need to discuss is what if the templates are deleted or updated? How can it effect existing certificate that uses the given template?

ralhazmi commented 2 weeks ago

Regarding deletion: When a template that has an associated event is deleted, and a user tries to generate a certificate for that event, an error occurs because the template image and name are missing. What if we allow the user to delete the template, but instead of completely removing it, we make it similar to the process of deleting an event type? The template would disappear from the user's view but remain in the database with an inactive status. Certificates could still be generated for events relying on the deleted template. Another solution, we could notify the user that deleting the template may result in an inability to generate certificates that depend on it. If a user attempts to generate a certificate with the deleted template, user would be alerted that it relies on a non-existent template.

wesamhamad commented 1 week ago

Regarding the Delete:

I recommend the first option: "make delete as inactive, not deleted, only hide from user view." When generating using an inactive template, a user message should appear:

"You are trying to use an inactive template. Do you want to reactivate it to continue generating?"

Regarding the Update

I believe it is better to update the file path for images and the position for JSON objects, as well as the template name, while keeping the ID the same. This way, when the user clicks on generate after a successful update, they will have new values, while previously generated certificates will retain the old values. This enhances the process.

For the update process, I suggest:

  1. Adding 'Update' button to '/Select_template' page.
    • This button should open a page with input fields for 'Template Name' and 'image' (uploading a new one) having filled with old values.
    • Once updated, these changes should automatically reflect on the same page.
  2. Adding a 'Delete' button that sets the template to inactive status.
    • In same page will be also delete button to inactivate the template.