Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

refactor(backend:spaces): streamline `updateSpacesQuota` by reusing typed property array

johavena2c55a1b8ec8
diff --git a/backend/src/applications/spaces/services/spaces-manager.service.ts b/backend/src/applications/spaces/services/spaces-manager.service.ts
index 6748435d..1bfda958 100644
--- a/backend/src/applications/spaces/services/spaces-manager.service.ts
+++ b/backend/src/applications/spaces/services/spaces-manager.service.ts
@@ -395,10 +395,8 @@ export class SpacesManager {
}
async updateSpacesQuota(spaceId?: number) {
- for (const space of await this.spacesQueries.selectSpaces(
- ['id', 'alias', 'storageUsage', 'storageQuota'],
- [...(spaceId ? [eq(spaces.id, spaceId)] : [])]
- )) {
+ const props: (keyof Space)[] = ['id', 'alias', 'storageUsage', 'storageQuota']
+ for (const space of await this.spacesQueries.selectSpaces(props, [...(spaceId ? [eq(spaces.id, spaceId)] : [])])) {
const spacePath = SpaceModel.getHomePath(space.alias)
if (!(await isPathExists(spacePath))) {
this.logger.warn(`${this.updateSpacesQuota.name} - *${space.alias}* home path does not exist`)