import { ApiProperty } from "@nestjs/swagger"; import { DtoClass } from "@/common/dtoClass.factory"; type StarRating = 0 | 1 | 2 | 3 | 4 | 5; export type SkillType = { name: string; category: string; description: string; stars: StarRating; }; export class SkillDto extends DtoClass() implements SkillType { @ApiProperty() readonly name: string; @ApiProperty() readonly category: string; @ApiProperty() readonly description: string; @ApiProperty() readonly stars: StarRating; constructor(skill: SkillType) { super(skill); Object.assign(this, { name: skill.name, category: skill.category, descriptions: skill.description, stars: skill.stars, }); } }