Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
fix(stream): fix deletion bug and list get bug
Browse files Browse the repository at this point in the history
Fix delete so it now properly deletes all children of a stream when it is deleted. Fix get all so it
also exposes public streams.
  • Loading branch information
AntoineDao committed Jan 14, 2020
1 parent 81f2981 commit e93d6ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions app/api/streams/StreamDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ module.exports = ( req, res ) => {
.then( stream => PermissionCheck( req.user, 'delete', stream ) )
.then( stream => {
myStream = stream
DataStream.remove( { streamId: { $in: [ ...myStream.children, req.params.streamId ] } } )
return stream.remove( )
return DataStream.deleteMany( { streamId: { $in: [ ...myStream.children, req.params.streamId ] } } )
} )
.then( ( ) => {
return res.send( { success: true, message: `Stream ${req.params.streamId} and its children have been deleted.`, deletedStreams: [ ...myStream.children, req.params.streamId ] } )
Expand Down
3 changes: 2 additions & 1 deletion app/api/streams/StreamGetAll.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = ( req, res ) => {
finalCriteria.$or = [
{ owner: req.user._id },
{ 'canWrite': mongoose.Types.ObjectId( req.user._id ) },
{ 'canRead': mongoose.Types.ObjectId( req.user._id ) }
{ 'canRead': mongoose.Types.ObjectId( req.user._id ) },
{ 'private': false }
]

DataStream.find( finalCriteria, query.options.fields, { sort: query.options.sort, skip: query.options.skip, limit: query.options.limit } )
Expand Down

0 comments on commit e93d6ce

Please sign in to comment.