File

src/orders/pod/pod.controller.ts

Prefix

pod

Index

Methods

Methods

Async getPendingPods
getPendingPods(orgId: string)
Decorators :
@Get()
Parameters :
Name Type Optional
orgId string No
Returns : unknown
Async getPod
getPod(orderId: string)
Decorators :
@Get(':orderId')
Parameters :
Name Type Optional
orderId string No
Returns : unknown
Async submitPod
submitPod(orderId: string, body: literal type)
Decorators :
@Post(':orderId')
Parameters :
Name Type Optional
orderId string No
body literal type No
Returns : unknown
import {
  Controller,
  Post,
  Get,
  Param,
  Body,
  UseGuards,
} from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { PodService } from './pod.service';
import { CombinedAuthGuard } from '../../auth/guards/combined-auth.guard';
import { CurrentUser } from '../../auth/decorators/current-user.decorator';

@ApiTags('Proof of Delivery')
@ApiBearerAuth()
@UseGuards(CombinedAuthGuard)
@Controller('pod')
export class PodController {
  constructor(private podService: PodService) {}

  @Post(':orderId')
  async submitPod(
    @Param('orderId') orderId: string,
    @Body()
    body: {
      recipientName: string;
      recipientSignature?: string;
      photos?: string[];
      notes?: string;
      latitude?: number;
      longitude?: number;
    },
  ) {
    return this.podService.submitPod(orderId, body);
  }

  @Get(':orderId')
  async getPod(@Param('orderId') orderId: string) {
    return this.podService.getPod(orderId);
  }

  @Get()
  async getPendingPods(@CurrentUser('organizationId') orgId: string) {
    return this.podService.getPendingPods(orgId);
  }
}

results matching ""

    No results matching ""