mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 16:35:42 +00:00
chore: fmt
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
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: 'seats' })
|
||||
@Entity({ name: "seats" })
|
||||
export class Seat extends BaseEntity {
|
||||
@Column({ name: 'schedule_id', type: 'uuid' })
|
||||
@Column({ name: "schedule_id", type: "uuid" })
|
||||
scheduleId!: string;
|
||||
|
||||
@Column({ name: 'seat_number', type: 'varchar', length: 16 })
|
||||
@Column({ name: "seat_number", type: "varchar", length: 16 })
|
||||
seatNumber!: string;
|
||||
|
||||
@Column({ name: 'seat_class', type: 'enum', enum: Passenger.SeatClass })
|
||||
@Column({ name: "seat_class", type: "enum", enum: Passenger.SeatClass })
|
||||
seatClass!: Passenger.SeatClass;
|
||||
|
||||
@Column({
|
||||
name: 'status',
|
||||
type: 'enum',
|
||||
name: "status",
|
||||
type: "enum",
|
||||
enum: Passenger.SeatStatus,
|
||||
default: Passenger.SeatStatus.Available,
|
||||
})
|
||||
status!: Passenger.SeatStatus;
|
||||
|
||||
@Column({ name: 'price', type: 'numeric', precision: 10, scale: 2 })
|
||||
@Column({ name: "price", type: "numeric", precision: 10, scale: 2 })
|
||||
price!: number;
|
||||
}
|
||||
|
||||
@@ -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 { SeatsService } from './seats.service';
|
||||
import { SeatsService } from "./seats.service";
|
||||
|
||||
@ApiTags('seats')
|
||||
@ApiTags("seats")
|
||||
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
|
||||
@Controller('seats')
|
||||
@Controller("seats")
|
||||
export class SeatsController {
|
||||
constructor(private readonly seatsService: SeatsService) {}
|
||||
|
||||
@Get('schedule/:scheduleId')
|
||||
@ApiOperation({ summary: 'List seats for a schedule' })
|
||||
findBySchedule(@Param('scheduleId', ParseUUIDPipe) scheduleId: string) {
|
||||
@Get("schedule/:scheduleId")
|
||||
@ApiOperation({ summary: "List seats for a schedule" })
|
||||
findBySchedule(@Param("scheduleId", ParseUUIDPipe) scheduleId: string) {
|
||||
return this.seatsService.findBySchedule(scheduleId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 { Seat } from './entities/seat.entity';
|
||||
import { SeatsController } from './seats.controller';
|
||||
import { SeatsService } from './seats.service';
|
||||
import { Seat } from "./entities/seat.entity";
|
||||
import { SeatsController } from "./seats.controller";
|
||||
import { SeatsService } from "./seats.service";
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Seat])],
|
||||
|
||||
@@ -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 { Seat } from './entities/seat.entity';
|
||||
import { Seat } from "./entities/seat.entity";
|
||||
|
||||
@Injectable()
|
||||
export class SeatsService {
|
||||
@@ -15,7 +15,7 @@ export class SeatsService {
|
||||
findBySchedule(scheduleId: string): Promise<Seat[]> {
|
||||
return this.seatsRepository.find({
|
||||
where: { scheduleId },
|
||||
order: { seatNumber: 'ASC' },
|
||||
order: { seatNumber: "ASC" },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user