add carrera
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { AlumnoSancion } from 'src/alumno_sancion/entities/alumno_sancion.entity';
|
import { AlumnoSancion } from 'src/alumno_sancion/entities/alumno_sancion.entity';
|
||||||
|
import { Carrera } from 'src/carrera/entities/carrera.entity';
|
||||||
import { DetalleServicio } from 'src/detalle_servicio/entities/detalle_servicio.entity';
|
import { DetalleServicio } from 'src/detalle_servicio/entities/detalle_servicio.entity';
|
||||||
import { Recibo } from 'src/recibo/entities/recibo.entity';
|
import { Recibo } from 'src/recibo/entities/recibo.entity';
|
||||||
import {
|
import {
|
||||||
@@ -10,23 +11,6 @@ import {
|
|||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity({ name: 'carrera' })
|
|
||||||
export class Carrera {
|
|
||||||
@PrimaryGeneratedColumn({ name: 'id_carrera', type: 'int', unsigned: true })
|
|
||||||
id_carrera: number;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
name: 'carrera',
|
|
||||||
type: 'varchar',
|
|
||||||
length: 100,
|
|
||||||
nullable: false,
|
|
||||||
})
|
|
||||||
carrera: string;
|
|
||||||
|
|
||||||
@OneToMany(() => Alumno, (student) => student.carrera)
|
|
||||||
estudiantes: Alumno[];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entity({ name: 'alumno' })
|
@Entity({ name: 'alumno' })
|
||||||
export class Alumno {
|
export class Alumno {
|
||||||
@PrimaryGeneratedColumn({ name: 'id_cuenta', type: 'int', unsigned: true })
|
@PrimaryGeneratedColumn({ name: 'id_cuenta', type: 'int', unsigned: true })
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ import { Module } from '@nestjs/common';
|
|||||||
import { AlumnoService } from './student.service';
|
import { AlumnoService } from './student.service';
|
||||||
import { AlumnoController } from './student.controller';
|
import { AlumnoController } from './student.controller';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { Alumno, Carrera } from './entities/student.entity';
|
import { Alumno } from './entities/student.entity';
|
||||||
|
import { Carrera } from 'src/carrera/entities/carrera.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Alumno,Carrera])],
|
imports: [TypeOrmModule.forFeature([Alumno, Carrera])],
|
||||||
controllers: [AlumnoController],
|
controllers: [AlumnoController],
|
||||||
providers: [AlumnoService],
|
providers: [AlumnoService],
|
||||||
exports:[AlumnoService]
|
exports: [AlumnoService],
|
||||||
})
|
})
|
||||||
export class AlumnoModule {}
|
export class AlumnoModule {}
|
||||||
//IO
|
//IO
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { CreateStudentDto } from './dto/create-student.dto';
|
import { CreateStudentDto } from './dto/create-student.dto';
|
||||||
import { Alumno, Carrera } from './entities/student.entity';
|
import { Alumno } from './entities/student.entity';
|
||||||
import { EntityManager, Repository } from 'typeorm';
|
import { EntityManager, Repository } from 'typeorm';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
|
import { Carrera } from 'src/carrera/entities/carrera.entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlumnoService {
|
export class AlumnoService {
|
||||||
|
|||||||
+8
-2
@@ -9,7 +9,7 @@ import { Perfil, User } from './user/entities/user.entity';
|
|||||||
import { DetalleServicioModule } from './detalle_servicio/detalle_servicio.module';
|
import { DetalleServicioModule } from './detalle_servicio/detalle_servicio.module';
|
||||||
import { PeriodoModule } from './periodo/periodo.module';
|
import { PeriodoModule } from './periodo/periodo.module';
|
||||||
import { ServicioModule } from './servicio/servicio.module';
|
import { ServicioModule } from './servicio/servicio.module';
|
||||||
import { Alumno, Carrera } from './alumno/entities/student.entity';
|
import { Alumno } from './alumno/entities/student.entity';
|
||||||
import { DetalleServicio } from './detalle_servicio/entities/detalle_servicio.entity';
|
import { DetalleServicio } from './detalle_servicio/entities/detalle_servicio.entity';
|
||||||
import { Periodo } from './periodo/entities/periodo.entity';
|
import { Periodo } from './periodo/entities/periodo.entity';
|
||||||
import { Servicio } from './servicio/entities/servicio.entity';
|
import { Servicio } from './servicio/entities/servicio.entity';
|
||||||
@@ -23,8 +23,13 @@ import { ReciboModule } from './recibo/recibo.module';
|
|||||||
import { MesaModule } from './mesa/mesa.module';
|
import { MesaModule } from './mesa/mesa.module';
|
||||||
import { Mesa } from './mesa/entities/mesa.entity';
|
import { Mesa } from './mesa/entities/mesa.entity';
|
||||||
import { AlumnoInscritoModule } from './alumno_inscrito/alumno_inscrito.module';
|
import { AlumnoInscritoModule } from './alumno_inscrito/alumno_inscrito.module';
|
||||||
import { AlumnoInscrito, Plataforma } from './alumno_inscrito/entities/alumno_inscrito.entity';
|
import {
|
||||||
|
AlumnoInscrito,
|
||||||
|
Plataforma,
|
||||||
|
} from './alumno_inscrito/entities/alumno_inscrito.entity';
|
||||||
import { EquipoModule } from './equipo/equipo.module';
|
import { EquipoModule } from './equipo/equipo.module';
|
||||||
|
import { CarreraModule } from './carrera/carrera.module';
|
||||||
|
import { Carrera } from './carrera/entities/carrera.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -71,6 +76,7 @@ import { EquipoModule } from './equipo/equipo.module';
|
|||||||
MesaModule,
|
MesaModule,
|
||||||
AlumnoInscritoModule,
|
AlumnoInscritoModule,
|
||||||
EquipoModule,
|
EquipoModule,
|
||||||
|
CarreraModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [AppService],
|
providers: [AppService],
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Controller, Get } from '@nestjs/common';
|
||||||
|
import { CarreraService } from './carrera.service';
|
||||||
|
|
||||||
|
@Controller('carrera')
|
||||||
|
export class CarreraController {
|
||||||
|
constructor(private readonly carreraService: CarreraService) {}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
findAll() {
|
||||||
|
return this.carreraService.findAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { CarreraService } from './carrera.service';
|
||||||
|
import { CarreraController } from './carrera.controller';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { Carrera } from './entities/carrera.entity';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
imports: [TypeOrmModule.forFeature([Carrera])],
|
||||||
|
controllers: [CarreraController],
|
||||||
|
providers: [CarreraService],
|
||||||
|
})
|
||||||
|
export class CarreraModule {}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
|
import { Carrera } from './entities/carrera.entity';
|
||||||
|
import { Repository } from 'typeorm';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class CarreraService {
|
||||||
|
constructor(
|
||||||
|
@InjectRepository(Carrera)
|
||||||
|
private readonly carreraRepository: Repository<Carrera>,
|
||||||
|
) {}
|
||||||
|
findAll() {
|
||||||
|
return this.carreraRepository.find();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export class CreateCarreraDto {}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { PartialType } from '@nestjs/mapped-types';
|
||||||
|
import { CreateCarreraDto } from './create-carrera.dto';
|
||||||
|
|
||||||
|
export class UpdateCarreraDto extends PartialType(CreateCarreraDto) {}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { Alumno } from 'src/alumno/entities/student.entity';
|
||||||
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
|
@Entity({ name: 'carrera' })
|
||||||
|
export class Carrera {
|
||||||
|
@PrimaryGeneratedColumn({ name: 'id_carrera', type: 'int', unsigned: true })
|
||||||
|
id_carrera: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'carrera',
|
||||||
|
type: 'varchar',
|
||||||
|
length: 100,
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
carrera: string;
|
||||||
|
|
||||||
|
@OneToMany(() => Alumno, (student) => student.carrera)
|
||||||
|
estudiantes: Alumno[];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user