IO-1124 Archive message
This commit is contained in:
@@ -13,7 +13,10 @@ query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID(
|
||||
`;
|
||||
|
||||
exports.INSERT_MESSAGE = `
|
||||
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) {
|
||||
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!, $conversationid: uuid) {
|
||||
update_conversations(where: {id: {_eq: $conversationid}}, _set: {archived: false}) {
|
||||
affected_rows
|
||||
}
|
||||
insert_messages(objects: $msg) {
|
||||
returning {
|
||||
conversation {
|
||||
@@ -28,6 +31,7 @@ mutation INSERT_MESSAGE($msg: [messages_insert_input!]!) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
exports.UPDATE_MESSAGE_STATUS = `
|
||||
|
||||
@@ -62,13 +62,17 @@ exports.receive = (req, res) => {
|
||||
}
|
||||
|
||||
client
|
||||
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
||||
.request(queries.INSERT_MESSAGE, {
|
||||
msg: newMessage,
|
||||
conversationid: response.bodyshops[0].conversations[0].id,
|
||||
})
|
||||
.then((r2) => {
|
||||
res.status(200).send("");
|
||||
|
||||
const arrayOfAllUserFcmTokens = r2.insert_messages.returning[0].conversation.bodyshop.associations.map(
|
||||
(a) => a.user.fcmtokens
|
||||
);
|
||||
const arrayOfAllUserFcmTokens =
|
||||
r2.insert_messages.returning[0].conversation.bodyshop.associations.map(
|
||||
(a) => a.user.fcmtokens
|
||||
);
|
||||
const allTokens = [];
|
||||
arrayOfAllUserFcmTokens.map((i) =>
|
||||
Object.keys(i).map((k) => allTokens.push(k))
|
||||
|
||||
Reference in New Issue
Block a user