dga y dgp a espera de soap conexión
This commit is contained in:
parent
ea5b636bc6
commit
5eb2fef2f1
@ -1836,7 +1836,6 @@ INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(1, 2);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(1, 3);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(1, 4);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(1, 5);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(1, 5);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(2, 1);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(2, 2);
|
||||
INSERT INTO institucion_dia(id_institucion, id_dia) VALUES(2, 3);
|
||||
|
@ -37,7 +37,11 @@ export class InstitucionUsuarioService {
|
||||
campo: string,
|
||||
) {
|
||||
return this.repository
|
||||
.findOne({ usuario, institucionCarrera })
|
||||
.findOne({
|
||||
activo: true,
|
||||
institucionCarrera,
|
||||
usuario,
|
||||
})
|
||||
.then((institucionUsuario) => {
|
||||
if (!institucionUsuario)
|
||||
throw new ConflictException(
|
||||
|
@ -298,7 +298,7 @@ export class UploadFileService {
|
||||
(carrera && !institucionCarrera)
|
||||
) {
|
||||
if (!tipoUsuario) error += ' no existe este tipo de usuario.';
|
||||
if (tipoUsuario.id_tipo_usuario < 5)
|
||||
else if (tipoUsuario.id_tipo_usuario < 5)
|
||||
' no se puede asignar este tipo de usuario a este usuario.';
|
||||
if (!carrera) error += ' falta del campo carrera para el alumno.';
|
||||
if (carrera && !institucionCarrera)
|
||||
|
@ -1,6 +1,9 @@
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class DgpInputDto {
|
||||
@IsString()
|
||||
id_institucion: string;
|
||||
|
||||
@IsString()
|
||||
rfc: string;
|
||||
|
||||
|
@ -1,22 +1,16 @@
|
||||
import { Expose, Type } from 'class-transformer';
|
||||
import { InstitucionCarreaOutputDto } from '../../../institucion-carrera/dto/output/institucion-carrera.dto';
|
||||
import { TipoUsuarioOutputDto } from '../../../tipo-usuario/dto/output/tipo-usuario.dto';
|
||||
import { UsuariosOutputDto } from './usuarios.dto';
|
||||
|
||||
export class EscolaresOutputDto {
|
||||
@Expose()
|
||||
id_usuario;
|
||||
|
||||
@Expose()
|
||||
nombre;
|
||||
|
||||
@Expose()
|
||||
usuario;
|
||||
id_institucion_usuario;
|
||||
|
||||
@Expose()
|
||||
@Type(() => InstitucionCarreaOutputDto)
|
||||
institucionCarrera;
|
||||
|
||||
@Expose()
|
||||
@Type(() => TipoUsuarioOutputDto)
|
||||
tipoUsuario;
|
||||
@Type(() => UsuariosOutputDto)
|
||||
usuario;
|
||||
}
|
||||
|
@ -60,7 +60,11 @@ export class UsuarioController {
|
||||
})
|
||||
@ApiQuery({ description: 'RFC del profesor.', name: 'rfc', type: 'string' })
|
||||
dgp(@Query() query: DgpInputDto) {
|
||||
return this.usuarioService.DGP(query.usuario, query.rfc);
|
||||
return this.usuarioService.DGP(
|
||||
parseInt(query.id_institucion),
|
||||
query.usuario,
|
||||
query.rfc,
|
||||
);
|
||||
}
|
||||
|
||||
@Post('registrar')
|
||||
|
@ -75,39 +75,37 @@ export class UsuarioService {
|
||||
id_institucion_carrera,
|
||||
);
|
||||
|
||||
return this.findByUsuario(usuario, true, true).then(
|
||||
async (existeUsuario) => {
|
||||
/* Falta conexión a soap */
|
||||
if (existeUsuario.password)
|
||||
throw new ConflictException(
|
||||
'Ya fue regisrado este número de cuenta.',
|
||||
);
|
||||
return this.institucionUsuarioService.findByUsuarioIdInstitucionCarrera(
|
||||
existeUsuario,
|
||||
institucionCarrera,
|
||||
'cuenta',
|
||||
);
|
||||
},
|
||||
);
|
||||
return this.findByUsuario(usuario, true).then(async (existeUsuario) => {
|
||||
/* Falta conexión a soap */
|
||||
if (existeUsuario.password)
|
||||
throw new ConflictException('Ya fue regisrado este número de cuenta.');
|
||||
return this.institucionUsuarioService.findByUsuarioIdInstitucionCarrera(
|
||||
existeUsuario,
|
||||
institucionCarrera,
|
||||
'cuenta',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async DGP(usuario: string, rfc: string) {
|
||||
const institucionCarrera = await this.institucionCarreraService.findById(1);
|
||||
async DGP(id_institucion: number, usuario: string, rfc: string) {
|
||||
const institucionCarrera =
|
||||
await this.institucionCarreraService.findByIdInstitucionIdCarrera(
|
||||
id_institucion,
|
||||
1,
|
||||
);
|
||||
|
||||
return this.findByUsuario(usuario, true, true).then(
|
||||
async (existeUsuario) => {
|
||||
/* Falta conexión a soap */
|
||||
if (existeUsuario.password)
|
||||
throw new ConflictException(
|
||||
'Ya fue regisrado este número de trabajador.',
|
||||
);
|
||||
return this.institucionUsuarioService.findByUsuarioIdInstitucionCarrera(
|
||||
existeUsuario,
|
||||
institucionCarrera,
|
||||
'trabajador',
|
||||
return this.findByUsuario(usuario, true).then(async (existeUsuario) => {
|
||||
/* Falta conexión a soap */
|
||||
if (existeUsuario.password)
|
||||
throw new ConflictException(
|
||||
'Ya fue regisrado este número de trabajador.',
|
||||
);
|
||||
},
|
||||
);
|
||||
return this.institucionUsuarioService.findByUsuarioIdInstitucionCarrera(
|
||||
existeUsuario,
|
||||
institucionCarrera,
|
||||
'trabajador',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async findAll(filtros: {
|
||||
|
@ -1,4 +1,5 @@
|
||||
numero_cuenta,nombres,apellido_p,apellido_m,carrera,tipo_usuario
|
||||
313144567,Nombre 1,Apellido_p 1,Apellido_m 1,MATEMATICAS APLICADAS Y COMPUTACION,Alumno
|
||||
415895839,Nombre 2,Apellido_p 2,Apellido_m 2,MEDICINA VETERINARIA Y ZOOTECNIA,Posgrado
|
||||
813573,Nombre 3,Apellido_p 3,Apellido_m 3,,Profesor
|
||||
316313528,MARQUEZ,ROSAS,LEMUEL HELON,MATEMATICAS APLICADAS Y COMPUTACION,Alumno
|
||||
316019251,ROMERO,VAZQUEZ,MARCO ANTONIO,ACTUARIA,Alumno
|
||||
316304326,CARRERA,SERRANO,JEREMY,ARQUITECTURA,Alumno
|
||||
419085500,SAAVEDRA,TREJO,ANDRES HERNAN,,Profesor
|
||||
|
|
Loading…
Reference in New Issue
Block a user