get carreras
This commit is contained in:
@@ -21,6 +21,7 @@ import { EjesEstrategicosModule } from './ejesEstrategicos/ejesEstrategicos.modu
|
||||
import { LineasProgramaticasController } from './lineasProgramaticas/lineasProgramaticas.controller';
|
||||
import { LineasProgramaticasService } from './lineasProgramaticas/lineasProgramaticas.service';
|
||||
import { LineasProgramaticasModule } from './lineasProgramaticas/lineasProgramaticas.module';
|
||||
import { CarreraModule } from './carrera/carreras.module';
|
||||
config({ path: '.env' });
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -28,6 +29,7 @@ config({ path: '.env' });
|
||||
UsersModule,
|
||||
EjesEstrategicosModule,
|
||||
LineasProgramaticasModule,
|
||||
CarreraModule,
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
}),
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Header,
|
||||
HttpCode,
|
||||
Logger,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { CarrerasService } from './carreras.service';
|
||||
|
||||
@Controller('carrera')
|
||||
export class CarrerasController {
|
||||
constructor(private readonly carrerasService: CarrerasService) {}
|
||||
|
||||
@Header('content-type', 'application/json')
|
||||
@Get('carreras')
|
||||
@HttpCode(200)
|
||||
getEjesEstrategicos() {
|
||||
Logger.log('Carreras', 'getCarreras');
|
||||
return this.carrerasService.findCarreras();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { Carrera } from '../entities/carreras.entity';
|
||||
import { CarrerasService } from './carreras.service';
|
||||
import { CarrerasController } from './carreras.controller';
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([Carrera])],
|
||||
providers: [CarrerasService],
|
||||
controllers: [CarrerasController],
|
||||
exports: [TypeOrmModule.forFeature([CarrerasService])],
|
||||
})
|
||||
export class CarreraModule {}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { EjeEstrategico } from '../entities/ejesEstrategicos.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Carrera } from '../entities/carreras.entity';
|
||||
|
||||
@Injectable()
|
||||
export class CarrerasService {
|
||||
constructor(
|
||||
@InjectRepository(Carrera)
|
||||
private carreraRepository: Repository<Carrera>,
|
||||
) {}
|
||||
|
||||
findCarreras(): Promise<Carrera[]> {
|
||||
return this.carreraRepository.find({});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user