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
|
data: category
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
id: updatedCategory.id,
|
code: 200,
|
||||||
name: updatedCategory.name as { th: string; en: string },
|
message: 'Category updated successfully',
|
||||||
slug: updatedCategory.slug,
|
data: {
|
||||||
description: updatedCategory.description as { th: string; en: string },
|
id: updatedCategory.id,
|
||||||
updated_by: decoded.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) {
|
} catch (error) {
|
||||||
logger.error('Failed to update category', { error });
|
logger.error('Failed to update category', { error });
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,15 @@ export interface updateCategory {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface updateCategoryResponse {
|
export interface updateCategoryResponse {
|
||||||
id: number;
|
code: number;
|
||||||
name: MultiLanguageText;
|
message: string;
|
||||||
slug: string;
|
data: {
|
||||||
description: MultiLanguageText;
|
id: number;
|
||||||
updated_by: number;
|
name: MultiLanguageText;
|
||||||
|
slug: string;
|
||||||
|
description: MultiLanguageText;
|
||||||
|
updated_by: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface deleteCategoryResponse {
|
export interface deleteCategoryResponse {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue