Spaces:
Paused
Paused
Download src/trips/trips.controller.ts from IlyasDaoud/omnia-rides-api: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/spaces/IlyasDaoud/omnia-rides-api/resolve/main/src/trips/trips.controller.ts
- Command line
-
hf download hf://spaces/IlyasDaoud/omnia-rides-api/src/trips/trips.controller.ts
-
curl -L -o trips.controller.ts https://huggingface.co/spaces/IlyasDaoud/omnia-rides-api/resolve/main/src/trips/trips.controller.ts
1.56 kB
| import { Body, Controller, Get, Param, Patch, Post, UseGuards } from '@nestjs/common'; | |
| import { Type } from 'class-transformer'; | |
| import { IsIn, IsNumber, IsOptional, IsString, Max, Min } from 'class-validator'; | |
| import type { User } from '@prisma/client'; | |
| import { TripsService } from './trips.service'; | |
| import { AuthGuard } from '../auth/auth.guard'; | |
| import { CurrentUser } from '../auth/current-user.decorator'; | |
| class CreateTripDto { | |
| () rideClassId!: string; | |
| () () pickup?: string; | |
| () () dropoff?: string; | |
| () (() => Number) () (1) (200) distanceKm?: number; | |
| () (['web', 'agent']) source?: 'web' | 'agent'; | |
| } | |
| class UpdateTripDto { | |
| () () pickup?: string; | |
| () () dropoff?: string; | |
| () (() => Number) () (1) (200) distanceKm?: number; | |
| } | |
| ('trips') | |
| (AuthGuard) | |
| export class TripsController { | |
| constructor(private readonly trips: TripsService) {} | |
| () | |
| create(() user: User, () dto: CreateTripDto) { | |
| return this.trips.create(user, dto); | |
| } | |
| () | |
| listMine(() user: User) { | |
| return this.trips.listMine(user); | |
| } | |
| (':id/cancel') | |
| cancel(() user: User, ('id') id: string) { | |
| return this.trips.cancel(user, id); | |
| } | |
| (':id') | |
| update(() user: User, ('id') id: string, () dto: UpdateTripDto) { | |
| return this.trips.update(user, id, dto); | |
| } | |
| } | |