File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -193,9 +193,12 @@ export default class NotifierWorker extends Worker {
193193 */
194194 private async getProjectNotificationRules ( projectId : string ) : Promise < Rule [ ] > {
195195 const connection = this . accountsDb . getConnection ( ) ;
196- const projects = connection . collection ( 'projects' ) ;
196+ const projects = connection . collection < { notifications ?: Rule [ ] } > ( 'projects' ) ;
197197
198- const project = await projects . findOne ( { _id : new ObjectID ( projectId ) } ) ;
198+ const project = await projects . findOne (
199+ { _id : new ObjectID ( projectId ) } ,
200+ { projection : { notifications : 1 } }
201+ ) ;
199202
200203 if ( ! project ) {
201204 throw new Error ( 'There is no project with given id' ) ;
Original file line number Diff line number Diff line change @@ -242,7 +242,10 @@ describe('NotifierWorker', () => {
242242
243243 await worker . handle ( message ) ;
244244
245- expect ( dbQueryMock ) . toBeCalledWith ( { _id : new ObjectID ( message . projectId ) } ) ;
245+ expect ( dbQueryMock ) . toBeCalledWith (
246+ { _id : new ObjectID ( message . projectId ) } ,
247+ { projection : { notifications : 1 } }
248+ ) ;
246249 } ) ;
247250
248251 it ( 'should close db connection on finish' , async ( ) => {
You can’t perform that action at this time.
0 commit comments