Seguridaad
This commit is contained in:
@@ -40,4 +40,4 @@ import {
|
||||
return this.comentariosService.deleteComentario(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { BadRequestException, Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Comentarios } from './entity/comentarios.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
@@ -12,6 +12,11 @@ export class ComentariosService {
|
||||
) {}
|
||||
|
||||
postComentario(comentario: ComentarioDto) {
|
||||
if (comentario.from !== 'CEDETEC' && comentario.from !== 'PCPUMA') {
|
||||
throw new BadRequestException('Mensaje no autorizado');
|
||||
}
|
||||
|
||||
|
||||
const nuevoComentario = this.comentariosRepository.create(comentario);
|
||||
return this.comentariosRepository.save(nuevoComentario);
|
||||
}
|
||||
@@ -35,11 +40,15 @@ export class ComentariosService {
|
||||
}
|
||||
|
||||
if (after) {
|
||||
query.andWhere('comentarios.fecha_registro > :after', { after: new Date(after) });
|
||||
query.andWhere('comentarios.fecha_registro > :after', {
|
||||
after: new Date(after),
|
||||
});
|
||||
}
|
||||
|
||||
if (from) {
|
||||
query.andWhere('comentarios.fecha_registro >= :from', { from: new Date(from) });
|
||||
query.andWhere('comentarios.fecha_registro >= :from', {
|
||||
from: new Date(from),
|
||||
});
|
||||
}
|
||||
|
||||
if (to) {
|
||||
|
||||
Reference in New Issue
Block a user