Spaces:
Running
Running
| import { | |
| Controller, | |
| Get, | |
| Param, | |
| Query, | |
| UseGuards, | |
| HttpCode, | |
| HttpStatus, | |
| Request, | |
| } from "@nestjs/common"; | |
| import { EducationService } from "./education.service"; | |
| import { JwtAuthGuard } from "../auth/guards/jwt-auth.guard"; | |
| /** | |
| * Education Controller | |
| * | |
| * ENDPOINTS: | |
| * - GET /education - List all articles (optional category filter) | |
| * - GET /education/:id - Get specific article | |
| * | |
| * RESTRICTIONS: | |
| * - Authenticated users only | |
| * - Read-only access | |
| */ | |
| ("education") | |
| (JwtAuthGuard) | |
| export class EducationController { | |
| constructor(private readonly educationService: EducationService) {} | |
| () | |
| (HttpStatus.OK) | |
| findAll(() req: any, ("category") category?: string) { | |
| if (category) { | |
| return this.educationService.findByCategory(category); | |
| } | |
| return this.educationService.findAll(req.user.id); | |
| } | |
| (":id") | |
| (HttpStatus.OK) | |
| findOne(("id") id: string) { | |
| return this.educationService.findOne(id); | |
| } | |
| } | |