Skip to content

Commit

Permalink
Improve apps (#12714)
Browse files Browse the repository at this point in the history
* Allow apps to create direct messages

* Implement getMembers;

* Adds ability to search direct rooms by usernames

* Allow apps to update persistence by association (#12681)
  • Loading branch information
marceloschmidt authored and rodrigok committed Nov 23, 2018
1 parent 607badd commit 3e33c5c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/rocketchat-apps/server/bridges/persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,19 @@ export class AppPersistenceBridge {

throw new Error('Not implemented.');
}

async updateByAssociation(association, data, upsert, appId) {
console.log(`The App ${ appId } is updating the record with association to data as follows:`, association, data);

if (typeof data !== 'object') {
throw new Error('Attempted to store an invalid data type, it must be an object.');
}

const query = {
appId,
associations: association,
};

return this.orch.getPersistenceModel().upsert(query, { $set: { data } }, { upsert });
}
}

0 comments on commit 3e33c5c

Please sign in to comment.