mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 11:49:19 +00:00
Backend using new tickets logic
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
const { validationResult } = require("express-validator");
|
||||
const jwt = require("jsonwebtoken");
|
||||
const authConfig = require("../config/auth");
|
||||
|
||||
|
||||
@@ -4,7 +4,19 @@ const Ticket = require("../models/Ticket");
|
||||
const Contact = require("../models/Contact");
|
||||
|
||||
exports.index = async (req, res) => {
|
||||
const { status = "" } = req.query;
|
||||
|
||||
let whereCondition;
|
||||
if (!status) {
|
||||
whereCondition = ["pending", "open"];
|
||||
} else {
|
||||
whereCondition = [status];
|
||||
}
|
||||
|
||||
const tickets = await Ticket.findAll({
|
||||
where: {
|
||||
status: { [Sequelize.Op.or]: whereCondition },
|
||||
},
|
||||
include: [
|
||||
{
|
||||
model: Contact,
|
||||
|
||||
Reference in New Issue
Block a user