refactor: reorder endpoints (affect swagger)
This commit is contained in:
parent
c97a8e5f66
commit
557254eb19
1 changed files with 28 additions and 28 deletions
|
|
@ -176,6 +176,34 @@ function globalAllow(roles?: string[]) {
|
|||
@Route("/api/v1/quotation")
|
||||
@Tags("Quotation")
|
||||
export class QuotationController extends Controller {
|
||||
@Get()
|
||||
@Security("keycloak")
|
||||
async getQuotationList(@Query() page: number = 1, @Query() pageSize: number = 30) {
|
||||
const [result, total] = await prisma.$transaction([
|
||||
prisma.quotation.findMany({
|
||||
include: {
|
||||
worker: true,
|
||||
service: {
|
||||
include: {
|
||||
_count: { select: { work: true } },
|
||||
work: {
|
||||
include: {
|
||||
_count: { select: { productOnWork: true } },
|
||||
productOnWork: {
|
||||
include: { product: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
prisma.quotation.count(),
|
||||
]);
|
||||
|
||||
return { result: result, page, pageSize, total };
|
||||
}
|
||||
|
||||
@Get("{quotationId}")
|
||||
@Security("keycloak")
|
||||
async getQuotationById(@Path() quotationId: string) {
|
||||
|
|
@ -206,34 +234,6 @@ export class QuotationController extends Controller {
|
|||
return record;
|
||||
}
|
||||
|
||||
@Get()
|
||||
@Security("keycloak")
|
||||
async getQuotationList(@Query() page: number = 1, @Query() pageSize: number = 30) {
|
||||
const [result, total] = await prisma.$transaction([
|
||||
prisma.quotation.findMany({
|
||||
include: {
|
||||
worker: true,
|
||||
service: {
|
||||
include: {
|
||||
_count: { select: { work: true } },
|
||||
work: {
|
||||
include: {
|
||||
_count: { select: { productOnWork: true } },
|
||||
productOnWork: {
|
||||
include: { product: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
prisma.quotation.count(),
|
||||
]);
|
||||
|
||||
return { result: result, page, pageSize, total };
|
||||
}
|
||||
|
||||
@Post()
|
||||
@Security("keycloak", MANAGE_ROLES)
|
||||
async createQuotation(@Request() req: RequestWithUser, @Body() body: QuotationCreate) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue