Add system (curated) vs. user-uploaded flashcards
System decks/notes are owned by a reserved sentinel user id, reusing all existing per-user store/index plumbing unchanged. Regular users see them under a separate "Official Decks" section, can study them with fully independent per-user FSRS progress (lazily materialized on first visit), but can never edit or archive them - enforced both in the client (no Edit/Archive controls) and server-side (ownership guard on every mutating endpoint). Includes a small idempotent seed command (`dotnet run -- seed-flashcards`) for testing, since there's no in-app authoring UI yet.
This commit is contained in:
@@ -10,6 +10,14 @@ public static class FlashcardTypes
|
||||
public static readonly HashSet<string> All = [Basic, Cloze];
|
||||
}
|
||||
|
||||
// A reserved, never-authenticatable owner id. Decks/notes owned by this id are shared,
|
||||
// admin-curated content visible to every user (studied via their own independent schedule
|
||||
// rows) rather than a real user's private content.
|
||||
public static class FlashcardOwners
|
||||
{
|
||||
public const string System = "system";
|
||||
}
|
||||
|
||||
public static class FlashcardRatings
|
||||
{
|
||||
public const string Again = "again";
|
||||
@@ -43,6 +51,7 @@ public sealed class FlashcardDeck
|
||||
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? ArchivedUtc { get; set; }
|
||||
[BsonIgnore] public bool IsSystem => UserId == FlashcardOwners.System;
|
||||
}
|
||||
|
||||
public sealed class FlashcardImageReference
|
||||
@@ -69,6 +78,7 @@ public sealed class FlashcardNote
|
||||
public DateTime CreatedUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedUtc { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? ArchivedUtc { get; set; }
|
||||
[BsonIgnore] public bool IsSystem => UserId == FlashcardOwners.System;
|
||||
}
|
||||
|
||||
public sealed class FlashcardSchedule
|
||||
|
||||
Reference in New Issue
Block a user