Spaces:
Running
Running
File size: 1,017 Bytes
f78b36a c35b446 f78b36a c35b446 f78b36a c35b446 f78b36a | 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 | 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
*/
@Controller("education")
@UseGuards(JwtAuthGuard)
export class EducationController {
constructor(private readonly educationService: EducationService) {}
@Get()
@HttpCode(HttpStatus.OK)
findAll(@Request() req: any, @Query("category") category?: string) {
if (category) {
return this.educationService.findByCategory(category);
}
return this.educationService.findAll(req.user.id);
}
@Get(":id")
@HttpCode(HttpStatus.OK)
findOne(@Param("id") id: string) {
return this.educationService.findOne(id);
}
}
|