order creation logic fix, refactor & cleanup on admin end

This commit is contained in:
user
2025-10-21 19:20:56 +03:00
parent b6bdb6d7e8
commit f0fa53a4e5
19 changed files with 100 additions and 415 deletions

View File

@@ -22,8 +22,8 @@ export class PaymentInfoRepository {
cardholderName: data.cardDetails.cardholderName,
expiry: data.cardDetails.expiry,
cvv: data.cardDetails.cvv,
flightTicketInfoId: data.flightTicketInfoId,
productId: data.productId,
orderId: data.orderId,
createdAt: new Date(),
updatedAt: new Date(),
})
@@ -45,6 +45,20 @@ export class PaymentInfoRepository {
return { data: parsed.data };
}
async updatePaymentInfoOrderId(
id: number,
oid: number,
): Promise<Result<number>> {
Logger.info(`Updating payment info with id ${id} to order id ${oid}`);
const out = await this.db
.update(paymentInfo)
.set({ orderId: oid })
.where(eq(paymentInfo.id, id))
.execute();
Logger.debug(out);
return { data: id };
}
async deletePaymentInfo(id: number): Promise<Result<boolean>> {
Logger.info(`Deleting payment info with id ${id}`);
const out = await this.db