Criação do recurso de restrição para o admin não editar a fila nem a conexão

pull/1/head
adriano 2022-06-17 19:48:05 -03:00
parent 9bb316a0cf
commit 3d69fa84ef
2 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import { Op, fn, where, col, Filterable, Includeable } from "sequelize"; import { Op, fn, where, col, Filterable, Includeable } from "sequelize";
import { startOfDay, endOfDay, parseISO } from "date-fns"; import { startOfDay, endOfDay, parseISO, format } from "date-fns";
import ptBR from 'date-fns/locale/pt-BR';
import Ticket from "../../models/Ticket"; import Ticket from "../../models/Ticket";
import Contact from "../../models/Contact"; import Contact from "../../models/Contact";
@ -7,6 +8,10 @@ import Message from "../../models/Message";
import Queue from "../../models/Queue"; import Queue from "../../models/Queue";
import ShowUserService from "../UserServices/ShowUserService"; import ShowUserService from "../UserServices/ShowUserService";
import { splitDateTime } from "../../helpers/SplitDateTime";
const dateToday = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR })))
interface Request { interface Request {
searchParam?: string; searchParam?: string;
pageNumber?: string; pageNumber?: string;
@ -64,6 +69,17 @@ const ListTicketsService = async ({
...whereCondition, ...whereCondition,
status status
}; };
if (unlimited) {
whereCondition = {
...whereCondition,
createdAt: {
[Op.gte]: dateToday.fullDate + ' 00:00:00.000000',
[Op.lte]: dateToday.fullDate + ' 23:59:59.999999'
}
}
}
} }
if (searchParam) { if (searchParam) {

View File

@ -5,7 +5,7 @@ const rules = {
admin: { admin: {
static: [ static: [
"show-icon-edit-whatsapp", //"show-icon-edit-whatsapp",
"drawer-admin-items:view", "drawer-admin-items:view",
"tickets-manager:showall", "tickets-manager:showall",