update:add ci cd files ==> do not edit those file
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import Models from "../models";
|
||||
import Payment from "../models/payment.model";
|
||||
|
||||
export class PaymentDataAccess {
|
||||
async createPayment(userId: string, amount: number, paymentNumber: string,reason:string):Promise<Payment> {
|
||||
const payment = Models.Payment.create({ userId, amount, paymentNumber,reason });
|
||||
return payment;
|
||||
}
|
||||
|
||||
async getPayment(paymentId: string): Promise<Payment | null> {
|
||||
const payment = await Models.Payment.findById(paymentId);
|
||||
return payment;
|
||||
}
|
||||
|
||||
async getPaymentsByUserId(userId: string): Promise<Payment[]> {
|
||||
const payments = await Models.Payment.find({ userId });
|
||||
return payments;
|
||||
}
|
||||
|
||||
async getPayments(): Promise<Payment[]> {
|
||||
const payments = await Models.Payment.find();
|
||||
return payments;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user