@@ -131,6 +131,16 @@ export class AdminSettingController extends BaseController {
|
||||
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")
|
||||
@ApiResponse("successful", HttpStatus.Created)
|
||||
@ApiModel(CreateFaqDTO)
|
||||
|
||||
@@ -49,6 +49,18 @@ class FaqService {
|
||||
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 };
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Types } from "mongoose";
|
||||
import { OrderItemRefEnum, ReasonRefEnum } from "../fine.model";
|
||||
|
||||
export interface IFine {
|
||||
product: Types.ObjectId;
|
||||
// product: Types.ObjectId;
|
||||
seller: Types.ObjectId;
|
||||
orderItem: Types.ObjectId;
|
||||
orderItemRef: OrderItemRefEnum;
|
||||
|
||||
@@ -15,7 +15,7 @@ export enum OrderItemRefEnum {
|
||||
const FineSchema = new Schema<IFine>(
|
||||
{
|
||||
seller: { type: Schema.Types.ObjectId, ref: "Seller", required: true },
|
||||
orderItem: { type: Schema.Types.ObjectId, ref: "orderItemRef", required: true },
|
||||
orderItem: { type: Schema.Types.ObjectId, refPath: "orderItemRef", required: true },
|
||||
orderItemRef: { type: String, enum: OrderItemRefEnum, required: true },
|
||||
fine_rule: { type: Schema.Types.ObjectId, ref: "FineRule", required: true },
|
||||
reason: { type: Schema.Types.ObjectId, refPath: "reasonRef", required: true },
|
||||
|
||||
Reference in New Issue
Block a user