modulo motivo final
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as bcrypt from 'bcrypt';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
|
||||
@Injectable()
|
||||
export class BcryptService {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Cron, SchedulerRegistry } from '@nestjs/schedule';
|
||||
import { Cron } from '@nestjs/schedule';
|
||||
import { EquipoService } from '../equipo/equipo.service';
|
||||
import { MultaService } from '../multa/multa.service';
|
||||
import { PrestamoService } from '../prestamo/prestamo.service';
|
||||
@@ -7,13 +7,12 @@ import { PrestamoService } from '../prestamo/prestamo.service';
|
||||
@Injectable()
|
||||
export class CronService {
|
||||
constructor(
|
||||
private schedulerRegistry: SchedulerRegistry,
|
||||
private equipoService: EquipoService,
|
||||
private multaService: MultaService,
|
||||
private prestamoService: PrestamoService,
|
||||
) {}
|
||||
|
||||
@Cron('0 */5 8-20 * * 1-5', { name: 'prestamos_desactivacion' })
|
||||
@Cron('0 */1 8-20 * * 1-5', { name: 'prestamos_desactivacion' })
|
||||
desactivarPrestamos() {
|
||||
return this.prestamoService.desactivarPrestamos();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Controller, Get, Query } from '@nestjs/common';
|
||||
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { MotivoService } from './motivo.service';
|
||||
import { IdEquipoPaginaDto } from '../dto/id-equipo-pagina.dto';
|
||||
@@ -9,6 +10,7 @@ export class MotivoController {
|
||||
constructor(private motivoService: MotivoService) {}
|
||||
|
||||
@Get()
|
||||
// @UseGuards(AuthGuard('jwt'))
|
||||
@ApiOperation({
|
||||
description:
|
||||
'Endpoint que retorna 25 cambios de status que ha tenido el equipo dependiendo de la página en la que se encuentra el alumno.',
|
||||
|
||||
@@ -9,10 +9,10 @@ import { StatusModule } from '../status/status.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([Motivo]),
|
||||
EquipoModule,
|
||||
OperadorModule,
|
||||
StatusModule,
|
||||
TypeOrmModule.forFeature([Motivo]),
|
||||
],
|
||||
controllers: [MotivoController],
|
||||
providers: [MotivoService],
|
||||
|
||||
@@ -2,13 +2,13 @@ import * as moment from 'moment';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Equipo } from 'src/equipo/entity/equipo.entity';
|
||||
import { Motivo } from './entity/motivo.entity';
|
||||
import { Operador } from 'src/operador/entity/operador.entity';
|
||||
import { Status } from 'src/status/entity/status.entity';
|
||||
import { EquipoService } from '../equipo/equipo.service';
|
||||
import { OperadorService } from '../operador/operador.service';
|
||||
import { StatusService } from '../status/status.service';
|
||||
import { Equipo } from 'src/equipo/entity/equipo.entity';
|
||||
import { Operador } from 'src/operador/entity/operador.entity';
|
||||
import { Status } from 'src/status/entity/status.entity';
|
||||
|
||||
@Injectable()
|
||||
export class MotivoService {
|
||||
@@ -25,6 +25,7 @@ export class MotivoService {
|
||||
id_status: number | Status,
|
||||
motivo: string,
|
||||
) {
|
||||
const ahora = moment();
|
||||
const operador =
|
||||
typeof id_operador === 'number'
|
||||
? await this.operadorService.findById(id_operador)
|
||||
@@ -37,7 +38,7 @@ export class MotivoService {
|
||||
return this.repository.save(
|
||||
this.repository.create({
|
||||
equipo,
|
||||
fecha_creacion: moment().toDate(),
|
||||
fecha_creacion: ahora.toDate(),
|
||||
motivo,
|
||||
operador,
|
||||
status,
|
||||
|
||||
Reference in New Issue
Block a user