Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
import { SpaceEnv } from '../../spaces/models/space-env.model.js'
import { CACHE_QUOTA_EVENT_UPDATE_PREFIX, CACHE_QUOTA_PREFIX } from '../constants/cache.js'
import { FILE_REPOSITORY } from '../constants/operations.js'
import { SpaceToFileRepository } from '../events/files-events.utils.js'
export function genQuotaCacheKey(id: number, type: FILE_REPOSITORY, isEventUpdate = false): string {
return `${isEventUpdate ? CACHE_QUOTA_EVENT_UPDATE_PREFIX : CACHE_QUOTA_PREFIX}-${type}-${id}`
}
export function quotaCacheKeyFromSpace(userId: number, space: SpaceEnv, isEventUpdate = false): string | null {
const repository = SpaceToFileRepository(userId, space)
return repository === null ? null : genQuotaCacheKey(repository.id, repository.type, isEventUpdate)
}