Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x | import { Body, Controller, Get, Param, ParseIntPipe, Post, Req, UseGuards } from '@nestjs/common';
import { JwtAuthGuard } from '@app/common/guards/jwt-auth.guard';
import { QuickRentService } from '@app/modules/quick-rent/quick-rent.service';
import { Type } from 'class-transformer';
import { IsDate, IsInt, IsObject, IsOptional, IsString } from 'class-validator';
class CreateQuickRentRequestDto {
@IsString() city!: string;
@IsObject() specs!: Record<string, any>;
@IsOptional() @IsInt() budgetMin?: number;
@IsOptional() @IsInt() budgetMax?: number;
@IsOptional() @IsDate() @Type(() => Date) moveInDate?: Date;
@IsDate() @Type(() => Date) bidEndsAt!: Date;
}
class PlaceBidDto { @IsInt() amountCents!: number; }
@Controller('quick-rent')
export class QuickRentController {
constructor(private readonly service: QuickRentService) {}
@Post('requests')
@UseGuards(JwtAuthGuard)
create(@Body() dto: CreateQuickRentRequestDto, @Req() req: any) {
return this.service.createRequest(req.user.id, dto);
}
@Get('requests/:id')
@UseGuards(JwtAuthGuard)
getMine(@Param('id', ParseIntPipe) id: number, @Req() req: any) {
return this.service.getRequestForOwner(id, req.user.id);
}
@Get('requests/:id/public')
getPublic(@Param('id', ParseIntPipe) id: number) {
return this.service.getRequestPublic(id);
}
@Post('requests/:id/bids')
@UseGuards(JwtAuthGuard)
placeBid(
@Param('id', ParseIntPipe) id: number,
@Body() dto: PlaceBidDto,
@Req() req: any,
) {
return this.service.placeBid(id, req.user, dto.amountCents);
}
@Post('requests/:id/close')
@UseGuards(JwtAuthGuard)
closeEarly(@Param('id', ParseIntPipe) id: number, @Req() req: any) {
return this.service.closeEarly(id, req.user.id);
}
@Post('leads/:id/dispute')
@UseGuards(JwtAuthGuard)
disputeLead(
@Param('id', ParseIntPipe) id: number,
@Req() req: any,
@Body() body: { reason: string },
) {
return this.service.disputeLeadAccess(id, req.user, body);
}
}
|