🔄 cleanup: more order logic cleanup on the admin side mostly

This commit is contained in:
user
2025-10-20 22:39:00 +03:00
parent 10bcbf982a
commit 4ae1957a88
18 changed files with 375 additions and 221 deletions

View File

@@ -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 {};