added plataforma

This commit is contained in:
2025-11-03 19:33:33 -06:00
parent 3c23ad8a01
commit ecc8858f90
5 changed files with 55 additions and 2 deletions
@@ -0,0 +1,9 @@
import {
IsString,
Length,
IsDateString,
IsOptional,
IsBoolean,
} from 'class-validator';
export class PlataformaDto {}
@@ -0,0 +1,4 @@
import { Controller, Get, Param } from '@nestjs/common';
@Controller('plataforma')
export class PlataformaController {}
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { PlataformaController } from './periodo.controller';
import { PlataformaService } from './periodo.service';
@Module({
controllers: [PlataformaController],
providers: [PlataformaService],
exports: [PlataformaService],
})
export class PlataformaModule {}
@@ -0,0 +1,23 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Plataforma } from 'src/database/AT/entities/alumno_inscrito.entity';
import { Repository } from 'typeorm';
@Injectable()
export class PlataformaService {
constructor(
@InjectRepository(Plataforma)
private readonly plataformaRepository: Repository<Plataforma>,
) {}
async getByName(nombre: string): Promise<Plataforma> {
const plataforma = await this.plataformaRepository.findOne({
where: { nombre },
});
if (!plataforma) {
throw new NotFoundException('plataforma no encontrado');
}
return plataforma;
}
}