fix: wrong operation

This commit is contained in:
Methapon Metanipat 2024-10-29 15:41:39 +07:00
parent 7ff88a2487
commit 719a1fb70e

View file

@ -12,7 +12,6 @@ import {
Security, Security,
Tags, Tags,
} from "tsoa"; } from "tsoa";
import express from "express";
import { PaymentStatus, Prisma } from "@prisma/client"; import { PaymentStatus, Prisma } from "@prisma/client";
import prisma from "../db"; import prisma from "../db";
import { notFoundError } from "../utils/error"; import { notFoundError } from "../utils/error";
@ -83,12 +82,27 @@ export class QuotationPayment extends Controller {
return { result, page, pageSize, total }; return { result, page, pageSize, total };
} }
@Get("{quotationId}") @Get("{paymentId}")
@Security("keycloak") @Security("keycloak")
async getPayment(@Path() quotationId: string) { async getPayment(@Path() paymentId: string) {
const record = await prisma.payment.findFirst({ const record = await prisma.payment.findFirst({
where: { invoice: { quotationId } }, where: { id: paymentId },
include: { createdBy: true }, include: {
invoice: {
include: {
productServiceList: {
include: {
worker: true,
service: true,
work: true,
product: true,
},
},
quotation: true,
createdBy: true,
},
},
},
}); });
return record; return record;
} }