chore: add create customer and update customer for admin
This commit is contained in:
@@ -56,6 +56,14 @@ export class DanakServicesController {
|
||||
return this.danakServicesService.getCategoriesUserSide();
|
||||
}
|
||||
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@ApiOperation({ summary: "Get category by id => admin route" })
|
||||
@Get("categories/:id")
|
||||
getCategoryById(@Param() paramDto: ParamDto) {
|
||||
return this.danakServicesService.getCategoryById(paramDto.id);
|
||||
}
|
||||
|
||||
@AuthGuards()
|
||||
@PermissionsDec(PermissionEnum.SERVICES)
|
||||
@ApiOperation({ summary: "update category by id => admin route" })
|
||||
|
||||
@@ -27,7 +27,7 @@ export class DanakService extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 255, nullable: false })
|
||||
author: string;
|
||||
|
||||
@Column({ type: "timestamp", nullable: false, default: () => "CURRENT_TIMESTAMP" })
|
||||
@Column({ type: "timestamptz", nullable: false, default: () => "CURRENT_TIMESTAMP" })
|
||||
createDate: Date;
|
||||
|
||||
@Column({ type: "int", nullable: false, default: 0 })
|
||||
|
||||
@@ -45,6 +45,16 @@ export class DanakServicesService {
|
||||
}
|
||||
/******************************************** */
|
||||
|
||||
async getCategoryById(categoryId: string) {
|
||||
const category = await this.danakServicesCategoryRepository.findOneById(categoryId);
|
||||
if (!category) throw new BadRequestException(CategoryMessage.CATEGORY_NOT_EXIST);
|
||||
return {
|
||||
category,
|
||||
};
|
||||
}
|
||||
|
||||
/******************************************** */
|
||||
|
||||
async updateCategory(categoryId: string, updateDto: UpdateCategoryDto) {
|
||||
const category = await this.danakServicesCategoryRepository.findOneById(categoryId);
|
||||
if (!category) throw new BadRequestException(CategoryMessage.CATEGORY_NOT_EXIST);
|
||||
|
||||
Reference in New Issue
Block a user