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,4 +1,4 @@
import { IsNumber, IsOptional, IsString } from 'class-validator';
import { IsNumber, IsOptional, IsString } from "class-validator";
export class CreateStationDto {
@IsString()

View File

@@ -1,23 +1,35 @@
import { BaseEntity } from '@edr/api-common';
import { Column, Entity } from 'typeorm';
import { BaseEntity } from "@edr/api-common";
import { Column, Entity } from "typeorm";
@Entity({ name: 'stations' })
@Entity({ name: "stations" })
export class Station extends BaseEntity {
@Column({ name: 'code', type: 'varchar', length: 16, unique: true })
@Column({ name: "code", type: "varchar", length: 16, unique: true })
code!: string;
@Column({ name: 'name', type: 'varchar', length: 128 })
@Column({ name: "name", type: "varchar", length: 128 })
name!: string;
@Column({ name: 'city', type: 'varchar', length: 128 })
@Column({ name: "city", type: "varchar", length: 128 })
city!: string;
@Column({ name: 'country', type: 'varchar', length: 64 })
@Column({ name: "country", type: "varchar", length: 64 })
country!: string;
@Column({ name: 'latitude', type: 'numeric', precision: 9, scale: 6, nullable: true })
@Column({
name: "latitude",
type: "numeric",
precision: 9,
scale: 6,
nullable: true,
})
latitude?: number | null;
@Column({ name: 'longitude', type: 'numeric', precision: 9, scale: 6, nullable: true })
@Column({
name: "longitude",
type: "numeric",
precision: 9,
scale: 6,
nullable: true,
})
longitude?: number | null;
}

View File

@@ -1,30 +1,37 @@
import { Body, Controller, Get, Param, ParseUUIDPipe, Post } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import {
Body,
Controller,
Get,
Param,
ParseUUIDPipe,
Post,
} from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { CreateStationDto } from './dto/create-station.dto';
import { StationsService } from './stations.service';
import { CreateStationDto } from "./dto/create-station.dto";
import { StationsService } from "./stations.service";
@ApiTags('stations')
@ApiTags("stations")
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
@Controller('stations')
@Controller("stations")
export class StationsController {
constructor(private readonly stationsService: StationsService) {}
@Post()
@ApiOperation({ summary: 'Register a new station' })
@ApiOperation({ summary: "Register a new station" })
create(@Body() dto: CreateStationDto) {
return this.stationsService.create(dto);
}
@Get()
@ApiOperation({ summary: 'List all stations' })
@ApiOperation({ summary: "List all stations" })
findAll() {
return this.stationsService.findAll();
}
@Get(':id')
@ApiOperation({ summary: 'Get a station by ID' })
findOne(@Param('id', ParseUUIDPipe) id: string) {
@Get(":id")
@ApiOperation({ summary: "Get a station by ID" })
findOne(@Param("id", ParseUUIDPipe) id: string) {
return this.stationsService.findById(id);
}
}

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 { Station } from './entities/station.entity';
import { StationsController } from './stations.controller';
import { StationsService } from './stations.service';
import { Station } from "./entities/station.entity";
import { StationsController } from "./stations.controller";
import { StationsService } from "./stations.service";
@Module({
imports: [TypeOrmModule.forFeature([Station])],

View File

@@ -1,9 +1,9 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Injectable, NotFoundException } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";
import { CreateStationDto } from './dto/create-station.dto';
import { Station } from './entities/station.entity';
import { CreateStationDto } from "./dto/create-station.dto";
import { Station } from "./entities/station.entity";
@Injectable()
export class StationsService {
@@ -20,7 +20,7 @@ export class StationsService {
/** List every station (alphabetical). */
findAll(): Promise<Station[]> {
return this.stationsRepository.find({ order: { name: 'ASC' } });
return this.stationsRepository.find({ order: { name: "ASC" } });
}
/** Get a single station by ID. */