Alberto ha deciso che le foto del profilo stanno dentro ogni account, in
<account>\profilo. Con un solo schema generale bastava cambiarlo perché
finissero insieme ai post: ora hanno il loro schema, come le raccolte in
evidenza, predefinito {account}\profilo\{data}_{ora}_{codice}_{n}, senza la
cartella dell'anno.
Impostazioni > Generali mostra il terzo campo con la cartella nel risultato
e colora solo il campo sbagliato. Un salvataggio che non manda il terzo
schema tiene quello salvato. Importazione e ricostruzione del database
riconoscono la cartella; prove nuove per nomi, impostazioni, salvataggio,
importazione e ricostruzione. Schermata confrontata con il mockup 08.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
313 lines
14 KiB
C#
313 lines
14 KiB
C#
namespace Febe.Web.Api;
|
|
|
|
// JSON shapes of the second part of the interface (Attività, Impostazioni, Importa, Collegamento, Browser, doppioni).
|
|
// Same conventions as Dtos.cs: English camelCase names, Italian texts, times as Unix milliseconds or LocalTimeDto.
|
|
|
|
// ---------------------------------------------------------------- connection (PROTOCOLLO.md)
|
|
|
|
/// <summary><c>GET /api/connection</c>. <see cref="State"/>: notConnected, connected, verificationRequired, browserUnavailable.</summary>
|
|
public sealed record ConnectionStatusDto(string State, string? Username, string? DisplayName, bool UserIsDriving, string? CurrentUrl);
|
|
|
|
/// <summary><c>POST /api/connection/begin</c>.</summary>
|
|
public sealed record BeginDrivingRequest(bool OpenLogin);
|
|
|
|
/// <summary><c>POST /api/connection/finish</c>.</summary>
|
|
public sealed record FinishDto(bool Connected, string Message);
|
|
|
|
// ---------------------------------------------------------------- activity
|
|
|
|
/// <summary>A stop of the circuit breaker. <see cref="Level"/>: throttle, challenge, disconnect.</summary>
|
|
public sealed record IncidentDto(
|
|
long Id,
|
|
LocalTimeDto At,
|
|
string Level,
|
|
string Title,
|
|
string Signal,
|
|
string? Url,
|
|
LocalTimeDto? StoppedUntil,
|
|
LocalTimeDto? ResolvedAt,
|
|
bool Open,
|
|
string? Note);
|
|
|
|
/// <param name="Advice">«Tre rallentamenti in sette giorni»: the proposal of spec §7.6, or null.</param>
|
|
public sealed record IncidentListDto(IReadOnlyList<IncidentDto> Items, int ThrottlesLastWeek, string? Advice);
|
|
|
|
/// <summary>
|
|
/// A line of the «Avvisi» list of Attività (spec §13.3): an alert or a failed delivery. <see cref="Kind"/>:
|
|
/// verification, disconnection, throttleStop, throttleEnd, backfillDone, unknownFormat, recipeSuspended, diskLow,
|
|
/// deliveryFailed. <see cref="Level"/>: error, warning, success, info.
|
|
/// </summary>
|
|
public sealed record AlertItemDto(long Id, LocalTimeDto At, string Kind, string Level, string Title, string Message, long? AccountId);
|
|
|
|
/// <summary><c>GET /api/alerts</c>: the alerts of the last <see cref="Days"/> days, newest first.</summary>
|
|
public sealed record AlertListDto(IReadOnlyList<AlertItemDto> Items, int Days);
|
|
|
|
/// <summary>The preview of Febe's browser: <see cref="Frame"/> is the address of the JPEG (with a version), or null.</summary>
|
|
public sealed record BrowserPreviewDto(bool HasFrame, string? Url, long? At, string? Frame);
|
|
|
|
/// <summary>Probable duplicates waiting for a decision, by origin.</summary>
|
|
public sealed record DuplicateCountsDto(int Download, int Import);
|
|
|
|
// ---------------------------------------------------------------- settings: general
|
|
|
|
/// <summary>A folder with the free space of its disk and the space it uses (measured in the background).</summary>
|
|
public sealed record FolderInfoDto(string Path, long? FreeBytes, long? UsedBytes, bool Measuring);
|
|
|
|
public sealed record NamingPreviewFileDto(string Name, string Kind);
|
|
|
|
public sealed record NamingPreviewFolderDto(IReadOnlyList<string> Path, IReadOnlyList<NamingPreviewFileDto> Files);
|
|
|
|
/// <summary>The «Risultato» tree of mockup 08 and the problems of the three schemes.</summary>
|
|
public sealed record NamingPreviewDto(string AccountFolder, IReadOnlyList<NamingPreviewFolderDto> Folders, IReadOnlyList<string> Errors, IReadOnlyList<string> Warnings);
|
|
|
|
/// <summary>Impostazioni, Generali (mockup 08).</summary>
|
|
/// <param name="Autostart">Windows: «Avvia Febe all'accensione del computer»; null where it does not exist.</param>
|
|
/// <param name="KeepInTray">Windows: «Chiudendo la finestra, Febe resta attivo nell'area di notifica».</param>
|
|
public sealed record GeneralSettingsDto(
|
|
FolderInfoDto Library,
|
|
FolderInfoDto Data,
|
|
bool FoldersReadOnly,
|
|
bool CanPickFolder,
|
|
bool CanChangeDataFolder,
|
|
string NamingScheme,
|
|
string HighlightScheme,
|
|
string ProfilePictureScheme,
|
|
string DefaultNamingScheme,
|
|
string DefaultHighlightScheme,
|
|
string DefaultProfilePictureScheme,
|
|
IReadOnlyList<string> Placeholders,
|
|
bool SetFileTime,
|
|
NamingPreviewDto Preview,
|
|
bool? Autostart,
|
|
bool KeepInTray,
|
|
string Language);
|
|
|
|
/// <summary>
|
|
/// Saves Impostazioni, Generali. A null <see cref="LibraryFolder"/> keeps the library folder; a null
|
|
/// <see cref="ProfilePictureScheme"/> keeps the scheme of profile pictures.
|
|
/// </summary>
|
|
public sealed record GeneralSettingsRequest(string? LibraryFolder, string NamingScheme, string HighlightScheme, bool SetFileTime, bool? Autostart, bool? KeepInTray, string? ProfilePictureScheme = null);
|
|
|
|
/// <summary>The schemes to preview; a null <see cref="ProfilePictureScheme"/> stands for the default one.</summary>
|
|
public sealed record NamingRequest(string? NamingScheme, string? HighlightScheme, string? ProfilePictureScheme = null);
|
|
|
|
/// <summary><see cref="Which"/>: library or data.</summary>
|
|
public sealed record PickFolderRequest(string Which);
|
|
|
|
/// <summary>A path; null or empty when Alberto cancelled the picker.</summary>
|
|
public sealed record PathDto(string? Path);
|
|
|
|
public sealed record PathRequest(string Path);
|
|
|
|
// ---------------------------------------------------------------- settings: limits (mockup 07)
|
|
|
|
/// <summary>A budget of a category (ActionKind names, as in the engine snapshot) with the most the interface accepts.</summary>
|
|
public sealed record BudgetValueDto(string Kind, string Label, int PerHour, int PerDay, int MaxPerHour, int MaxPerDay);
|
|
|
|
/// <summary>The values of a caution profile. <see cref="Kind"/>: prudent, balanced, fast, custom. Times «07:30».</summary>
|
|
public sealed record ProfileValuesDto(
|
|
string Kind,
|
|
string Name,
|
|
string WindowStart,
|
|
string WindowEnd,
|
|
int JitterMinutes,
|
|
int SessionMinMinutes,
|
|
int SessionMaxMinutes,
|
|
int PauseMinMinutes,
|
|
int PauseMaxMinutes,
|
|
IReadOnlyList<BudgetValueDto> Budgets,
|
|
double DataPerDayGb,
|
|
int BackfillPerAccount,
|
|
int RampUpDays);
|
|
|
|
/// <summary>The limits of spec §7.5 that the interface enforces.</summary>
|
|
public sealed record LimitRulesDto(int MinPauseMinutes, int MaxSessionMinutes, int MaxWindowHours, int MaxJitterMinutes, double MaxDataPerDayGb, int MaxBackfillPerAccount, int MaxRampUpDays);
|
|
|
|
/// <summary>Impostazioni, Limiti e comportamento. <see cref="Pace"/>: slow, natural, brisk. Days: 0 Sunday … 6 Saturday.</summary>
|
|
/// <param name="Stops">The fixed stops after throttles, informative only: «1 ora», «6 ore», «24 ore».</param>
|
|
public sealed record LimitsDto(
|
|
string Profile,
|
|
IReadOnlyList<ProfileValuesDto> Presets,
|
|
ProfileValuesDto Current,
|
|
string Pace,
|
|
bool GradualStart,
|
|
IReadOnlyList<int> ActiveDays,
|
|
LimitRulesDto Rules,
|
|
IReadOnlyList<string> Stops);
|
|
|
|
/// <summary>Saves the limits; <see cref="Values"/> is read when <see cref="Profile"/> is custom.</summary>
|
|
public sealed record LimitsRequest(string Profile, ProfileValuesDto? Values, string Pace, bool GradualStart, IReadOnlyList<int> ActiveDays);
|
|
|
|
// ---------------------------------------------------------------- settings: notifications (spec §13.3)
|
|
|
|
public sealed record AlertEventsDto(bool Verification, bool Disconnection, bool Throttle, bool BackfillDone, bool DiskLow, bool UnknownFormat);
|
|
|
|
/// <summary>The token is never sent back: only whether it is set.</summary>
|
|
public sealed record NotificationSettingsDto(AlertEventsDto Events, bool Windows, bool WindowsAvailable, string? TelegramChatId, bool TelegramTokenSet, bool TelegramAvailable);
|
|
|
|
/// <summary>
|
|
/// Saves the notifications. <see cref="TelegramToken"/>: null or empty keeps the stored token, a value replaces it;
|
|
/// <see cref="RemoveTelegramToken"/> removes it.
|
|
/// </summary>
|
|
public sealed record NotificationSettingsRequest(AlertEventsDto Events, bool Windows, string? TelegramChatId, string? TelegramToken, bool RemoveTelegramToken);
|
|
|
|
/// <summary><see cref="Channel"/>: telegram or windows.</summary>
|
|
public sealed record AlertTestRequest(string Channel);
|
|
|
|
public sealed record AlertTestDto(bool Sent, string Message);
|
|
|
|
// ---------------------------------------------------------------- settings: data and backups (spec §8.2, §8.5)
|
|
|
|
public sealed record BackupDto(string Day, string Name, long Bytes, LocalTimeDto Modified);
|
|
|
|
/// <summary>The rebuild of the database: progress while running, then the report as Italian lines.</summary>
|
|
public sealed record RebuildStatusDto(bool Running, string? Folder, int FoldersDone, int FoldersTotal, int FilesChecked, IReadOnlyList<string> Lines, string? Error, LocalTimeDto? FinishedAt);
|
|
|
|
public sealed record DataSettingsDto(FolderInfoDto Data, string Database, long? DatabaseBytes, string BackupsFolder, IReadOnlyList<BackupDto> Backups, int KeepDays, RebuildStatusDto Rebuild);
|
|
|
|
/// <summary>«Ricostruisci»: <see cref="Confirm"/> must be the word «ricostruisci» typed by Alberto.</summary>
|
|
public sealed record RebuildRequest(string Confirm);
|
|
|
|
/// <summary>Impostazioni, Informazioni.</summary>
|
|
public sealed record AboutDto(string Version, string Edition, string DataFolder, string LibraryFolder, string Guide, string Repository);
|
|
|
|
// ---------------------------------------------------------------- probable duplicates (mockup 09, spec §9.5)
|
|
|
|
/// <summary>One side of a probable duplicate. <see cref="Image"/> is the address of its picture (thumbnail or preview).</summary>
|
|
public sealed record DuplicateSideDto(
|
|
bool InLibrary,
|
|
long? MediaId,
|
|
long? ImportFileId,
|
|
string? Username,
|
|
string? Path,
|
|
string? Kind,
|
|
int? Width,
|
|
int? Height,
|
|
long? Bytes,
|
|
LocalTimeDto? Date,
|
|
string? Image);
|
|
|
|
/// <summary>A probable duplicate. <see cref="Reason"/>: sameInstagramId, visuallySimilar. <see cref="Decision"/>: pending, keepLarger, keepExisting, keepBoth.</summary>
|
|
public sealed record DuplicateCaseDto(long PairId, string Reason, string Decision, DuplicateSideDto Existing, DuplicateSideDto Candidate, bool CandidateIsLarger, bool InsideSource);
|
|
|
|
public sealed record DuplicatePageDto(IReadOnlyList<DuplicateCaseDto> Cases, int Pending);
|
|
|
|
/// <summary>A decision. <see cref="ApplyToAll"/>: «Applica a tutti i casi simili» (every pending pair).</summary>
|
|
public sealed record DecideRequest(string Decision, bool ApplyToAll);
|
|
|
|
public sealed record DecideDto(int Decided, int FilesRemoved, IReadOnlyList<string> Problems, string Message, int Pending);
|
|
|
|
// ---------------------------------------------------------------- import (spec §9, mockup 09)
|
|
|
|
/// <summary>An import. <see cref="State"/>: analyzing, analysisInterrupted, reviewing, copying, copyInterrupted, completed, cancelled.</summary>
|
|
public sealed record ImportRunDto(long Id, string Source, string DisplayPath, string State, string Mode, bool ReadOnly, LocalTimeDto Started, LocalTimeDto? Completed, string? Error, bool Running);
|
|
|
|
/// <param name="SourceRoot">Docker: the root of the sources (the page lists its subfolders); null: the native picker.</param>
|
|
public sealed record ImportOverviewDto(IReadOnlyList<ImportRunDto> Runs, long? ActiveRunId, string? SourceRoot, bool PickFolder);
|
|
|
|
public sealed record SourceFolderDto(string Name, string Path, bool HasSubfolders);
|
|
|
|
/// <param name="Path">The folder listed (relative to the root), null for the root itself.</param>
|
|
/// <param name="Parent">The folder above, or null at the root.</param>
|
|
public sealed record SourceListDto(string? Path, string? Parent, string DisplayPath, IReadOnlyList<SourceFolderDto> Folders);
|
|
|
|
public sealed record SourceInfoDto(string Path, string DisplayPath, string Name, bool ReadOnly, bool CanMove, bool LooksLikeFebeLibrary, bool LooksLikeStogram, IReadOnlyList<string> Folders);
|
|
|
|
public sealed record ImportStartRequest(string Path, bool Stogram);
|
|
|
|
public sealed record OutcomeCountsDto(int New, int AlreadyInLibrary, int ProbableDuplicates, int Unrecognized, int IdenticalInSource);
|
|
|
|
/// <summary>Step 2 and 4. <see cref="Phase"/>: listing, analyzing, copying, finished.</summary>
|
|
public sealed record ImportProgressDto(
|
|
long RunId,
|
|
string Phase,
|
|
string State,
|
|
bool Running,
|
|
int FilesDone,
|
|
int FilesTotal,
|
|
long BytesDone,
|
|
long BytesTotal,
|
|
double Fraction,
|
|
string? CurrentFile,
|
|
OutcomeCountsDto Outcomes,
|
|
int Copied,
|
|
string? Error);
|
|
|
|
/// <summary>Where a folder goes. <see cref="Kind"/>: none, existing, newArchiveAccount.</summary>
|
|
public sealed record FolderTargetDto(string Kind, long? AccountId, string? Username);
|
|
|
|
public sealed record ImportFolderDto(
|
|
string Folder,
|
|
string DisplayName,
|
|
string? ProbableAccount,
|
|
int Files,
|
|
long Bytes,
|
|
int New,
|
|
int AlreadyInLibrary,
|
|
int ProbableDuplicates,
|
|
int Unrecognized,
|
|
int Recognized,
|
|
FolderTargetDto Target,
|
|
bool Blocked);
|
|
|
|
public sealed record ImportPlanDto(
|
|
int ToImport,
|
|
int ToReplace,
|
|
int Skipped,
|
|
int LeftOutNoAccount,
|
|
int FoldersWithoutAccount,
|
|
int LeftOutUndecided,
|
|
int AlreadyDone,
|
|
long Bytes,
|
|
string Mode,
|
|
string ButtonLabel,
|
|
string? LeftOutLabel);
|
|
|
|
public sealed record AccountChoiceDto(long Id, string Username, string State);
|
|
|
|
/// <summary>Step 3 (mockup 09).</summary>
|
|
public sealed record ImportReviewDto(
|
|
ImportRunDto Run,
|
|
string DisplayPath,
|
|
string Headline,
|
|
int Files,
|
|
long Bytes,
|
|
OutcomeCountsDto Outcomes,
|
|
int Recognized,
|
|
int PendingDuplicates,
|
|
IReadOnlyList<ImportFolderDto> Folders,
|
|
ImportPlanDto Plan,
|
|
bool CanMove,
|
|
bool StogramHypothesis,
|
|
int Copied,
|
|
IReadOnlyList<AccountChoiceDto> Accounts);
|
|
|
|
/// <summary>Sets where a folder goes. <see cref="Kind"/>: none, existing (with <see cref="AccountId"/>), newArchiveAccount (with <see cref="Username"/>).</summary>
|
|
public sealed record FolderTargetRequest(string Folder, string Kind, long? AccountId, string? Username);
|
|
|
|
/// <summary><see cref="Mode"/>: copy or move.</summary>
|
|
public sealed record ImportModeRequest(string Mode);
|
|
|
|
public sealed record ImportCountDto(string Username, int Files);
|
|
|
|
public sealed record ImportNoteDto(string Path, string Note);
|
|
|
|
/// <summary>Step 4: the final report.</summary>
|
|
public sealed record ImportReportDto(
|
|
ImportRunDto Run,
|
|
string DisplayPath,
|
|
int Files,
|
|
long Bytes,
|
|
OutcomeCountsDto Outcomes,
|
|
int Copied,
|
|
int Moved,
|
|
int Replaced,
|
|
int Skipped,
|
|
int LeftOut,
|
|
int Failed,
|
|
long BytesCopied,
|
|
IReadOnlyList<ImportCountDto> ImportedByAccount,
|
|
IReadOnlyList<ImportCountDto> AlreadyInLibraryByAccount,
|
|
IReadOnlyList<string> Unrecognized,
|
|
IReadOnlyList<ImportNoteDto> Problems);
|