feat: update payback status instead of its status
This commit is contained in:
parent
9b21c15599
commit
4e7e6e07c9
1 changed files with 5 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ import HttpStatus from "../interfaces/http-status";
|
||||||
import { notFoundError } from "../utils/error";
|
import { notFoundError } from "../utils/error";
|
||||||
import { CreditNotePaybackType, CreditNoteStatus, Prisma } from "@prisma/client";
|
import { CreditNotePaybackType, CreditNoteStatus, Prisma } from "@prisma/client";
|
||||||
import { queryOrNot } from "../utils/relation";
|
import { queryOrNot } from "../utils/relation";
|
||||||
import { RequestWorkStatus } from "../generated/kysely/types";
|
import { PaybackStatus, RequestWorkStatus } from "../generated/kysely/types";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = [
|
||||||
"system",
|
"system",
|
||||||
|
|
@ -508,12 +508,12 @@ export class CreditNoteActionController extends Controller {
|
||||||
return creditNoteData;
|
return creditNoteData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post("status")
|
@Post("packback-status")
|
||||||
@Security("keycloak", MANAGE_ROLES)
|
@Security("keycloak", MANAGE_ROLES)
|
||||||
async updateStatus(
|
async updateStatus(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() creditNoteId: string,
|
@Path() creditNoteId: string,
|
||||||
@Body() body: CreditNoteStatus,
|
@Body() body: PaybackStatus,
|
||||||
) {
|
) {
|
||||||
await this.#checkPermission(req.user, creditNoteId);
|
await this.#checkPermission(req.user, creditNoteId);
|
||||||
return await prisma.creditNote.update({
|
return await prisma.creditNote.update({
|
||||||
|
|
@ -527,7 +527,8 @@ export class CreditNoteActionController extends Controller {
|
||||||
quotation: true,
|
quotation: true,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
creditNoteStatus: body,
|
creditNoteStatus: body === PaybackStatus.Done ? CreditNoteStatus.Success : undefined,
|
||||||
|
paybackStatus: body,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue