feat: standardize category update response format with code, message, and data wrapper

This commit is contained in:
JakkrapartXD 2026-01-30 15:23:29 +07:00
parent 14c1222a4e
commit 10a71c9a15
2 changed files with 18 additions and 10 deletions

View file

@ -55,11 +55,15 @@ export class CategoryService {
data: category
});
return {
id: updatedCategory.id,
name: updatedCategory.name as { th: string; en: string },
slug: updatedCategory.slug,
description: updatedCategory.description as { th: string; en: string },
updated_by: decoded.id,
code: 200,
message: 'Category updated successfully',
data: {
id: updatedCategory.id,
name: updatedCategory.name as { th: string; en: string },
slug: updatedCategory.slug,
description: updatedCategory.description as { th: string; en: string },
updated_by: decoded.id,
}
};
} catch (error) {
logger.error('Failed to update category', { error });

View file

@ -48,11 +48,15 @@ export interface updateCategory {
}
export interface updateCategoryResponse {
id: number;
name: MultiLanguageText;
slug: string;
description: MultiLanguageText;
updated_by: number;
code: number;
message: string;
data: {
id: number;
name: MultiLanguageText;
slug: string;
description: MultiLanguageText;
updated_by: number;
};
}
export interface deleteCategoryResponse {