chore: fmt

This commit is contained in:
Michael Abebe
2026-05-12 16:50:18 +03:00
parent 4540d35215
commit 1c5ee19388
181 changed files with 1492 additions and 1100 deletions

View File

@@ -1,32 +1,37 @@
import { BaseEntity } from '@edr/api-common';
import { Passenger } from '@edr/types';
import { Column, Entity } from 'typeorm';
import { BaseEntity } from "@edr/api-common";
import { Passenger } from "@edr/types";
import { Column, Entity } from "typeorm";
@Entity({ name: 'payments' })
@Entity({ name: "payments" })
export class Payment extends BaseEntity {
@Column({ name: 'ticket_id', type: 'uuid' })
@Column({ name: "ticket_id", type: "uuid" })
ticketId!: string;
@Column({ name: 'amount', type: 'numeric', precision: 10, scale: 2 })
@Column({ name: "amount", type: "numeric", precision: 10, scale: 2 })
amount!: number;
@Column({ name: 'currency', type: 'varchar', length: 8, default: 'ETB' })
@Column({ name: "currency", type: "varchar", length: 8, default: "ETB" })
currency!: string;
@Column({
name: 'status',
type: 'enum',
name: "status",
type: "enum",
enum: Passenger.PaymentStatus,
default: Passenger.PaymentStatus.Pending,
})
status!: Passenger.PaymentStatus;
@Column({ name: 'provider', type: 'varchar', length: 64 })
@Column({ name: "provider", type: "varchar", length: 64 })
provider!: string;
@Column({ name: 'provider_transaction_id', type: 'varchar', length: 256, nullable: true })
@Column({
name: "provider_transaction_id",
type: "varchar",
length: 256,
nullable: true,
})
providerTransactionId?: string | null;
@Column({ name: 'paid_at', type: 'timestamptz', nullable: true })
@Column({ name: "paid_at", type: "timestamptz", nullable: true })
paidAt?: Date | null;
}

View File

@@ -1,17 +1,17 @@
import { Controller, Get, Param, ParseUUIDPipe } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { Controller, Get, Param, ParseUUIDPipe } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { PaymentsService } from './payments.service';
import { PaymentsService } from "./payments.service";
@ApiTags('payments')
@ApiTags("payments")
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
@Controller('payments')
@Controller("payments")
export class PaymentsController {
constructor(private readonly paymentsService: PaymentsService) {}
@Get('ticket/:ticketId')
@ApiOperation({ summary: 'List payments for a ticket' })
findByTicket(@Param('ticketId', ParseUUIDPipe) ticketId: string) {
@Get("ticket/:ticketId")
@ApiOperation({ summary: "List payments for a ticket" })
findByTicket(@Param("ticketId", ParseUUIDPipe) ticketId: string) {
return this.paymentsService.findByTicket(ticketId);
}
}

View File

@@ -1,9 +1,9 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { Payment } from './entities/payment.entity';
import { PaymentsController } from './payments.controller';
import { PaymentsService } from './payments.service';
import { Payment } from "./entities/payment.entity";
import { PaymentsController } from "./payments.controller";
import { PaymentsService } from "./payments.service";
@Module({
imports: [TypeOrmModule.forFeature([Payment])],

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";
import { Payment } from './entities/payment.entity';
import { Payment } from "./entities/payment.entity";
@Injectable()
export class PaymentsService {
@@ -15,7 +15,7 @@ export class PaymentsService {
findByTicket(ticketId: string): Promise<Payment[]> {
return this.paymentsRepository.find({
where: { ticketId },
order: { createdAt: 'DESC' },
order: { createdAt: "DESC" },
});
}
}