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 { CreditNotePaybackType, CreditNoteStatus, Prisma } from "@prisma/client";
|
||||
import { queryOrNot } from "../utils/relation";
|
||||
import { RequestWorkStatus } from "../generated/kysely/types";
|
||||
import { PaybackStatus, RequestWorkStatus } from "../generated/kysely/types";
|
||||
|
||||
const MANAGE_ROLES = [
|
||||
"system",
|
||||
|
|
@ -508,12 +508,12 @@ export class CreditNoteActionController extends Controller {
|
|||
return creditNoteData;
|
||||
}
|
||||
|
||||
@Post("status")
|
||||
@Post("packback-status")
|
||||
@Security("keycloak", MANAGE_ROLES)
|
||||
async updateStatus(
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() creditNoteId: string,
|
||||
@Body() body: CreditNoteStatus,
|
||||
@Body() body: PaybackStatus,
|
||||
) {
|
||||
await this.#checkPermission(req.user, creditNoteId);
|
||||
return await prisma.creditNote.update({
|
||||
|
|
@ -527,7 +527,8 @@ export class CreditNoteActionController extends Controller {
|
|||
quotation: true,
|
||||
},
|
||||
data: {
|
||||
creditNoteStatus: body,
|
||||
creditNoteStatus: body === PaybackStatus.Done ? CreditNoteStatus.Success : undefined,
|
||||
paybackStatus: body,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue