🔄 cleanup: more order logic cleanup on the admin side mostly
This commit is contained in:
@@ -3,9 +3,9 @@ import { paymentInfo } from "@pkg/db/schema";
|
||||
import { Logger } from "@pkg/logger";
|
||||
import type { Result } from "@pkg/result";
|
||||
import {
|
||||
paymentDetailsModel,
|
||||
type PaymentDetails,
|
||||
type PaymentDetailsPayload,
|
||||
paymentInfoModel,
|
||||
type PaymentInfo,
|
||||
type PaymentInfoPayload,
|
||||
} from "./entities";
|
||||
|
||||
export class PaymentInfoRepository {
|
||||
@@ -14,9 +14,7 @@ export class PaymentInfoRepository {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
async createPaymentInfo(
|
||||
data: PaymentDetailsPayload,
|
||||
): Promise<Result<number>> {
|
||||
async createPaymentInfo(data: PaymentInfoPayload): Promise<Result<number>> {
|
||||
const out = await this.db
|
||||
.insert(paymentInfo)
|
||||
.values({
|
||||
@@ -34,12 +32,12 @@ export class PaymentInfoRepository {
|
||||
return { data: out[0]?.id };
|
||||
}
|
||||
|
||||
async getPaymentInfo(id: number): Promise<Result<PaymentDetails>> {
|
||||
async getPaymentInfo(id: number): Promise<Result<PaymentInfo>> {
|
||||
Logger.info(`Getting payment info with id ${id}`);
|
||||
const out = await this.db.query.paymentInfo.findFirst({
|
||||
where: eq(paymentInfo.id, id),
|
||||
});
|
||||
const parsed = paymentDetailsModel.safeParse(out);
|
||||
const parsed = paymentInfoModel.safeParse(out);
|
||||
if (parsed.error) {
|
||||
Logger.error(parsed.error);
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user