feat: Document subscriptions (#3834)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
committed by
GitHub
parent
864f585e5b
commit
24c71c38a5
@@ -794,10 +794,27 @@ class Document extends ParanoidModel {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a list of users that have collaborated on this document
|
||||
*
|
||||
* @param options FindOptions
|
||||
* @returns A promise that resolve to a list of users
|
||||
*/
|
||||
collaborators = async (options?: FindOptions<User>): Promise<User[]> => {
|
||||
const users = await Promise.all(
|
||||
this.collaboratorIds.map((collaboratorId) =>
|
||||
User.findByPk(collaboratorId, options)
|
||||
)
|
||||
);
|
||||
|
||||
return compact(users);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate all of the document ids that are children of this document by
|
||||
* iterating through parentDocumentId references in the most efficient way.
|
||||
*
|
||||
* @param where query options to further filter the documents
|
||||
* @param options FindOptions
|
||||
* @returns A promise that resolves to a list of document ids
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user