docs(services): add tasks to MySQL and Category services
An additional task is marked in the MySQL service to check if models are linked before taking further actions. Similarly, in the Category service, two tasks are added to verify the existence of a category and elements linked to it before proceeding with deletion. Signed-off-by: Mathis <yidhra@tuta.io>
This commit is contained in:
parent
85adbbcdb3
commit
a811a2ece2
@ -118,6 +118,8 @@ async function getById(id: string):Promise<IDbCategory | null> {
|
||||
* @return {Promise} - A Promise that resolves to the deleted category if successful, or null if an error occurs.
|
||||
*/
|
||||
async function deleteCategory(id:string): Promise<unknown> {
|
||||
//TODO Verify if exist
|
||||
//TODO Verify if element linked to category
|
||||
try {
|
||||
logger.info(`Deleting category... (${id})`);
|
||||
return await MysqlService.Category.delete(DbHandler, id);
|
||||
|
@ -407,6 +407,7 @@ const MySqlService = {
|
||||
* @throws {Error} If the brandId is undefined or invalid.
|
||||
*/
|
||||
delete(handler: MysqlHandler, brandId: string): Promise<unknown> {
|
||||
//TODO check if has models linked before actions
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!brandId) return reject('Id is undefined');
|
||||
if (brandId.length !== 36) return reject('Id invalid');
|
||||
@ -419,6 +420,8 @@ const MySqlService = {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//TODO Get models of the brand
|
||||
},
|
||||
Model: {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user