25 lines
856 B
TypeScript
25 lines
856 B
TypeScript
import { Injectable } from "@nestjs/common";
|
|
import { Expenses, Prisma } from "@prisma/client";
|
|
import { Decimal } from "@prisma/client/runtime/library";
|
|
import { transcode } from "buffer";
|
|
import { BaseApprovalService } from "src/common/shared/base-approval.service";
|
|
import { PrismaService } from "src/prisma/prisma.service";
|
|
|
|
@Injectable()
|
|
export class ExpensesCommandService extends BaseApprovalService<Expenses> {
|
|
constructor(prisma: PrismaService) { super(prisma); }
|
|
|
|
protected get delegate() {
|
|
return this.prisma.expenses;
|
|
}
|
|
|
|
protected delegateFor(transaction: Prisma.TransactionClient){
|
|
return transaction.expenses;
|
|
}
|
|
|
|
async updateApproval(id: number, isApproved: boolean): Promise<Expenses> {
|
|
return this.prisma.$transaction((transaction) =>
|
|
this.updateApprovalWithTransaction(transaction, id, isApproved),
|
|
);
|
|
}
|
|
} |