CV/src/app.controller.ts

69 lines
2.0 KiB
TypeScript

import { Controller, Get } from "@nestjs/common";
import { AppService } from "@/app.service";
import { ApiExcludeEndpoint, ApiExtraModels, ApiOkResponse, ApiTags, getSchemaPath } from "@nestjs/swagger";
import { SkillsService } from "@/skills/skills.service";
import { ExperiencesService } from "@/experiences/experiences.service";
import { SkillDto } from "@/skills/skills.types";
import { ExperienceDto } from "@/experiences/experiences.types";
import { EducationDto } from "@/education/education.types";
import { EducationService } from "@/education/education.service";
@Controller()
@ApiExtraModels(SkillDto, ExperienceDto, EducationDto)
export class AppController {
constructor(
private readonly appService: AppService,
private readonly skillsService: SkillsService,
private readonly experiencesService: ExperiencesService,
private readonly educationService: EducationService
) {}
@Get()
@ApiExcludeEndpoint()
sayHello(): string {
return this.appService.sayHello();
}
@Get("skills")
@ApiTags("Skills")
@ApiOkResponse({
description: "Returns a list of all skills",
schema: {
items: {
$ref: getSchemaPath(SkillDto),
},
},
})
getSkills(): readonly SkillDto[] {
return this.skillsService.getMany();
}
@Get("experiences")
@ApiTags("Experience")
@ApiOkResponse({
description: "Returns a list of previous work experiences",
schema: {
items: {
$ref: getSchemaPath(ExperienceDto),
},
},
})
getExperiences(): readonly ExperienceDto[] {
return this.experiencesService.getMany();
}
@Get("education")
@ApiTags("Education")
@ApiOkResponse({
description: "Returns a list of received education",
schema: {
items: {
$ref: getSchemaPath(EducationDto),
},
},
})
getEducation(): readonly EducationDto[] {
return this.educationService.getMany();
}
}