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")
|
@Route("/api/v1/quotation")
|
||||||
@Tags("Quotation")
|
@Tags("Quotation")
|
||||||
export class QuotationController extends Controller {
|
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}")
|
@Get("{quotationId}")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async getQuotationById(@Path() quotationId: string) {
|
async getQuotationById(@Path() quotationId: string) {
|
||||||
|
|
@ -206,34 +234,6 @@ export class QuotationController extends Controller {
|
||||||
return record;
|
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()
|
@Post()
|
||||||
@Security("keycloak", MANAGE_ROLES)
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async createQuotation(@Request() req: RequestWithUser, @Body() body: QuotationCreate) {
|
async createQuotation(@Request() req: RequestWithUser, @Body() body: QuotationCreate) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue