Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
added useful reload methods to chat channel model
Ronald A. Richardson7281174d12ad
diff --git a/console/app/models/chat-channel.js b/console/app/models/chat-channel.jsindex 76379141..00056715 100644--- a/console/app/models/chat-channel.js+++ b/console/app/models/chat-channel.js@@ -1,5 +1,6 @@import Model, { attr, hasMany, belongsTo } from '@ember-data/model';import { computed } from '@ember/object';+import { getOwner } from '@ember/application';import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';export default class ChatChannel extends Model {@@ -55,4 +56,35 @@ export default class ChatChannel extends Model {return formatDate(this.created_at, 'PP HH:mm');}++ /** @methods */+ reloadParticipants() {+ const owner = getOwner(this);+ const store = owner.lookup('service:store');++ return store.query('chat-participant', { chat_channel_uuid: this.id }).then((participants) => {+ this.set('participants', participants);+ return participants+ });+ }++ reloadMessages() {+ const owner = getOwner(this);+ const store = owner.lookup('service:store');++ return store.query('chat-message', { chat_channel_uuid: this.id }).then((messages) => {+ this.set('messages', messages);+ return messages+ });+ }++ reloadAttachments() {+ const owner = getOwner(this);+ const store = owner.lookup('service:store');++ return store.query('chat-attachment', { chat_channel_uuid: this.id }).then((attachments) => {+ this.set('attachments', attachments);+ return attachments+ });+ }}