using PlotLine.Data; using PlotLine.Models; using PlotLine.ViewModels; namespace PlotLine.Services; public sealed record StoryElementReferenceWorkspace(StoryElementReferenceList References, StorageUsage? Storage, CharacterDetailViewModel? CharacterGallery = null, int GalleryPages = 1) { public static async Task ReadStorageAsync(StoryElementReferenceList references, int userId, IProjectCollaborationRepository collaboration, ISubscriptionService subscriptions) { // Account-level totals belong to the account owner, even on a shared project. var owner = await collaboration.GetOwnerUserIdAsync(references.Access.ProjectID); if (owner != userId) return null; try { return await subscriptions.GetStorageUsageAsync(owner.Value); } catch (SubscriptionLimitException) { return null; } } }