Spaces:
Sleeping
Sleeping
Download src/modules/campaigns/availability.controller.ts from mahrooshishaq/SmartfolioBackend: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/campaigns/availability.controller.ts
- Command line
-
hf download hf://spaces/mahrooshishaq/SmartfolioBackend/src/modules/campaigns/availability.controller.ts
-
curl -L -o availability.controller.ts https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/campaigns/availability.controller.ts
1.59 kB
| import { Body, Controller, Get, Patch, Req, UseGuards } from '@nestjs/common'; | |
| import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; | |
| import { IsIn } from 'class-validator'; | |
| import { ApiProperty } from '@nestjs/swagger'; | |
| import type { Request } from 'express'; | |
| import { CampaignsService } from './campaigns.service'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| export class SetAvailabilityDto { | |
| ({ enum: ['looking', 'suspended'] }) | |
| (['looking', 'suspended']) | |
| availability!: 'looking' | 'suspended'; | |
| } | |
| /** | |
| * The candidate's own job-seeking status. | |
| * | |
| * Deliberately NOT under /admin. A suspension exists to ask one question - "are | |
| * you still looking?" - and only the person can answer it. An operator who could | |
| * clear it for them would be answering on their behalf, which is how you end up | |
| * putting a no-show in front of a fourth company. | |
| */ | |
| ('Availability') | |
| () | |
| ('me/availability') | |
| (JwtAuthGuard) | |
| export class AvailabilityController { | |
| constructor(private readonly campaigns: CampaignsService) {} | |
| () | |
| ({ summary: 'My job-seeking status, and the history behind it' }) | |
| async get(() req: Request) { | |
| const user = req.user as { id: string }; | |
| return this.campaigns.availabilityFor(user.id); | |
| } | |
| () | |
| ({ summary: 'Set my job-seeking status' }) | |
| async set(() req: Request, () dto: SetAvailabilityDto) { | |
| const user = req.user as { id: string }; | |
| return this.campaigns.setAvailability(user.id, dto.availability); | |
| } | |
| } | |