mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-02 09:13:42 +00:00
chore: fmt
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import { BaseEntity } from '@edr/api-common';
|
||||
import { Freight } from '@edr/types';
|
||||
import { Column, Entity } from 'typeorm';
|
||||
import { BaseEntity } from "@edr/api-common";
|
||||
import { Freight } from "@edr/types";
|
||||
import { Column, Entity } from "typeorm";
|
||||
|
||||
@Entity({ name: 'tracking_events' })
|
||||
@Entity({ name: "tracking_events" })
|
||||
export class TrackingEvent extends BaseEntity {
|
||||
@Column({ name: 'consignment_id', type: 'uuid' })
|
||||
@Column({ name: "consignment_id", type: "uuid" })
|
||||
consignmentId!: string;
|
||||
|
||||
@Column({ name: 'location', type: 'varchar', length: 256 })
|
||||
@Column({ name: "location", type: "varchar", length: 256 })
|
||||
location!: string;
|
||||
|
||||
@Column({ name: 'status', type: 'enum', enum: Freight.ConsignmentStatus })
|
||||
@Column({ name: "status", type: "enum", enum: Freight.ConsignmentStatus })
|
||||
status!: Freight.ConsignmentStatus;
|
||||
|
||||
@Column({ name: 'occurred_at', type: 'timestamptz' })
|
||||
@Column({ name: "occurred_at", type: "timestamptz" })
|
||||
occurredAt!: Date;
|
||||
|
||||
@Column({ name: 'description', type: 'text', nullable: true })
|
||||
@Column({ name: "description", type: "text", nullable: true })
|
||||
description?: string | null;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
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 { TrackingService } from './tracking.service';
|
||||
import { TrackingService } from "./tracking.service";
|
||||
|
||||
@ApiTags('tracking')
|
||||
@ApiTags("tracking")
|
||||
// @UseGuards(JwtAuthGuard) — TODO: integrate @edr/auth
|
||||
@Controller('tracking')
|
||||
@Controller("tracking")
|
||||
export class TrackingController {
|
||||
constructor(private readonly trackingService: TrackingService) {}
|
||||
|
||||
@Get(':consignmentId')
|
||||
@ApiOperation({ summary: 'Get the tracking timeline for a consignment' })
|
||||
findByConsignment(@Param('consignmentId', ParseUUIDPipe) consignmentId: string) {
|
||||
@Get(":consignmentId")
|
||||
@ApiOperation({ summary: "Get the tracking timeline for a consignment" })
|
||||
findByConsignment(
|
||||
@Param("consignmentId", ParseUUIDPipe) consignmentId: string,
|
||||
) {
|
||||
return this.trackingService.findByConsignment(consignmentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 { TrackingEvent } from './entities/tracking-event.entity';
|
||||
import { TrackingController } from './tracking.controller';
|
||||
import { TrackingService } from './tracking.service';
|
||||
import { TrackingEvent } from "./entities/tracking-event.entity";
|
||||
import { TrackingController } from "./tracking.controller";
|
||||
import { TrackingService } from "./tracking.service";
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([TrackingEvent])],
|
||||
|
||||
@@ -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 { TrackingEvent } from './entities/tracking-event.entity';
|
||||
import { TrackingEvent } from "./entities/tracking-event.entity";
|
||||
|
||||
@Injectable()
|
||||
export class TrackingService {
|
||||
@@ -15,7 +15,7 @@ export class TrackingService {
|
||||
findByConsignment(consignmentId: string): Promise<TrackingEvent[]> {
|
||||
return this.trackingRepository.find({
|
||||
where: { consignmentId },
|
||||
order: { occurredAt: 'ASC' },
|
||||
order: { occurredAt: "ASC" },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user