Spaces:
Sleeping
Sleeping
Download src/modules/document-generation/document-generation.controller.ts from mahrooshishaq/SmartfolioBackend: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/document-generation/document-generation.controller.ts
- Command line
-
hf download hf://spaces/mahrooshishaq/SmartfolioBackend/src/modules/document-generation/document-generation.controller.ts
-
curl -L -o document-generation.controller.ts https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/document-generation/document-generation.controller.ts
1.94 kB
| import { | |
| Controller, | |
| Post, | |
| Get, | |
| Body, | |
| UseGuards, | |
| Req, | |
| HttpCode, | |
| HttpStatus, | |
| Param, | |
| } from '@nestjs/common'; | |
| import { | |
| ApiTags, | |
| ApiBearerAuth, | |
| ApiOperation, | |
| ApiOkResponse, | |
| ApiUnauthorizedResponse, | |
| } from '@nestjs/swagger'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| import { AuthenticatedRequest } from '../../common/interfaces/authenticated-request.interface'; | |
| import { DocumentGenerationService } from './document-generation.service'; | |
| import { GenerateDocumentDto } from './dto/generate-document.dto'; | |
| ('Document Generation') | |
| () | |
| ({ description: 'Missing or invalid JWT token' }) | |
| ('document-generation') | |
| (JwtAuthGuard) | |
| export class DocumentGenerationController { | |
| constructor(private readonly service: DocumentGenerationService) {} | |
| ('generate') | |
| (HttpStatus.OK) | |
| ({ | |
| summary: 'Generate a document (cover letter, email, or personal statement)', | |
| description: 'Returns the generated document content along with a documentId for retrieval.', | |
| }) | |
| ({ | |
| description: 'Document generated successfully', | |
| schema: { | |
| example: { | |
| documentId: 'uuid', | |
| title: 'Cover Letter: Acme Corp', | |
| content: 'Dear Hiring Manager...', | |
| }, | |
| }, | |
| }) | |
| async generate( | |
| () req: AuthenticatedRequest, | |
| () dto: GenerateDocumentDto, | |
| ) { | |
| return this.service.generate(req.user.id, dto); | |
| } | |
| ('history') | |
| ({ summary: 'Get the current user past generated documents' }) | |
| async history(() req: AuthenticatedRequest) { | |
| return this.service.getHistory(req.user.id); | |
| } | |
| (':id') | |
| ({ summary: 'Get details of a specific generated document' }) | |
| async getDocument( | |
| () req: AuthenticatedRequest, | |
| ('id') id: string, | |
| ) { | |
| return this.service.getDocumentDetail(req.user.id, id); | |
| } | |
| } | |