added plataforma
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user