feat: standardize category update response format with code, message, and data wrapper
This commit is contained in:
parent
14c1222a4e
commit
10a71c9a15
2 changed files with 18 additions and 10 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue