modified get periodo and return user
This commit is contained in:
@@ -16,7 +16,7 @@ export class PeriodoService {
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
return this.periodoRepository.find();
|
||||
return this.periodoRepository.find({order:{'id_periodo':"DESC"}});
|
||||
}
|
||||
|
||||
async getPeriodoActivo(): Promise<Periodo> {
|
||||
@@ -32,7 +32,7 @@ export class PeriodoService {
|
||||
return periodo;
|
||||
}
|
||||
|
||||
async getPeriodoActivoWhitoutError(): Promise<Periodo | null> {
|
||||
async getPeriodoActivoWhitoutError(): Promise<Periodo | null> {
|
||||
const periodo = await this.periodoRepository.findOne({
|
||||
where: { activo: true },
|
||||
order: { id_periodo: 'DESC' },
|
||||
@@ -45,7 +45,7 @@ export class PeriodoService {
|
||||
await this.periodoRepository.delete(id_periodo)
|
||||
}
|
||||
|
||||
async periodoDisable(id_periodo:number) {
|
||||
async periodoDisable(id_periodo: number) {
|
||||
await this.periodoRepository.update(id_periodo, { activo: false })
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class PeriodoService {
|
||||
|
||||
const periodoActive = await this.getPeriodoActivoWhitoutError();
|
||||
|
||||
if(periodoActive){
|
||||
if (periodoActive) {
|
||||
await this.periodoDisable(periodoActive.id_periodo)
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export class PeriodoService {
|
||||
return this.periodoRepository.save(create)
|
||||
}
|
||||
|
||||
async modifiedDate(data:ModifiedDateDto,id_periodo){
|
||||
return this.periodoRepository.update(id_periodo,data)
|
||||
async modifiedDate(data: ModifiedDateDto, id_periodo) {
|
||||
return this.periodoRepository.update(id_periodo, data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@ export class UserService {
|
||||
|
||||
const payload = {
|
||||
id: user.id_usuario,
|
||||
usuario: user.usuario,
|
||||
usuario: user.nombre,
|
||||
role: user.perfil.id_perfil,
|
||||
};
|
||||
const token = await this.jwtService.signAsync(payload);
|
||||
|
||||
res.cookie('token', token, {
|
||||
httpOnly: true,
|
||||
secure: process.env.NODE_ENV === 'production', // en dev desactívalo
|
||||
secure: process.env.NODE_ENV === 'production',
|
||||
sameSite: 'strict',
|
||||
path: '/',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user