modified messages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ConflictException, forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { ConflictException, ForbiddenException, forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateStudentDto } from './dto/create-student.dto';
|
||||
import { Alumno } from './entities/student.entity';
|
||||
import { EntityManager, Repository } from 'typeorm';
|
||||
@@ -36,12 +36,12 @@ export class AlumnoService {
|
||||
throw new NotFoundException(`Carrera not found`);
|
||||
}
|
||||
|
||||
const currenStudent = await this.studentRepository.findOne({where:{id_cuenta:data.id_cuenta}})
|
||||
const currenStudent = await this.studentRepository.findOne({ where: { id_cuenta: data.id_cuenta } })
|
||||
|
||||
if(currenStudent){
|
||||
if (currenStudent) {
|
||||
throw new ConflictException('El usuario ya existe')
|
||||
}
|
||||
|
||||
|
||||
const createStudent = { ...rest, carrera, fecha_registro: new Date() };
|
||||
|
||||
const student = this.studentRepository.create(createStudent);
|
||||
@@ -61,7 +61,7 @@ export class AlumnoService {
|
||||
return student;
|
||||
}
|
||||
|
||||
async findOneWhitSancion(id_cuenta: number): Promise<Alumno> {
|
||||
async findOneWhitSancion(id_cuenta: number): Promise<Alumno> {
|
||||
const student = await this.studentRepository.findOne({
|
||||
where: { id_cuenta },
|
||||
select: { id_cuenta: true, nombre: true, credito: true },
|
||||
@@ -73,7 +73,7 @@ export class AlumnoService {
|
||||
const sancion = await this.alumnoSancionService.findSancion(id_cuenta)
|
||||
|
||||
if (sancion) {
|
||||
throw new NotFoundException('El usuario se encuentra sancionado')
|
||||
throw new ForbiddenException('El usuario se encuentra sancionado')
|
||||
}
|
||||
|
||||
return student;
|
||||
|
||||
@@ -99,7 +99,7 @@ export class AlumnoInscritoService {
|
||||
.getMany();
|
||||
|
||||
if (students.length === 0) {
|
||||
throw new NotFoundException('Estudiante no Registrado');
|
||||
throw new NotFoundException('Estudiante no inscrito en el periodo actual');
|
||||
}
|
||||
|
||||
return students;
|
||||
|
||||
@@ -18,7 +18,7 @@ import { JwtStrategy } from './jwt.strategy';
|
||||
return {
|
||||
global: true,
|
||||
secret: configService.get('JWT_SECRET'),
|
||||
signOptions: { expiresIn: '1h' },
|
||||
signOptions: { expiresIn: '7h' },
|
||||
};
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user