fix: all unit test cases for backend modules (HBE-171) (#51)

* fix: if-condition for getCollectionOfRequest func

* fix: all test cases for team request module

* fix: user collection test case

* fix: team module test case

* refactor: updated test description for last implemented changes in admin and removed commented code

---------

Co-authored-by: ankitsridhar16 <ankit.sridhar16@gmail.com>
This commit is contained in:
Mir Arif Hasan
2023-04-06 20:23:04 +06:00
committed by GitHub
parent 6cb3a2de43
commit ffc08227dd
7 changed files with 56 additions and 94 deletions

View File

@@ -973,62 +973,4 @@ export class TeamCollectionService {
const teamCollectionsCount = this.prisma.teamCollection.count();
return teamCollectionsCount;
}
// async importCollectionFromFirestore(
// userUid: string,
// fbCollectionPath: string,
// teamID: string,
// parentCollectionID?: string,
// ): Promise<TeamCollection> {
// const syncDoc = await this.fb.firestore
// .doc(`users/${userUid}/collections/sync`)
// .get();
// if (!syncDoc.exists) throw new Error(TEAM_USER_NO_FB_SYNCDATA);
// const doc = syncDoc.data();
// if (!doc) throw new Error(TEAM_USER_NO_FB_SYNCDATA);
// // The 'target' variable will have the intended path to reach
// let target: FBCollectionFolder | null | undefined;
// try {
// const indexPaths = fbCollectionPath.split('/').map((x) => parseInt(x));
// target = doc.collection[indexPaths.shift() as number];
// while (indexPaths.length > 0)
// {
// const index = indexPaths.shift() as number;
// target = target?.folders[index];
// }
// } catch (e) {
// target = null;
// }
// if (!target) throw new Error(TEAM_FB_COLL_PATH_RESOLVE_FAIL);
// const queryGen = this.generatePrismaQueryObjForFBCollFolder(target, teamID);
// let result: TeamCollection;
// if (parentCollectionID) {
// result = await this.prisma.teamCollection.create({
// data: {
// ...queryGen,
// parent: {
// connect: {
// id: parentCollectionID,
// },
// },
// },
// });
// } else {
// result = await this.prisma.teamCollection.create({
// data: queryGen,
// });
// }
// this.pubsub.publish(`team_coll/${teamID}/coll_added`, result);
// return result;
// }
}