Fix knowledge card creation flow and bugs
Created by: Edouard-Legoupil
This commit provides a comprehensive fix for several issues related to the knowledge card creation and reference identification process.
The changes include:
-
Frontend (KnowledgeCard.jsx):
- Modified the 'Identify References' button logic to automatically save a new knowledge card before proceeding. This removes a warning message and streamlines the user workflow.
-
Backend (api/knowledge.py):
- Corrected a
KeyError: 'id'by using the properuser_idkey when accessing the current user's ID from the authentication dependency. - Ensured that the
created_byandupdated_byaudit columns are correctly populated in theknowledge_cardsandknowledge_card_referencestables for both creation and update operations. This resolves the originalNOT NULLconstraint violation.
- Corrected a
-
Database (database-setup.sql):
- Relaxed the
one_link_onlyCHECKconstraint on theknowledge_cardstable from= 1to<= 1. This allows a knowledge card to be created without an initial link to a donor, outcome, or field context, which is necessary for the new auto-save workflow.
- Relaxed the
- Does my code meet the quality standards for releasing packages?
- Does the reviewer have all the information to validate the features/issues without too much research?
- Does the customer who will validate the associated tickets have the information to do so without wasting time?
Issues to validate to close :
-
issue #
Processed issues to keep open or in progress:
-
issue #
Checklist:
-
Does the package check go local? -
Does the CI pass? -
Are the added / fixed features documented, tested? -
Are the added features / solved problems briefly presented in the PR message? -
Are the changes related to tickets / issues that I have listed in the commits and in the PR itself? -
Are the tickets in "review" mode in the Project Tracking Board? -
Does each ticket, if it is to be closed after acceptance of the PR, contain a comment that tells how to validate it?