Spaces:
Sleeping
Sleeping
Download src/modules/applications/applications.controller.ts from mahrooshishaq/SmartfolioBackend: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/applications/applications.controller.ts
- Command line
-
hf download hf://spaces/mahrooshishaq/SmartfolioBackend/src/modules/applications/applications.controller.ts
-
curl -L -o applications.controller.ts https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/applications/applications.controller.ts
2.36 kB
| import { Body, Controller, Delete, Get, Param, Patch, Post, Query, Req, UseGuards } from '@nestjs/common'; | |
| import { ApiBearerAuth, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| import { ApplicationsService, CreateApplicationDto, UpdateApplicationDto } from './applications.service'; | |
| import { APPLICATION_STATUSES } from './job-application.entity'; | |
| import { UsersService } from '../users/users.service'; | |
| ('Applications') | |
| ('applications') | |
| (JwtAuthGuard) | |
| () | |
| export class ApplicationsController { | |
| constructor( | |
| private readonly applicationsService: ApplicationsService, | |
| private readonly usersService: UsersService, | |
| ) {} | |
| /** | |
| * Tracking or updating an application is the strongest intent signal the | |
| * portal has, so it drives the activity window that decides whose feed gets | |
| * refreshed overnight. Not awaited: the bump is bookkeeping and must never | |
| * turn a successful save into a failed request. | |
| */ | |
| private touch(userId: string) { | |
| void this.usersService.markActive(userId).catch(() => undefined); | |
| } | |
| () | |
| ({ | |
| summary: 'Track a job (from feed via jobId, or manual entry)', | |
| description: 'Pass { jobId } to snapshot a job from your feed, or { title, apply_url, ... } for a job found outside the portal. The entry is a frozen copy: feed expiry never affects it.', | |
| }) | |
| create(() req: any, () dto: CreateApplicationDto) { | |
| this.touch(req.user.id); | |
| return this.applicationsService.create(req.user.id, dto); | |
| } | |
| () | |
| ({ summary: 'List tracked applications with counts by status' }) | |
| ({ name: 'status', required: false, enum: APPLICATION_STATUSES }) | |
| list(() req: any, ('status') status?: string) { | |
| return this.applicationsService.list(req.user.id, status); | |
| } | |
| (':id') | |
| ({ summary: 'Update status, notes, or applied date' }) | |
| update(() req: any, ('id') id: string, () dto: UpdateApplicationDto) { | |
| this.touch(req.user.id); | |
| return this.applicationsService.update(req.user.id, id, dto); | |
| } | |
| (':id') | |
| ({ summary: 'Remove a tracked application' }) | |
| remove(() req: any, ('id') id: string) { | |
| return this.applicationsService.remove(req.user.id, id); | |
| } | |
| } | |