From ea23acc988add92f6c944be2fa4e16692e01aad1 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Thu, 24 Oct 2024 11:59:07 +1000 Subject: [PATCH] Move private helper methods to bottom --- .../default-collection-vNext.service.ts | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/libs/admin-console/src/common/collections/services/default-collection-vNext.service.ts b/libs/admin-console/src/common/collections/services/default-collection-vNext.service.ts index fedeb00955..35c36a40ff 100644 --- a/libs/admin-console/src/common/collections/services/default-collection-vNext.service.ts +++ b/libs/admin-console/src/common/collections/services/default-collection-vNext.service.ts @@ -101,32 +101,6 @@ export class DefaultCollectionvNextService implements CollectionvNextService { return userId$.pipe(switchMap((userId) => this.decryptedCollectionState(userId).state$)); } - /** - * @returns a SingleUserState for encrypted collection data. - */ - private encryptedCollectionState(userId: UserId) { - return this.stateProvider.getUser(userId, ENCRYPTED_COLLECTION_DATA_KEY); - } - - /** - * @returns a SingleUserState for decrypted collection data. - */ - private decryptedCollectionState(userId: UserId): DerivedState { - const encryptedCollectionsWithKeys = this.encryptedCollectionState(userId).combinedState$.pipe( - switchMap(([userId, collectionData]) => - combineLatest([of(collectionData), this.cryptoService.orgKeys$(userId)]), - ), - ); - - return this.stateProvider.getDerived( - encryptedCollectionsWithKeys, - DECRYPTED_COLLECTION_DATA_KEY, - { - collectionService: this, - }, - ); - } - async encrypt(model: CollectionView): Promise { if (model.organizationId == null) { throw new Error("Collection has no organization id."); @@ -250,4 +224,30 @@ export class DefaultCollectionvNextService implements CollectionvNextService { return collections; }); } + + /** + * @returns a SingleUserState for encrypted collection data. + */ + private encryptedCollectionState(userId: UserId) { + return this.stateProvider.getUser(userId, ENCRYPTED_COLLECTION_DATA_KEY); + } + + /** + * @returns a SingleUserState for decrypted collection data. + */ + private decryptedCollectionState(userId: UserId): DerivedState { + const encryptedCollectionsWithKeys = this.encryptedCollectionState(userId).combinedState$.pipe( + switchMap(([userId, collectionData]) => + combineLatest([of(collectionData), this.cryptoService.orgKeys$(userId)]), + ), + ); + + return this.stateProvider.getDerived( + encryptedCollectionsWithKeys, + DECRYPTED_COLLECTION_DATA_KEY, + { + collectionService: this, + }, + ); + } }