fixed foreign key
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { Student } from 'src/alumno/entities/student.entity';
|
import { Alumno } from 'src/alumno/entities/student.entity';
|
||||||
import { DetalleServicio } from 'src/detalle_servicio/entities/detalle_servicio.entity';
|
import { DetalleServicio } from 'src/detalle_servicio/entities/detalle_servicio.entity';
|
||||||
import { OperationsController } from './operations.controller';
|
import { OperationsController } from './operations.controller';
|
||||||
import { OperationsService } from './operations.services';
|
import { OperationsService } from './operations.services';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
TypeOrmModule.forFeature([Student, DetalleServicio]), // entidades que usarán las transacciones
|
TypeOrmModule.forFeature([Alumno, DetalleServicio]), // entidades que usarán las transacciones
|
||||||
],
|
],
|
||||||
controllers: [OperationsController],
|
controllers: [OperationsController],
|
||||||
providers: [OperationsService],
|
providers: [OperationsService],
|
||||||
|
|||||||
@@ -9,25 +9,25 @@ import {
|
|||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
@Entity({ name: 'carrea' })
|
@Entity({ name: 'carrera' })
|
||||||
export class Carrera {
|
export class Carrera {
|
||||||
@PrimaryGeneratedColumn({ name: 'id_carrera', type: 'int', unsigned: true })
|
@PrimaryGeneratedColumn({ name: 'id_carrera', type: 'int', unsigned: true })
|
||||||
id_carrera: number;
|
id_carrera: number;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
name: 'nombre_carrea',
|
name: 'carrera',
|
||||||
type: 'varchar',
|
type: 'varchar',
|
||||||
length: 100,
|
length: 100,
|
||||||
nullable: false,
|
nullable: false,
|
||||||
})
|
})
|
||||||
nombre_carrea: string;
|
carrera: string;
|
||||||
|
|
||||||
@OneToMany(() => Student, (id_carrera) => id_carrera.id_cuenta)
|
@OneToMany(() => Alumno, (student) => student.carrera)
|
||||||
id_carreras: Student[];
|
estudiantes: Alumno[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity({ name: 'alumno' })
|
@Entity({ name: 'alumno' })
|
||||||
export class Student {
|
export class Alumno {
|
||||||
@PrimaryGeneratedColumn({ name: 'id_cuenta', type: 'int', unsigned: true })
|
@PrimaryGeneratedColumn({ name: 'id_cuenta', type: 'int', unsigned: true })
|
||||||
id_cuenta: number;
|
id_cuenta: number;
|
||||||
|
|
||||||
@@ -83,19 +83,16 @@ export class Student {
|
|||||||
@Column({ name: 'generacion', type: 'int', width: 4, nullable: true })
|
@Column({ name: 'generacion', type: 'int', width: 4, nullable: true })
|
||||||
generacion: number | null;
|
generacion: number | null;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(() => DetalleServicio, (detalle) => detalle.id_cuenta)
|
||||||
() => DetalleServicio,
|
|
||||||
(id_detalle_servicio) => id_detalle_servicio.id_cuenta,
|
|
||||||
)
|
|
||||||
detalles_servicio: DetalleServicio[];
|
detalles_servicio: DetalleServicio[];
|
||||||
|
|
||||||
@ManyToOne(() => Carrera, (id_cuenta) => id_cuenta.id_carreras, {
|
@ManyToOne(() => Carrera, (carrera) => carrera.estudiantes, {
|
||||||
eager: true,
|
eager: true,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
@JoinColumn({ name: 'id_carrera' })
|
@JoinColumn({ name: 'id_carrera' })
|
||||||
id_periodos: Carrera;
|
carrera: Carrera;
|
||||||
|
|
||||||
@OneToMany(() => AlumnoSancion, (id_cuenta) => id_cuenta.id_alumno_sancion)
|
@OneToMany(() => AlumnoSancion, (alusancion) => alusancion.id_cuenta)
|
||||||
id_cuentas: AlumnoSancion[];
|
sanciones: AlumnoSancion[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
||||||
import { AlumnoService } from './student.service';
|
import { AlumnoService } from './student.service';
|
||||||
import { CreateStudentDto } from './dto/create-student.dto';
|
import { CreateStudentDto } from './dto/create-student.dto';
|
||||||
import { Student } from './entities/student.entity';
|
import { Alumno } from './entities/student.entity';
|
||||||
|
|
||||||
@Controller('student')
|
@Controller('student')
|
||||||
export class StudentController {
|
export class StudentController {
|
||||||
constructor(private readonly alumnoService: AlumnoService) {}
|
constructor(private readonly alumnoService: AlumnoService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
async create(@Body() createStudentDto: CreateStudentDto): Promise<Student> {
|
async create(@Body() createStudentDto: CreateStudentDto): Promise<Alumno> {
|
||||||
return this.alumnoService.create(createStudentDto);
|
return this.alumnoService.create(createStudentDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async findAll(): Promise<Student[]> {
|
async findAll(): Promise<Alumno[]> {
|
||||||
return this.alumnoService.findAll();
|
return this.alumnoService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import { Module } from '@nestjs/common';
|
|||||||
import { AlumnoService } from './student.service';
|
import { AlumnoService } from './student.service';
|
||||||
import { StudentController } from './student.controller';
|
import { StudentController } from './student.controller';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { Student } from './entities/student.entity';
|
import { Alumno } from './entities/student.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature([Student])],
|
imports: [TypeOrmModule.forFeature([Alumno])],
|
||||||
controllers: [StudentController],
|
controllers: [StudentController],
|
||||||
providers: [AlumnoService],
|
providers: [AlumnoService],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
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 { Student } 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';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlumnoService {
|
export class AlumnoService {
|
||||||
constructor(
|
constructor(
|
||||||
@InjectRepository(Student)
|
@InjectRepository(Alumno)
|
||||||
private readonly studentRepository: Repository<Student>,
|
private readonly studentRepository: Repository<Alumno>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async create(createStudentDto: CreateStudentDto): Promise<Student> {
|
async create(createStudentDto: CreateStudentDto): Promise<Alumno> {
|
||||||
//Hubo pedos con la base , revisar
|
//Hubo pedos con la base , revisar
|
||||||
const student = this.studentRepository.create(createStudentDto);
|
const student = this.studentRepository.create(createStudentDto);
|
||||||
return await this.studentRepository.save(student);
|
return await this.studentRepository.save(student);
|
||||||
}
|
}
|
||||||
|
|
||||||
findAll(): Promise<Student[]> {
|
findAll(): Promise<Alumno[]> {
|
||||||
return this.studentRepository.find({ skip: 5000, take: 50 });
|
return this.studentRepository.find({ skip: 5000, take: 50 });
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(id_cuenta: number): Promise<Student> {
|
async findOne(id_cuenta: number): Promise<Alumno> {
|
||||||
const student = await this.studentRepository.findOne({
|
const student = await this.studentRepository.findOne({
|
||||||
where: { id_cuenta },
|
where: { id_cuenta },
|
||||||
});
|
});
|
||||||
@@ -31,7 +31,7 @@ export class AlumnoService {
|
|||||||
return student;
|
return student;
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetCredit(id_cuenta: number): Promise<Student['credito']> {
|
async GetCredit(id_cuenta: number): Promise<Alumno['credito']> {
|
||||||
const student = await this.findOne(id_cuenta);
|
const student = await this.findOne(id_cuenta);
|
||||||
return student.credito;
|
return student.credito;
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ export class AlumnoService {
|
|||||||
credit: number,
|
credit: number,
|
||||||
manager: EntityManager,
|
manager: EntityManager,
|
||||||
) {
|
) {
|
||||||
const repo = manager.getRepository(Student);
|
const repo = manager.getRepository(Alumno);
|
||||||
return await repo
|
return await repo
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { AlumnoSancionController } from './alumno_sancion.controller';
|
|
||||||
import { AlumnoSancionService } from './alumno_sancion.service';
|
|
||||||
|
|
||||||
describe('AlumnoSancionController', () => {
|
|
||||||
let controller: AlumnoSancionController;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
controllers: [AlumnoSancionController],
|
|
||||||
providers: [AlumnoSancionService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
controller = module.get<AlumnoSancionController>(AlumnoSancionController);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(controller).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,34 +1,17 @@
|
|||||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
|
import { Controller, Get, Param } from '@nestjs/common';
|
||||||
import { AlumnoSancionService } from './alumno_sancion.service';
|
import { AlumnoSancionService } from './alumno_sancion.service';
|
||||||
import { CreateAlumnoSancionDto } from './dto/create-alumno_sancion.dto';
|
|
||||||
import { UpdateAlumnoSancionDto } from './dto/update-alumno_sancion.dto';
|
|
||||||
|
|
||||||
@Controller('alumno-sancion')
|
@Controller('alumno-sancion')
|
||||||
export class AlumnoSancionController {
|
export class AlumnoSancionController {
|
||||||
constructor(private readonly alumnoSancionService: AlumnoSancionService) {}
|
constructor(private readonly alumnoSancionService: AlumnoSancionService) {}
|
||||||
|
|
||||||
@Post()
|
|
||||||
create(@Body() createAlumnoSancionDto: CreateAlumnoSancionDto) {
|
|
||||||
return this.alumnoSancionService.create(createAlumnoSancionDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
findAll() {
|
findAll() {
|
||||||
return this.alumnoSancionService.findAll();
|
return this.alumnoSancionService.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get(':id')
|
@Get(':id')
|
||||||
findOne(@Param('id') id: string) {
|
findOne(@Param('id') id: number) {
|
||||||
return this.alumnoSancionService.findOne(+id);
|
return this.alumnoSancionService.findOne(+id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Patch(':id')
|
|
||||||
update(@Param('id') id: string, @Body() updateAlumnoSancionDto: UpdateAlumnoSancionDto) {
|
|
||||||
return this.alumnoSancionService.update(+id, updateAlumnoSancionDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Delete(':id')
|
|
||||||
remove(@Param('id') id: string) {
|
|
||||||
return this.alumnoSancionService.remove(+id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AlumnoSancionService } from './alumno_sancion.service';
|
import { AlumnoSancionService } from './alumno_sancion.service';
|
||||||
import { AlumnoSancionController } from './alumno_sancion.controller';
|
import { AlumnoSancionController } from './alumno_sancion.controller';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
import { AlumnoSancion } from './entities/alumno_sancion.entity';
|
||||||
|
import { Alumno } from 'src/alumno/entities/student.entity';
|
||||||
|
import { Sancion } from 'src/sancion/entities/sancion.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
imports:[TypeOrmModule.forFeature([AlumnoSancion,Alumno,Sancion])],
|
||||||
controllers: [AlumnoSancionController],
|
controllers: [AlumnoSancionController],
|
||||||
providers: [AlumnoSancionService],
|
providers: [AlumnoSancionService],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { AlumnoSancionService } from './alumno_sancion.service';
|
|
||||||
|
|
||||||
describe('AlumnoSancionService', () => {
|
|
||||||
let service: AlumnoSancionService;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
providers: [AlumnoSancionService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
service = module.get<AlumnoSancionService>(AlumnoSancionService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(service).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,10 +1,7 @@
|
|||||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { CreateAlumnoSancionDto } from './dto/create-alumno_sancion.dto';
|
|
||||||
import { UpdateAlumnoSancionDto } from './dto/update-alumno_sancion.dto';
|
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { AlumnoSancion } from './entities/alumno_sancion.entity';
|
import { AlumnoSancion } from './entities/alumno_sancion.entity';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { Student } from 'src/alumno/entities/student.entity';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AlumnoSancionService {
|
export class AlumnoSancionService {
|
||||||
@@ -13,29 +10,17 @@ export class AlumnoSancionService {
|
|||||||
private readonly alumnosancionRepository: Repository<AlumnoSancion>,
|
private readonly alumnosancionRepository: Repository<AlumnoSancion>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
create(createAlumnoSancionDto: CreateAlumnoSancionDto) {
|
|
||||||
return 'This action adds a new alumnoSancion';
|
|
||||||
}
|
|
||||||
|
|
||||||
findAll() {
|
findAll() {
|
||||||
return `This action returns all alumnoSancion`;
|
return `This action returns all alumnoSancion`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(id_cuenta: CreateAlumnoSancionDto): Promise<AlumnoSancion> {
|
async findOne(id_cuenta: number): Promise<AlumnoSancion> {
|
||||||
const alusancion = await this.alumnosancionRepository.findOne({
|
const alusancion = await this.alumnosancionRepository.findOne({
|
||||||
where: { id_cuenta },
|
where: { id_cuenta:{id_cuenta} },
|
||||||
});
|
});
|
||||||
if (!alusancion) {
|
if (!alusancion) {
|
||||||
throw new NotFoundException(`Student with ID ${id_cuenta} not found`);
|
throw new NotFoundException(`Student with ID ${id_cuenta} not found`);
|
||||||
}
|
}
|
||||||
return alusancion;
|
return alusancion;
|
||||||
}
|
}
|
||||||
|
|
||||||
update(id: number, updateAlumnoSancionDto: UpdateAlumnoSancionDto) {
|
|
||||||
return `This action updates a #${id} alumnoSancion`;
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(id: number) {
|
|
||||||
return `This action removes a #${id} alumnoSancion`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Student } from 'src/alumno/entities/student.entity';
|
import { Alumno } from 'src/alumno/entities/student.entity';
|
||||||
import { Sancion } from 'src/sancion/entities/sancion.entity';
|
import { Sancion } from 'src/sancion/entities/sancion.entity';
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
@@ -21,25 +21,17 @@ export class AlumnoSancion {
|
|||||||
})
|
})
|
||||||
fecha_inicio: Date;
|
fecha_inicio: Date;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Alumno, (student) => student.sanciones, {
|
||||||
() => Student,
|
eager: true,
|
||||||
(id_alumno_sancion) => id_alumno_sancion.id_cuentas,
|
nullable: true,
|
||||||
{
|
})
|
||||||
eager: true,
|
|
||||||
nullable: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@JoinColumn({ name: 'id_cuenta' })
|
@JoinColumn({ name: 'id_cuenta' })
|
||||||
id_cuenta: Student;
|
id_cuenta: Alumno;
|
||||||
|
|
||||||
@ManyToOne(
|
@ManyToOne(() => Sancion, (sancion) => sancion.sancion, {
|
||||||
() => Sancion,
|
eager: true,
|
||||||
(id_alumno_sancion) => id_alumno_sancion.id_sanciones,
|
nullable: true,
|
||||||
{
|
})
|
||||||
eager: true,
|
|
||||||
nullable: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@JoinColumn({ name: 'id_sancion' })
|
@JoinColumn({ name: 'id_sancion' })
|
||||||
id_sancion: Sancion;
|
id_sancion: Sancion;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -9,13 +9,14 @@ 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 { Student } from './alumno/entities/student.entity';
|
import { Alumno, Carrera } 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';
|
||||||
import { SancionModule } from './sancion/sancion.module';
|
import { SancionModule } from './sancion/sancion.module';
|
||||||
import { AlumnoSancionModule } from './alumno_sancion/alumno_sancion.module';
|
import { AlumnoSancionModule } from './alumno_sancion/alumno_sancion.module';
|
||||||
import { AlumnoSancion } from './alumno_sancion/entities/alumno_sancion.entity';
|
import { AlumnoSancion } from './alumno_sancion/entities/alumno_sancion.entity';
|
||||||
|
import { Sancion } from './sancion/entities/sancion.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -34,12 +35,14 @@ import { AlumnoSancion } from './alumno_sancion/entities/alumno_sancion.entity';
|
|||||||
database: configService.get<string>('DB_NAME'),
|
database: configService.get<string>('DB_NAME'),
|
||||||
entities: [
|
entities: [
|
||||||
User,
|
User,
|
||||||
Student,
|
Alumno,
|
||||||
DetalleServicio,
|
DetalleServicio,
|
||||||
Periodo,
|
Periodo,
|
||||||
Servicio,
|
Servicio,
|
||||||
Perfil,
|
Perfil,
|
||||||
AlumnoSancion,
|
AlumnoSancion,
|
||||||
|
Sancion,
|
||||||
|
Carrera,
|
||||||
],
|
],
|
||||||
synchronize: false, //Never change to true in production!
|
synchronize: false, //Never change to true in production!
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Student } from 'src/alumno/entities/student.entity';
|
import { Alumno } from 'src/alumno/entities/student.entity';
|
||||||
import { Periodo } from 'src/periodo/entities/periodo.entity';
|
import { Periodo } from 'src/periodo/entities/periodo.entity';
|
||||||
import { Servicio } from 'src/servicio/entities/servicio.entity';
|
import { Servicio } from 'src/servicio/entities/servicio.entity';
|
||||||
import { User } from 'src/user/entities/user.entity';
|
import { User } from 'src/user/entities/user.entity';
|
||||||
@@ -38,17 +38,24 @@ export class DetalleServicio {
|
|||||||
})
|
})
|
||||||
fecha_operacion: Date;
|
fecha_operacion: Date;
|
||||||
|
|
||||||
@ManyToOne(() => Student, (id_cuenta) => id_cuenta.detalles_servicio, {
|
@Column()
|
||||||
|
id_cuenta:number
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
id_servicio:number
|
||||||
|
|
||||||
|
|
||||||
|
@ManyToOne(() => Alumno, (id_cuenta) => id_cuenta.detalles_servicio, {
|
||||||
eager: true,
|
eager: true,
|
||||||
})
|
})
|
||||||
@JoinColumn({ name: 'id_cuenta' })
|
@JoinColumn({ name: 'id_cuenta' })
|
||||||
id_cuenta: Student;
|
cuenta: Alumno;
|
||||||
|
|
||||||
@ManyToOne(() => Servicio, (id_servicio) => id_servicio.detalles_servicio, {
|
@ManyToOne(() => Servicio, (id_servicio) => id_servicio.detalles_servicio, {
|
||||||
eager: true,
|
eager: true,
|
||||||
})
|
})
|
||||||
@JoinColumn({ name: 'id_servicio' })
|
@JoinColumn({ name: 'id_servicio' })
|
||||||
id_servicio: Servicio;
|
servicio: Servicio;
|
||||||
|
|
||||||
@ManyToOne(() => User, (id_perfil) => id_perfil.detalles_servicio, {
|
@ManyToOne(() => User, (id_perfil) => id_perfil.detalles_servicio, {
|
||||||
eager: true,
|
eager: true,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export class Sancion {
|
|||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
() => AlumnoSancion,
|
() => AlumnoSancion,
|
||||||
(id_sanncion) => id_sanncion.id_alumno_sancion,
|
(alusancion) => alusancion.id_sancion,
|
||||||
)
|
)
|
||||||
id_sanciones: AlumnoSancion[];
|
alumnosSancionados: AlumnoSancion[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { SancionController } from './sancion.controller';
|
|
||||||
import { SancionService } from './sancion.service';
|
|
||||||
|
|
||||||
describe('SancionController', () => {
|
|
||||||
let controller: SancionController;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
controllers: [SancionController],
|
|
||||||
providers: [SancionService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
controller = module.get<SancionController>(SancionController);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(controller).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { Test, TestingModule } from '@nestjs/testing';
|
|
||||||
import { SancionService } from './sancion.service';
|
|
||||||
|
|
||||||
describe('SancionService', () => {
|
|
||||||
let service: SancionService;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
const module: TestingModule = await Test.createTestingModule({
|
|
||||||
providers: [SancionService],
|
|
||||||
}).compile();
|
|
||||||
|
|
||||||
service = module.get<SancionService>(SancionService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined', () => {
|
|
||||||
expect(service).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -8,6 +8,7 @@ export class Servicio {
|
|||||||
|
|
||||||
@Column({ type: 'varchar', length: 45, nullable: false })
|
@Column({ type: 'varchar', length: 45, nullable: false })
|
||||||
servicio: string;
|
servicio: string;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
() => DetalleServicio,
|
() => DetalleServicio,
|
||||||
(id_detalle_servicio) => id_detalle_servicio.id_servicio,
|
(id_detalle_servicio) => id_detalle_servicio.id_servicio,
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export class UserController {
|
|||||||
constructor(private readonly userService: UserService) {}
|
constructor(private readonly userService: UserService) {}
|
||||||
|
|
||||||
@Post()
|
@Post()
|
||||||
async Login(@Body() data: CreateUserDto, @Res() res: Response) {
|
async Login(@Body() data: CreateUserDto) {
|
||||||
return this.userService.Login(data, res);
|
return this.userService.Login(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
|
|||||||
Reference in New Issue
Block a user