add: faq detail
This commit is contained in:
@@ -131,6 +131,16 @@ export class AdminSettingController extends BaseController {
|
|||||||
return this.response(data);
|
return this.response(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("get faq detail")
|
||||||
|
@ApiResponse("successful", HttpStatus.Ok)
|
||||||
|
@ApiParam("id", "faq id", true)
|
||||||
|
@ApiAuth()
|
||||||
|
@httpGet("/faqs/:id", Guard.authAdmin())
|
||||||
|
public async getFaqDetail(@requestParam("id") faqId: string) {
|
||||||
|
const data = await this.faqService.getFaqDetail(faqId);
|
||||||
|
return this.response(data);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("create faq")
|
@ApiOperation("create faq")
|
||||||
@ApiResponse("successful", HttpStatus.Created)
|
@ApiResponse("successful", HttpStatus.Created)
|
||||||
@ApiModel(CreateFaqDTO)
|
@ApiModel(CreateFaqDTO)
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ class FaqService {
|
|||||||
deletedFaq,
|
deletedFaq,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
//##############################
|
||||||
|
//##############################
|
||||||
|
async getFaqDetail(faqId: string) {
|
||||||
|
if (!isValidObjectId(faqId)) throw new BadRequestError(CommonMessage.NotValidId);
|
||||||
|
|
||||||
|
const faq = await this.faqRepo.model.findById(faqId);
|
||||||
|
|
||||||
|
if (!faq) throw new BadRequestError(CommonMessage.NotFoundById);
|
||||||
|
return {
|
||||||
|
faq,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { FaqService };
|
export { FaqService };
|
||||||
|
|||||||
Reference in New Issue
Block a user