mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 03:39:29 +00:00
feat: starting appbar notifications
This commit is contained in:
@@ -4,4 +4,5 @@ module.exports = {
|
||||
config: resolve(__dirname, "src", "config", "database.js"),
|
||||
"modules-path": resolve(__dirname, "src", "models"),
|
||||
"migrations-path": resolve(__dirname, "src", "database", "migrations"),
|
||||
"seeders-path": resolve(__dirname, "src", "database", "seeds"),
|
||||
};
|
||||
|
||||
@@ -126,7 +126,6 @@ exports.store = async (req, res, next) => {
|
||||
});
|
||||
|
||||
if (media) {
|
||||
console.log(media);
|
||||
const newMedia = MessageMedia.fromFilePath(req.file.path);
|
||||
|
||||
message.mediaUrl = req.file.filename;
|
||||
|
||||
@@ -27,14 +27,16 @@ exports.index = async (req, res) => {
|
||||
},
|
||||
];
|
||||
|
||||
if (status === "open") {
|
||||
if (status) {
|
||||
whereCondition = {
|
||||
...whereCondition,
|
||||
status: { [Sequelize.Op.or]: ["pending", "open"] },
|
||||
status: status,
|
||||
};
|
||||
} else if (status === "closed") {
|
||||
whereCondition = { ...whereCondition, status: "closed" };
|
||||
} else if (searchParam) {
|
||||
}
|
||||
// else if (status === "closed") {
|
||||
// whereCondition = { ...whereCondition, status: "closed" };
|
||||
// }
|
||||
else if (searchParam) {
|
||||
includeCondition = [
|
||||
...includeCondition,
|
||||
{
|
||||
|
||||
48
backend/src/database/seeds/20200824172424-create-contacts.js
Normal file
48
backend/src/database/seeds/20200824172424-create-contacts.js
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkInsert(
|
||||
"Contacts",
|
||||
[
|
||||
{
|
||||
name: "Joana Doe",
|
||||
profilePicUrl:
|
||||
"https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1834&q=80",
|
||||
number: 5512345678,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
name: "John Rulles",
|
||||
profilePicUrl:
|
||||
"https://images.unsplash.com/photo-1500648767791-00dcc994a43e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80",
|
||||
number: 5512345679,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
name: "Jonas Jhones",
|
||||
profilePicUrl:
|
||||
"https://images.unsplash.com/photo-1531427186611-ecfd6d936c79?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80",
|
||||
number: 5512345680,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
name: "Julie June",
|
||||
profilePicUrl:
|
||||
"https://images.unsplash.com/photo-1493666438817-866a91353ca9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1049&q=80",
|
||||
number: 5512345681,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
],
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete("Contacts", null, {});
|
||||
},
|
||||
};
|
||||
261
backend/src/database/seeds/20200824173654-create-tickets.js
Normal file
261
backend/src/database/seeds/20200824173654-create-tickets.js
Normal file
@@ -0,0 +1,261 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkInsert(
|
||||
"Tickets",
|
||||
[
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 3,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 4,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
lastMessage: "hello!",
|
||||
contactId: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
],
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete("Tickets", null, {});
|
||||
},
|
||||
};
|
||||
148
backend/src/database/seeds/20200824174824-create-messages.js
Normal file
148
backend/src/database/seeds/20200824174824-create-messages.js
Normal file
@@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkInsert(
|
||||
"Messages",
|
||||
[
|
||||
{
|
||||
id: "12312321342",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 1,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321313",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 1,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321314",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 1,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321315",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 1,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321316",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 5,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321355",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 5,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321318",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 5,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321319",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 5,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321399",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 11,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321391",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 11,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321392",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 3,
|
||||
ticketId: 11,
|
||||
fromMe: true,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: "12312321393",
|
||||
body:
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
ack: 0,
|
||||
ticketId: 11,
|
||||
fromMe: false,
|
||||
read: 1,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
],
|
||||
{}
|
||||
);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return queryInterface.bulkDelete("Messages", null, {});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user