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