Compare commits

...

2 Commits

Author SHA1 Message Date
0a6321deb0
feat(services): mark blob validation as TODO in brand service
A TODO comment has been added to the `brand.service.ts` file indicating that blob validation needs to be implemented in the future, for both the 'create' and 'update' functions in the brand service.

Issue: #13
Signed-off-by: Mathis <yidhra@tuta.io>
2024-04-26 10:00:55 +02:00
a811a2ece2
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>
2024-04-26 09:57:44 +02:00
3 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
const DbHandler = new MysqlService.Handler('BrandService')
const logger = new Logger({name: 'BrandService'})
//SEC Blob validation
//SEC todo Blob validation
/**
* Creates a brand in the database with the given data.
*
@ -34,6 +34,7 @@ async function createBrand(data: IDbBrand): Promise<unknown> {
return { error: 'failed' };
}
//SEC todo Blob validation
/**
* Updates a brand in the database.
*
@ -98,7 +99,6 @@ async function getBySlugBrand(brandSlug: string): Promise<IDbBrand | false> {
return brand;
}
/**
* Retrieves a brand from the database based on the provided brand ID.
*

View File

@ -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);

View File

@ -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: {