@@ -3,8 +3,9 @@ const ApiConfig = require(process.env.CSSVC_BACKEND_ROOT + '/api_server/config/c
33const ObjectId = require ( 'mongodb' ) . ObjectId ;
44const UserIndexes = require ( process . env . CSSVC_BACKEND_ROOT + '/api_server/modules/users/indexes' ) ;
55const RepoIndexes = require ( process . env . CSSVC_BACKEND_ROOT + '/api_server/modules/repos/indexes' ) ;
6+ const EntityIndexes = require ( process . env . CSSVC_BACKEND_ROOT + '/api_server/modules/entities/indexes' ) ;
67
7- const COLLECTIONS = [ 'companies' , 'teams' , 'repos' , 'users' , 'streams' , 'posts' , 'codemarks' , 'markers' , 'markerLocations' ] ;
8+ const COLLECTIONS = [ 'companies' , 'teams' , 'repos' , 'users' , 'streams' , 'posts' , 'codemarks' , 'markers' , 'markerLocations' , 'entities' ] ;
89
910
1011class Deleter {
@@ -25,6 +26,7 @@ class Deleter {
2526 await this . deleteCodemarks ( ) ;
2627 await this . deleteMarkers ( ) ;
2728 await this . deleteMarkerLocations ( ) ;
29+ await this . deleteEntities ( ) ;
2830 }
2931
3032 async openMongoClient ( ) {
@@ -365,6 +367,19 @@ class Deleter {
365367 throw `unable to delete marker locations: ${ JSON . stringify ( error ) } ` ;
366368 }
367369 }
370+
371+ async deleteEntities ( ) {
372+ this . logger . log ( `Deleting entities in team ${ this . teamId } ...` ) ;
373+ try {
374+ await this . mongoClient . mongoCollections . entities . deleteByQuery (
375+ { teamId : this . teamId } ,
376+ { overrideHintRequired : true }
377+ ) ;
378+ }
379+ catch ( error ) {
380+ throw `unable to delete entities: ${ JSON . stringify ( error ) } ` ;
381+ }
382+ }
368383}
369384
370385module . exports = Deleter ;
0 commit comments