refactor: removing unused import, commented codes, improved cursor query (#69)

* chore: refactor code in some modules

* refactor: getTeamsOfUser functino

* chore: remove unused import

* chore: revert some changes
This commit is contained in:
Mir Arif Hasan
2023-04-06 20:24:10 +06:00
committed by GitHub
parent ffc08227dd
commit 696cf8490b
14 changed files with 22 additions and 72 deletions

View File

@@ -34,6 +34,8 @@ export class UserCollectionService {
private readonly pubsub: PubSubService,
) {}
TITLE_LENGTH = 3;
/**
* Typecast a database UserCollection to a UserCollection model
* @param userCollection database UserCollection
@@ -212,7 +214,7 @@ export class UserCollectionService {
parentUserCollectionID: string | null,
type: ReqType,
) {
const isTitleValid = isValidLength(title, 3);
const isTitleValid = isValidLength(title, this.TITLE_LENGTH);
if (!isTitleValid) return E.left(USER_COLL_SHORT_TITLE);
// If creating a child collection
@@ -330,7 +332,7 @@ export class UserCollectionService {
userCollectionID: string,
userID: string,
) {
const isTitleValid = isValidLength(newTitle, 3);
const isTitleValid = isValidLength(newTitle, this.TITLE_LENGTH);
if (!isTitleValid) return E.left(USER_COLL_SHORT_TITLE);
// Check to see is the collection belongs to the user