@@ -111,6 +111,16 @@ export class AdminFinancialController extends BaseController {
|
||||
return this.response(data);
|
||||
}
|
||||
|
||||
@ApiOperation("get pricing detail")
|
||||
@ApiResponse("successful", HttpStatus.Ok)
|
||||
@ApiAuth()
|
||||
@ApiParam("id", "id of pricing", true)
|
||||
@httpGet("/pricing/:id", Guard.authAdmin())
|
||||
public async getPricingDetail(@requestParam("id") id: string) {
|
||||
const data = await this.pricingService.getPricingDetail(id);
|
||||
return this.response(data);
|
||||
}
|
||||
|
||||
@ApiOperation("create pricing")
|
||||
@ApiResponse("successful", HttpStatus.Created)
|
||||
@ApiModel(CreatePricingDTO)
|
||||
|
||||
@@ -35,6 +35,17 @@ export class PricingService {
|
||||
};
|
||||
}
|
||||
|
||||
//#######################################################
|
||||
|
||||
async getPricingDetail(id: string) {
|
||||
const pricing = await this.pricingRepo.model.findById(id);
|
||||
if (!pricing) throw new BadRequestError(PricingMessage.NotFound);
|
||||
|
||||
return {
|
||||
pricing,
|
||||
};
|
||||
}
|
||||
|
||||
//#######################################################
|
||||
async updatePricing(id: string, updateDto: UpdatePricingDTO) {
|
||||
const existType = await this.pricingRepo.model.findOne({ type: updateDto.type, _id: { $ne: id } });
|
||||
|
||||
Reference in New Issue
Block a user