Compare commits

..

No commits in common. "0a6321deb08ee8244fde93fb584a4a90a07c1aea" and "85adbbcdb35db83c6cb53c7094e33848667da771" have entirely different histories.

3 changed files with 2 additions and 7 deletions

View File

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

View File

@ -118,8 +118,6 @@ 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. * @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> { async function deleteCategory(id:string): Promise<unknown> {
//TODO Verify if exist
//TODO Verify if element linked to category
try { try {
logger.info(`Deleting category... (${id})`); logger.info(`Deleting category... (${id})`);
return await MysqlService.Category.delete(DbHandler, id); return await MysqlService.Category.delete(DbHandler, id);

View File

@ -407,7 +407,6 @@ const MySqlService = {
* @throws {Error} If the brandId is undefined or invalid. * @throws {Error} If the brandId is undefined or invalid.
*/ */
delete(handler: MysqlHandler, brandId: string): Promise<unknown> { delete(handler: MysqlHandler, brandId: string): Promise<unknown> {
//TODO check if has models linked before actions
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!brandId) return reject('Id is undefined'); if (!brandId) return reject('Id is undefined');
if (brandId.length !== 36) return reject('Id invalid'); if (brandId.length !== 36) return reject('Id invalid');
@ -420,8 +419,6 @@ const MySqlService = {
} }
}) })
} }
//TODO Get models of the brand
}, },
Model: { Model: {