From ddbef76d94bc61b7f2d2e30fda5e3ba6acd2ac52 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Wed, 30 Sep 2026 20:44:35 +0330 Subject: [PATCH] people tags #387 --- .../Pages/ReviewPersonRelationEdits.cshtml | 73 +- GanjooRazor/Areas/User/Pages/Editor.cshtml | 82 +- .../Pages/SuggestNewPersonRelation.cshtml | 66 +- .../Pages/SuggestNewPersonRelation.cshtml.cs | 206 +- .../Areas/User/Pages/SuggestPersonEdit.cshtml | 49 +- RMuseum/DbContext/RMuseumDbContext.cs | 8 + ...onSuggestionAffiliationSupport.Designer.cs | 6613 +++++++++++++++++ ...sonRelationSuggestionAffiliationSupport.cs | 70 + .../RMuseumDbContextModelSnapshot.cs | 18 + .../GanjoorPersonRelationEditSuggestion.cs | 40 +- .../Ganjoor/PersonRelationSuggestionKind.cs | 16 + RMuseum/RMuseum.xml | 61 +- .../GanjoorRelatedPersonService.cs | 232 +- 13 files changed, 7276 insertions(+), 258 deletions(-) create mode 100644 RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.Designer.cs create mode 100644 RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.cs create mode 100644 RMuseum/Models/Ganjoor/PersonRelationSuggestionKind.cs diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml b/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml index 37c48e6f..992eec90 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml +++ b/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml @@ -19,6 +19,24 @@ } } + string AffiliationTypeName(PersonAffiliationType t) + { + switch (t) + { + case PersonAffiliationType.Minister: return "وزیر/کارگزار"; + case PersonAffiliationType.Advisor: return "مشاور"; + case PersonAffiliationType.Courtier: return "درباری/همراه"; + case PersonAffiliationType.Patron: return "حامی"; + case PersonAffiliationType.Ally: return "متحد"; + case PersonAffiliationType.Rival: return "رقیب"; + case PersonAffiliationType.Servant: return "خدمتگزار"; + case PersonAffiliationType.Companion: return "همدم"; + case PersonAffiliationType.Successor: return "جانشین"; + case PersonAffiliationType.Other: return "نوع دیگر"; + default: return t.ToString(); + } + } + string ActionName(PersonRelationSuggestionAction a) { switch (a) @@ -49,6 +67,7 @@ else

@ActionName(s.Action) + @(s.Kind == PersonRelationSuggestionKind.Affiliation ? "وابستگی غیرخویشاوندی" : "نسبت خویشاوندی")

@@ -111,25 +130,45 @@ else } - - - - @if (s.Action == PersonRelationSuggestionAction.Modify) - { - - } - - - - - @if (s.Action == PersonRelationSuggestionAction.Modify) - { - - } - + @if (s.Kind == PersonRelationSuggestionKind.Affiliation) + { + + + + @if (s.Action == PersonRelationSuggestionAction.Modify) + { + + } + + } + else + { + + + + @if (s.Action == PersonRelationSuggestionAction.Modify) + { + + } + + + + + @if (s.Action == PersonRelationSuggestionAction.Modify) + { + + } + + } - + @if (s.Action == PersonRelationSuggestionAction.Modify) { diff --git a/GanjooRazor/Areas/User/Pages/Editor.cshtml b/GanjooRazor/Areas/User/Pages/Editor.cshtml index b126129c..030f9a41 100644 --- a/GanjooRazor/Areas/User/Pages/Editor.cshtml +++ b/GanjooRazor/Areas/User/Pages/Editor.cshtml @@ -214,29 +214,6 @@ document.getElementById('geotag-new-person-name').value = typedText; } ); - // birth/death location pickers inside the "new person" panel - these only ever pick an - // existing location (a brand-new-location-within-a-brand-new-person is one indirection too - // many for this form), so an unmatched search has nothing to offer - setupLocationAutocomplete( - document.getElementById('geotag-new-person-birthlocation-search'), - document.getElementById('geotag-new-person-birthlocation-id'), - document.getElementById('geotag-new-person-birthlocation-results'), - allGeoLocations, - null, - function (typedText) { - upToast('این مکان در فهرست نیست. ابتدا آن را جدا (در بخش «مکان» بالا) به‌عنوان مکان جدید پیشنهاد دهید.', 'error'); - } - ); - setupLocationAutocomplete( - document.getElementById('geotag-new-person-deathlocation-search'), - document.getElementById('geotag-new-person-deathlocation-id'), - document.getElementById('geotag-new-person-deathlocation-results'), - allGeoLocations, - null, - function (typedText) { - upToast('این مکان در فهرست نیست. ابتدا آن را جدا (در بخش «مکان» بالا) به‌عنوان مکان جدید پیشنهاد دهید.', 'error'); - } - ); }); var geoDateTagMap = null; var geoDateTagMarker = null; @@ -488,21 +465,22 @@ return null; } - var birthLocationId = $('#geotag-new-person-birthlocation-id').val(); - var deathLocationId = $('#geotag-new-person-deathlocation-id').val(); - + // birth/death year, "date is documented" and birth/death location are left out of this + // form for now (no real usage of them yet elsewhere) - the shape below still carries all + // of PersonGraphNode's fields, just with those ones always null/false, same as any other + // field this form doesn't offer a control for. var person = { localKey: 'new', existingPersonId: null, name: name, description: $('#geotag-new-person-description').val() || null, wikiUrl: $('#geotag-new-person-wikiurl').val() || null, - birthYearInLHijri: $('#geotag-new-person-birthyear').val() ? parseInt($('#geotag-new-person-birthyear').val()) : null, - deathYearInLHijri: $('#geotag-new-person-deathyear').val() ? parseInt($('#geotag-new-person-deathyear').val()) : null, - validBirthDate: $('#geotag-new-person-validbirth').is(':checked'), - validDeathDate: $('#geotag-new-person-validdeath').is(':checked'), - birthLocationId: birthLocationId ? parseInt(birthLocationId) : null, - deathLocationId: deathLocationId ? parseInt(deathLocationId) : null, + birthYearInLHijri: null, + deathYearInLHijri: null, + validBirthDate: false, + validDeathDate: false, + birthLocationId: null, + deathLocationId: null, familyTreeCaption: $('#geotag-new-person-familytreecaption').val() || null }; @@ -794,16 +772,6 @@ $('#geotag-new-person-name').val(''); $('#geotag-new-person-description').val(''); $('#geotag-new-person-wikiurl').val(''); - $('#geotag-new-person-birthyear').val(''); - $('#geotag-new-person-deathyear').val(''); - $('#geotag-new-person-validbirth').prop('checked', false); - $('#geotag-new-person-validdeath').prop('checked', false); - $('#geotag-new-person-birthlocation-id').val(''); - $('#geotag-new-person-birthlocation-search').val(''); - $('#geotag-new-person-birthlocation-results').hide().empty(); - $('#geotag-new-person-deathlocation-id').val(''); - $('#geotag-new-person-deathlocation-search').val(''); - $('#geotag-new-person-deathlocation-results').hide().empty(); $('#geotag-new-person-familytreecaption').val(''); $('#geotag-person-relatives-list').empty(); if (document.getElementById('new-person-widget').style.display !== 'none') { @@ -2617,36 +2585,6 @@ else -
-
- - - -
-
- - - -
-
-
-
- -
- - - -
-
-
- -
- - - -
-
-
diff --git a/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml b/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml index 5cd4cedd..b5aef86b 100644 --- a/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml +++ b/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml @@ -3,7 +3,7 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @{ Layout = "_UserPanelLayout"; - ViewData["Title"] = "پیشنهاد خویشاوند جدید"; + ViewData["Title"] = "پیشنهاد خویشاوند یا وابستگی جدید"; await GanjooRazor.Utils.GanjoorSessionChecker.ApplyPermissionsToViewData(Request, Response, ViewData); } @if (!string.IsNullOrEmpty(Model.LastError)) @@ -13,11 +13,11 @@ else {
-

پیشنهاد خویشاوند جدید برای: @Model.Person.Name

+

پیشنهاد خویشاوند یا وابستگی جدید برای: @Model.Person.Name

- این پیشنهاد مستقیماً اعمال نمی‌شود؛ پس از بررسی و تأیید توسط مدیران، به شجره‌نامهٔ + این پیشنهاد مستقیماً اعمال نمی‌شود؛ پس از بررسی و تأیید توسط مدیران، به شجره‌نامه/شبکهٔ وابستگی‌های @Model.Person.Name افزوده خواهد شد.

@@ -32,7 +32,7 @@ else
نوع نسبت@(s.Action == PersonRelationSuggestionAction.Modify && s.ExistingRelation != null ? RelationTypeName(s.ExistingRelation.RelationType) : RelationTypeName(s.SuggestedRelationType))@RelationTypeName(s.SuggestedRelationType)
درجه (در نیا/نواده)@((s.Action == PersonRelationSuggestionAction.Modify && s.ExistingRelation != null ? s.ExistingRelation.DegreeHint : s.SuggestedDegreeHint)?.ToString().ToPersianNumbers())@s.SuggestedDegreeHint?.ToString().ToPersianNumbers()
نوع وابستگی@(s.Action == PersonRelationSuggestionAction.Modify && s.ExistingAffiliation != null ? AffiliationTypeName(s.ExistingAffiliation.AffiliationType) : AffiliationTypeName(s.SuggestedAffiliationType ?? PersonAffiliationType.Other))@AffiliationTypeName(s.SuggestedAffiliationType ?? PersonAffiliationType.Other)
نوع نسبت@(s.Action == PersonRelationSuggestionAction.Modify && s.ExistingRelation != null ? RelationTypeName(s.ExistingRelation.RelationType) : RelationTypeName(s.SuggestedRelationType))@RelationTypeName(s.SuggestedRelationType)
درجه (در نیا/نواده)@((s.Action == PersonRelationSuggestionAction.Modify && s.ExistingRelation != null ? s.ExistingRelation.DegreeHint : s.SuggestedDegreeHint)?.ToString().ToPersianNumbers())@s.SuggestedDegreeHint?.ToString().ToPersianNumbers()
یادداشت@(s.Action == PersonRelationSuggestionAction.Modify && s.ExistingRelation != null ? s.ExistingRelation.Note : s.SuggestedNote) + + @(s.Action == PersonRelationSuggestionAction.Modify + ? (s.Kind == PersonRelationSuggestionKind.Affiliation ? s.ExistingAffiliation?.Note : s.ExistingRelation?.Note) + : s.SuggestedNote) + + @s.SuggestedNote
- + + + + + +
خویشاوند:خویشاوند یا شخصیت دیگر:
نوع پیوند: + +
+ + +
نسبت با @Model.Person.Name: @@ -63,6 +75,35 @@ else
+ + + + + + + + + @@ -77,4 +118,21 @@ else انصراف + + } diff --git a/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml.cs b/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml.cs index 762662c8..23bfeab3 100644 --- a/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml.cs +++ b/GanjooRazor/Areas/User/Pages/SuggestNewPersonRelation.cshtml.cs @@ -14,14 +14,17 @@ using RMuseum.Models.Ganjoor; namespace GanjooRazor.Areas.User.Pages { /// - /// contributor-facing form for suggesting a brand new kinship edge between the subject person - /// and another already-approved person - the "Add" counterpart of SuggestPersonRelationEdit.cshtml - /// (which only handles Modify/Remove of an already-existing edge). Presents a direction-aware - /// "RelationKind" choice (e.g. "فرزند" vs "پدر یا مادر") from the subject's point of view, and - /// translates it into the correct Person1Id/Person2Id/RelationType triple before submitting - - /// GanjoorPersonRelation itself has no notion of "from the subject's point of view", only - /// Person1/Person2, so that translation has to happen somewhere, and doing it here keeps the - /// underlying suggestion/moderation code simple and symmetric. + /// contributor-facing form for suggesting a brand new edge between the subject person and + /// another already-approved person - the "Add" counterpart of SuggestPersonRelationEdit.cshtml + /// (which only handles Modify/Remove of an already-existing edge). Covers both kinds of edge: + /// a family/kinship tie (GanjoorPersonRelation, via RelationKind) and a non-family affiliation + /// tie (GanjoorPersonAffiliation, via AffiliationKind) - RelationKindGroup picks which. Both + /// present a direction-aware choice from the subject's point of view (e.g. "فرزند" vs "پدر یا + /// مادر", or "او وزیر این شخصیت بود" vs "این شخصیت وزیر او بود") and translate it into the + /// symmetric Person1Id/Person2Id/type triple the underlying entity actually stores - neither + /// GanjoorPersonRelation nor GanjoorPersonAffiliation has any notion of "from the subject's own + /// point of view", only Person1/Person2, so that translation has to happen somewhere, and doing + /// it here keeps the underlying suggestion/moderation code simple and symmetric. /// public class SuggestNewPersonRelationModel : LoginPartialEnabledPageModel { @@ -40,9 +43,23 @@ namespace GanjooRazor.Areas.User.Pages [BindProperty] public int OtherPersonId { get; set; } + /// + /// "family" (default) or "affiliation" - which of RelationKind/AffiliationKind below applies + /// + [BindProperty] + public string RelationKindGroup { get; set; } + [BindProperty] public string RelationKind { get; set; } + /// + /// combined type+direction key for a non-family tie, e.g. "Minister_Subject" meaning + /// "this person served as minister to the other person" - see the switch in + /// OnPostSuggestAsync for the full list and their direction handling + /// + [BindProperty] + public string AffiliationKind { get; set; } + [BindProperty] public int? DegreeHint { get; set; } @@ -112,12 +129,10 @@ namespace GanjooRazor.Areas.User.Pages if (OtherPersonId == 0 || OtherPersonId == personId) { - LastResult = "لطفاً خویشاوند مورد نظر را انتخاب کنید."; + LastResult = "لطفاً خویشاوند یا شخصیت مورد نظر را انتخاب کنید."; return Page(); } - // translate the direction-aware choice (from Person's own point of view) into the - // symmetric Person1Id/Person2Id/RelationType triple GanjoorPersonRelation actually stores var suggestion = new GanjoorPersonRelationEditSuggestion() { Action = PersonRelationSuggestionAction.Add, @@ -126,41 +141,142 @@ namespace GanjooRazor.Areas.User.Pages SuggestionNote = string.IsNullOrWhiteSpace(SuggestionNote) ? null : SuggestionNote.Trim(), }; - switch (RelationKind) + if (RelationKindGroup == "affiliation") { - case "Child": // OtherPerson is a child of Person - suggestion.Person1Id = personId; - suggestion.Person2Id = OtherPersonId; - suggestion.SuggestedRelationType = PersonRelationType.Parent; - break; - case "Parent": // OtherPerson is a parent of Person - suggestion.Person1Id = OtherPersonId; - suggestion.Person2Id = personId; - suggestion.SuggestedRelationType = PersonRelationType.Parent; - break; - case "Sibling": - suggestion.Person1Id = personId; - suggestion.Person2Id = OtherPersonId; - suggestion.SuggestedRelationType = PersonRelationType.Sibling; - break; - case "Spouse": - suggestion.Person1Id = personId; - suggestion.Person2Id = OtherPersonId; - suggestion.SuggestedRelationType = PersonRelationType.Spouse; - break; - case "DistantAncestor": // OtherPerson is a distant ancestor of Person - suggestion.Person1Id = OtherPersonId; - suggestion.Person2Id = personId; - suggestion.SuggestedRelationType = PersonRelationType.Ancestor; - break; - case "DistantDescendant": // OtherPerson is a distant descendant of Person - suggestion.Person1Id = personId; - suggestion.Person2Id = OtherPersonId; - suggestion.SuggestedRelationType = PersonRelationType.Ancestor; - break; - default: - LastResult = "نوع نسبت نامعتبر است."; - return Page(); + suggestion.Kind = PersonRelationSuggestionKind.Affiliation; + + // OtherIsPerson1/SubjectIsPerson1 pairs translate the direction-aware choice into the + // symmetric Person1Id/Person2Id pair, following the direction each PersonAffiliationType + // value's own doc comment defines (Minister/Advisor/Courtier/Servant: Person1 is the + // subordinate one; Patron/Successor: Person1 is the patron/later one; Ally/Rival/ + // Companion/Other: symmetric, direction doesn't matter) + switch (AffiliationKind) + { + case "Minister_Other": // the other person served as minister to this one + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Minister; + break; + case "Minister_Subject": // this person served as minister to the other one + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Minister; + break; + case "Advisor_Other": + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Advisor; + break; + case "Advisor_Subject": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Advisor; + break; + case "Courtier_Other": + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Courtier; + break; + case "Courtier_Subject": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Courtier; + break; + case "Servant_Other": + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Servant; + break; + case "Servant_Subject": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Servant; + break; + case "Patron_Other": // the other person was patron of this one + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Patron; + break; + case "Patron_Subject": // this person was patron of the other one + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Patron; + break; + case "Successor_Other": // the other person succeeded this one + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Successor; + break; + case "Successor_Subject": // this person succeeded the other one + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Successor; + break; + case "Ally": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Ally; + break; + case "Rival": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Rival; + break; + case "Companion": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Companion; + break; + case "Other": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedAffiliationType = PersonAffiliationType.Other; + break; + default: + LastResult = "نوع وابستگی نامعتبر است."; + return Page(); + } + } + else + { + suggestion.Kind = PersonRelationSuggestionKind.Family; + + switch (RelationKind) + { + case "Child": // OtherPerson is a child of Person + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedRelationType = PersonRelationType.Parent; + break; + case "Parent": // OtherPerson is a parent of Person + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedRelationType = PersonRelationType.Parent; + break; + case "Sibling": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedRelationType = PersonRelationType.Sibling; + break; + case "Spouse": + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedRelationType = PersonRelationType.Spouse; + break; + case "DistantAncestor": // OtherPerson is a distant ancestor of Person + suggestion.Person1Id = OtherPersonId; + suggestion.Person2Id = personId; + suggestion.SuggestedRelationType = PersonRelationType.Ancestor; + break; + case "DistantDescendant": // OtherPerson is a distant descendant of Person + suggestion.Person1Id = personId; + suggestion.Person2Id = OtherPersonId; + suggestion.SuggestedRelationType = PersonRelationType.Ancestor; + break; + default: + LastResult = "نوع نسبت نامعتبر است."; + return Page(); + } } using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response))) diff --git a/GanjooRazor/Areas/User/Pages/SuggestPersonEdit.cshtml b/GanjooRazor/Areas/User/Pages/SuggestPersonEdit.cshtml index ccc1d6f2..f258a7a3 100644 --- a/GanjooRazor/Areas/User/Pages/SuggestPersonEdit.cshtml +++ b/GanjooRazor/Areas/User/Pages/SuggestPersonEdit.cshtml @@ -30,6 +30,17 @@ else @Html.AntiForgeryToken() + @* birth/death year, "date is documented" and birth/death location have no UI here for now + (no real usage of them elsewhere yet) - carried through as hidden fields instead of + dropped outright, so submitting this form never blanks out whatever the person record + already has for these on approval (GanjoorRelatedPersonService applies every Suggested* + field unconditionally, with no "did they actually change this" check). *@ + + + + + +
یادداشت (مستندسازی):
@@ -47,44 +58,6 @@ else - - - - - - - - - - - - - - - - - - - - - - - -
نشانی ویکی‌پدیا:
زاده: (قمری)
تاریخ تولد مستند است:
زادگاه: - -
درگذشته: (قمری)
تاریخ وفات مستند است:
آرامگاه: - -
عنوان شجره‌نامه: diff --git a/RMuseum/DbContext/RMuseumDbContext.cs b/RMuseum/DbContext/RMuseumDbContext.cs index e71b939e..cedc70b1 100644 --- a/RMuseum/DbContext/RMuseumDbContext.cs +++ b/RMuseum/DbContext/RMuseumDbContext.cs @@ -177,6 +177,14 @@ namespace RMuseum.DbContext .HasForeignKey(s => s.ExistingRelationId) .OnDelete(DeleteBehavior.Restrict); + // same Restrict treatment as ExistingRelationId above, but for Kind == Affiliation + // suggestions targeting a GanjoorPersonAffiliation instead + builder.Entity() + .HasOne(s => s.ExistingAffiliation) + .WithMany() + .HasForeignKey(s => s.ExistingAffiliationId) + .OnDelete(DeleteBehavior.Restrict); + builder.Entity() .HasIndex(b => new { b.UserId, b.PoemId, b.CoupletIndex }); diff --git a/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.Designer.cs b/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.Designer.cs new file mode 100644 index 00000000..1d18cdde --- /dev/null +++ b/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.Designer.cs @@ -0,0 +1,6613 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using RMuseum.DbContext; + +#nullable disable + +namespace RMuseum.Migrations +{ + [DbContext(typeof(RMuseumDbContext))] + [Migration("20260930170542_AddPersonRelationSuggestionAffiliationSupport")] + partial class AddPersonRelationSuggestionAffiliationSupport + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("RMuseum.Models.Accounting.DonationExpenditure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("GanjoorDonationId") + .HasColumnType("int"); + + b.Property("GanjoorExpenseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorDonationId"); + + b.HasIndex("GanjoorExpenseId"); + + b.ToTable("DonationExpenditure"); + }); + + modelBuilder.Entity("RMuseum.Models.Accounting.GanjoorDonation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("AmountString") + .HasColumnType("nvarchar(max)"); + + b.Property("DateString") + .HasColumnType("nvarchar(max)"); + + b.Property("DonorLink") + .HasColumnType("nvarchar(max)"); + + b.Property("DonorName") + .HasColumnType("nvarchar(max)"); + + b.Property("ExpenditureDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("ImportedRecord") + .HasColumnType("bit"); + + b.Property("RecordDate") + .HasColumnType("datetime2"); + + b.Property("Remaining") + .HasColumnType("decimal(18,2)"); + + b.Property("Unit") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GanjoorDonations"); + }); + + modelBuilder.Entity("RMuseum.Models.Accounting.GanjoorExpense", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ExpenseDate") + .HasColumnType("datetime2"); + + b.Property("Unit") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GanjoorExpenses"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactItemRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CoverImageIndex") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RArtifactMasterRecordId", "FriendlyUrl") + .IsUnique() + .HasFilter("[FriendlyUrl] IS NOT NULL"); + + b.HasIndex("RArtifactMasterRecordId", "Order") + .IsUnique(); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactMasterRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CoverImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("CoverItemIndex") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("ItemCount") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CoverImageId"); + + b.HasIndex("FriendlyUrl") + .IsUnique() + .HasFilter("[FriendlyUrl] IS NOT NULL"); + + b.HasIndex("LastModified"); + + b.HasIndex("CoverItemIndex", "Status"); + + b.ToTable("Artifacts"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GlobalValue") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PluralName") + .HasColumnType("nvarchar(max)"); + + b.Property("PluralNameInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TagType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FriendlyUrl"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTagValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BookId") + .HasColumnType("int"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.Property("PDFPageId") + .HasColumnType("int"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RTagId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.Property("ValueInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("ValueSupplement") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BookId"); + + b.HasIndex("FriendlyUrl"); + + b.HasIndex("PDFBookId"); + + b.HasIndex("PDFPageId"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.HasIndex("RTagId"); + + b.ToTable("TagValues"); + }); + + modelBuilder.Entity("RMuseum.Models.Bookmark.RUserBookmark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RBookmarkType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.ToTable("UserBookmarks"); + }); + + modelBuilder.Entity("RMuseum.Models.ExternalFTPUpload.QueuedFTPUpload", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeleteFileAfterUpload") + .HasColumnType("bit"); + + b.Property("Error") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalFilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessDate") + .HasColumnType("datetime2"); + + b.Property("Processing") + .HasColumnType("bit"); + + b.Property("QueueDate") + .HasColumnType("datetime2"); + + b.Property("RemoteFilePath") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("QueuedFTPUploads"); + }); + + modelBuilder.Entity("RMuseum.Models.FAQ.FAQCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CatOrder") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("FAQCategories"); + }); + + modelBuilder.Entity("RMuseum.Models.FAQ.FAQItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AnswerExcerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("ContentForSearch") + .HasColumnType("nvarchar(max)"); + + b.Property("FullAnswer") + .HasColumnType("nvarchar(max)"); + + b.Property("HashTag1") + .HasColumnType("nvarchar(max)"); + + b.Property("HashTag2") + .HasColumnType("nvarchar(max)"); + + b.Property("HashTag3") + .HasColumnType("nvarchar(max)"); + + b.Property("HashTag4") + .HasColumnType("nvarchar(max)"); + + b.Property("ItemOrderInCategory") + .HasColumnType("int"); + + b.Property("Pinned") + .HasColumnType("bit"); + + b.Property("PinnedItemOrder") + .HasColumnType("int"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("Question") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("FAQItems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.CategoryWordCount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("RowNmbrInCat") + .HasColumnType("int"); + + b.Property("Word") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("CatId", "Word") + .IsUnique() + .HasFilter("[Word] IS NOT NULL"); + + b.ToTable("CategoryWordCounts"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.CategoryWordCountSummary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("TotalWordCount") + .HasColumnType("int"); + + b.Property("UniqueWordCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CatId") + .IsUnique(); + + b.ToTable("CategoryWordCountSummaries"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.DigitalSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletsCount") + .HasColumnType("int"); + + b.Property("FullName") + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceType") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("DigitalSources"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.DiscoverQuotedQueueItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("RelatedPoemId") + .HasColumnType("int"); + + b.Property("RelatedPoetId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("DiscoverQuotedQueueItems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCachedRelatedPoem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("HtmlExcerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PoetImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PoetMorePoemsLikeThisCount") + .HasColumnType("int"); + + b.Property("PoetName") + .HasColumnType("nvarchar(max)"); + + b.Property("RelationOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("FullUrl"); + + b.HasIndex("PoemId"); + + b.ToTable("GanjoorCachedRelatedPoems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCachedRelatedSection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("HtmlExcerpt") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PoetImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PoetMorePoemsLikeThisCount") + .HasColumnType("int"); + + b.Property("PoetName") + .HasColumnType("nvarchar(max)"); + + b.Property("RelationOrder") + .HasColumnType("int"); + + b.Property("SectionIndex") + .HasColumnType("int"); + + b.Property("TargetPoemId") + .HasColumnType("int"); + + b.Property("TargetSectionIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoemId", "SectionIndex"); + + b.ToTable("GanjoorCachedRelatedSections"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCat", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BookName") + .HasColumnType("nvarchar(max)"); + + b.Property("CatType") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("MapName") + .HasColumnType("nvarchar(max)"); + + b.Property("MixedModeOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("SumUpSubsGeoLocations") + .HasColumnType("bit"); + + b.Property("TableOfContentsStyle") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("FullUrl"); + + b.HasIndex("PoetId"); + + b.HasIndex("RImageId"); + + b.HasIndex("ParentId", "PoetId"); + + SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("ParentId", "PoetId"), new[] { "Id" }); + + b.ToTable("GanjoorCategories"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCatCorrection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffectedTheCat") + .HasColumnType("bit"); + + b.Property("ApplicationOrder") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("HideMyName") + .HasColumnType("bit"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalDescriptionHtml") + .HasColumnType("nvarchar(max)"); + + b.Property("PageId") + .HasColumnType("int"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("Reviewed") + .HasColumnType("bit"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("UserId"); + + b.ToTable("GanjoorCatCorrections"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCentury", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EndYear") + .HasColumnType("int"); + + b.Property("HalfCenturyOrder") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ShowInTimeLine") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("GanjoorCenturies"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCenturyPoet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GanjoorCenturyId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PoetOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorCenturyId"); + + b.HasIndex("PoetId"); + + b.ToTable("GanjoorCenturyPoet"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AuthorEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("AuthorIpAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("AuthorName") + .HasColumnType("nvarchar(max)"); + + b.Property("AuthorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("CommentDate") + .HasColumnType("datetime2"); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("DislikeCount") + .HasColumnType("int"); + + b.Property("HtmlComment") + .HasColumnType("nvarchar(max)"); + + b.Property("InReplyToId") + .HasColumnType("int"); + + b.Property("LikeCount") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SortKey") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Verse12d") + .HasColumnType("int"); + + b.Property("Verse1Id") + .HasColumnType("int"); + + b.Property("Verse2Id") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CommentDate"); + + b.HasIndex("InReplyToId"); + + b.HasIndex("Status"); + + b.HasIndex("UserId"); + + b.HasIndex("Verse1Id"); + + b.HasIndex("Verse2Id"); + + b.HasIndex("PoemId", "CommentDate"); + + b.HasIndex("PoemId", "SortKey"); + + b.ToTable("GanjoorComments"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCommentAbuseReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GanjoorCommentId") + .HasColumnType("int"); + + b.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ReasonText") + .HasColumnType("nvarchar(max)"); + + b.Property("ReportedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorCommentId"); + + b.HasIndex("ReportedById"); + + b.ToTable("GanjoorReportedComments"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCommentReaction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GanjoorCommentId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("ReactionDate") + .HasColumnType("datetime2"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("GanjoorCommentId", "UserId") + .IsUnique(); + + b.HasIndex("PoemId", "UserId"); + + b.ToTable("GanjoorCommentReactions"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorDuplicate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DestPoemId") + .HasColumnType("int"); + + b.Property("SrcCatId") + .HasColumnType("int"); + + b.Property("SrcPoemId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DestPoemId"); + + b.HasIndex("SrcPoemId"); + + b.ToTable("GanjoorDuplicates"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorGeoLocation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Latitude") + .HasColumnType("decimal(12,9)"); + + b.Property("Longitude") + .HasColumnType("decimal(12,9)"); + + b.Property("MachineGenerated") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GanjoorGeoLocations"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorHealthCheckError", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BrokenLink") + .HasColumnType("bit"); + + b.Property("MulipleTargets") + .HasColumnType("bit"); + + b.Property("ReferrerPageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("TargetUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GanjoorHealthCheckErrors"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorLanguage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Code") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("NativeName") + .HasColumnType("nvarchar(max)"); + + b.Property("RightToLeft") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique() + .HasFilter("[Name] IS NOT NULL"); + + b.ToTable("GanjoorLanguages"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorMetre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.Property("VerseCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("GanjoorMetres"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorNumbering", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("EndCatId") + .HasColumnType("int"); + + b.Property("LastCountingDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("StartCatId") + .HasColumnType("int"); + + b.Property("TotalCouplets") + .HasColumnType("int"); + + b.Property("TotalLines") + .HasColumnType("int"); + + b.Property("TotalParagraphs") + .HasColumnType("int"); + + b.Property("TotalVerses") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EndCatId"); + + b.HasIndex("StartCatId"); + + b.ToTable("GanjoorNumberings"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GanjoorPageType") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("NoIndex") + .HasColumnType("bit"); + + b.Property("PageOrder") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PostDate") + .HasColumnType("datetime2"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("RedirectFromFullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("SecondPoetId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.HasIndex("FullUrl"); + + b.HasIndex("ParentId"); + + b.HasIndex("PoemId"); + + b.HasIndex("PoetId"); + + b.HasIndex("SecondPoetId"); + + b.ToTable("GanjoorPages"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPageSnapshot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("GanjoorPageId") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("MadeObsoleteByUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("OldTag") + .HasColumnType("nvarchar(max)"); + + b.Property("OldTagPageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("RecordDate") + .HasColumnType("datetime2"); + + b.Property("RhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceName") + .HasColumnType("nvarchar(max)"); + + b.Property("SourceUrlSlug") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UrlSlug") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorPageId"); + + b.HasIndex("MadeObsoleteByUserId"); + + b.ToTable("GanjoorPageSnapshots"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonAffiliation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffiliationType") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("Person1Id") + .HasColumnType("int"); + + b.Property("Person2Id") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Person1Id"); + + b.HasIndex("Person2Id"); + + b.ToTable("GanjoorPersonAffiliations"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonEditSuggestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("Reviewed") + .HasColumnType("bit"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedBirthLocationId") + .HasColumnType("int"); + + b.Property("SuggestedBirthYearInLHijri") + .HasColumnType("int"); + + b.Property("SuggestedDeathLocationId") + .HasColumnType("int"); + + b.Property("SuggestedDeathYearInLHijri") + .HasColumnType("int"); + + b.Property("SuggestedDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedFamilyTreeCaption") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedForDeletion") + .HasColumnType("bit"); + + b.Property("SuggestedName") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedValidBirthDate") + .HasColumnType("bit"); + + b.Property("SuggestedValidDeathDate") + .HasColumnType("bit"); + + b.Property("SuggestedWikiUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestionNote") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PersonId"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("SuggestedBirthLocationId"); + + b.HasIndex("SuggestedDeathLocationId"); + + b.HasIndex("UserId"); + + b.ToTable("GanjoorPersonEditSuggestions"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonRelation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DegreeHint") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("Person1Id") + .HasColumnType("int"); + + b.Property("Person2Id") + .HasColumnType("int"); + + b.Property("RelationType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Person1Id"); + + b.HasIndex("Person2Id"); + + b.ToTable("GanjoorPersonRelations"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonRelationEditSuggestion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Action") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("ExistingAffiliationId") + .HasColumnType("int"); + + b.Property("ExistingRelationId") + .HasColumnType("int"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Person1Id") + .HasColumnType("int"); + + b.Property("Person2Id") + .HasColumnType("int"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("Reviewed") + .HasColumnType("bit"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedAffiliationType") + .HasColumnType("int"); + + b.Property("SuggestedDegreeHint") + .HasColumnType("int"); + + b.Property("SuggestedNote") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedRelationType") + .HasColumnType("int"); + + b.Property("SuggestionNote") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ExistingAffiliationId"); + + b.HasIndex("ExistingRelationId"); + + b.HasIndex("Person1Id"); + + b.HasIndex("Person2Id"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("UserId"); + + b.ToTable("GanjoorPersonRelationEditSuggestions"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoem", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("ClaimedByMultiplePoets") + .HasColumnType("bit"); + + b.Property("FullTitle") + .HasMaxLength(1500) + .HasColumnType("nvarchar(1500)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(450)"); + + b.Property("GanjoorMetreId") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .HasMaxLength(8) + .HasColumnType("nvarchar(8)"); + + b.Property("MixedModeOrder") + .HasColumnType("int"); + + b.Property("OldTag") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("OldTagPageUrl") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("PlainText") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemSummary") + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("RhymeLetters") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SourceName") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.Property("SourceUrlSlug") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("Title") + .HasMaxLength(1500) + .HasColumnType("nvarchar(1500)"); + + b.Property("UrlSlug") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.HasIndex("FullUrl"); + + b.HasIndex("GanjoorMetreId"); + + b.HasIndex("Id"); + + b.ToTable("GanjoorPoems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffectedThePoem") + .HasColumnType("bit"); + + b.Property("ApplicationOrder") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("HideMyName") + .HasColumnType("bit"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("LanguageReviewResult") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalLanguage") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalPoemFormat") + .HasColumnType("int"); + + b.Property("OriginalPoemSummary") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm2") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm3") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm4") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemFormat") + .HasColumnType("int"); + + b.Property("PoemFormatReviewResult") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoemSummary") + .HasColumnType("nvarchar(max)"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("Reviewed") + .HasColumnType("bit"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("RhymeLettersReviewResult") + .HasColumnType("int"); + + b.Property("Rhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm2") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm2Result") + .HasColumnType("int"); + + b.Property("Rhythm3") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm3Result") + .HasColumnType("int"); + + b.Property("Rhythm4") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm4Result") + .HasColumnType("int"); + + b.Property("RhythmResult") + .HasColumnType("int"); + + b.Property("SummaryReviewResult") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("UserId"); + + b.ToTable("GanjoorPoemCorrections"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemGeoDateTagCorrection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("ExistingTagId") + .HasColumnType("int"); + + b.Property("GanjoorPoemCorrectionId") + .HasColumnType("int"); + + b.Property("IgnoreInCategory") + .HasColumnType("bit"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("LunarDay") + .HasColumnType("int"); + + b.Property("LunarMonth") + .HasColumnType("int"); + + b.Property("LunarYear") + .HasColumnType("int"); + + b.Property("MarkForDelete") + .HasColumnType("bit"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedLatitude") + .HasColumnType("float"); + + b.Property("SuggestedLocationName") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestedLongitude") + .HasColumnType("float"); + + b.Property("SuggestedPersonGraphJson") + .HasColumnType("nvarchar(max)"); + + b.Property("SuggestionNote") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorPoemCorrectionId"); + + b.HasIndex("LocationId"); + + b.HasIndex("PersonId"); + + b.ToTable("GanjoorPoemGeoDateTagCorrection"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemProbableMetre", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Metre") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SectionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.ToTable("GanjoorPoemProbableMetres"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemSection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CachedFirstCoupletIndex") + .HasColumnType("int"); + + b.Property("CoupletsCount") + .HasColumnType("int"); + + b.Property("GanjoorMetreId") + .HasColumnType("int"); + + b.Property("GanjoorMetreRefSectionIndex") + .HasColumnType("int"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("Number") + .HasColumnType("int"); + + b.Property("PlainText") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemFormat") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("RhymeLetters") + .HasColumnType("nvarchar(450)"); + + b.Property("SectionType") + .HasColumnType("int"); + + b.Property("VerseType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoetId"); + + b.HasIndex("RhymeLetters"); + + b.HasIndex("GanjoorMetreId", "RhymeLetters"); + + b.HasIndex("PoemId", "Index"); + + b.HasIndex("GanjoorMetreId", "RhymeLetters", "Id"); + + b.HasIndex("GanjoorMetreId", "RhymeLetters", "SectionType"); + + b.ToTable("GanjoorPoemSections"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemSectionCorrection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffectedThePoem") + .HasColumnType("bit"); + + b.Property("ApplicationOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse10VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse10VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse1VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse1VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse2VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse2VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse3VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse3VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse4VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse4VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse5VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse5VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse6VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse6VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse7VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse7VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse8VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse8VOrderResult") + .HasColumnType("int"); + + b.Property("BreakFromVerse9VOrder") + .HasColumnType("int"); + + b.Property("BreakFromVerse9VOrderResult") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("HideMyName") + .HasColumnType("bit"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("LanguageReviewResult") + .HasColumnType("int"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalLanguage") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalPoemFormat") + .HasColumnType("int"); + + b.Property("OriginalRhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalRhythm2") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemFormat") + .HasColumnType("int"); + + b.Property("PoemFormatReviewResult") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("Reviewed") + .HasColumnType("bit"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RhymeLetters") + .HasColumnType("nvarchar(max)"); + + b.Property("RhymeLettersReviewResult") + .HasColumnType("int"); + + b.Property("Rhythm") + .HasColumnType("nvarchar(max)"); + + b.Property("Rhythm2") + .HasColumnType("nvarchar(max)"); + + b.Property("RhythmResult") + .HasColumnType("int"); + + b.Property("RhythmResult2") + .HasColumnType("int"); + + b.Property("SectionId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("SectionId"); + + b.HasIndex("UserId"); + + b.ToTable("GanjoorPoemSectionCorrections"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BirthLocationId") + .HasColumnType("int"); + + b.Property("BirthYearInLHijri") + .HasColumnType("int"); + + b.Property("DeathLocationId") + .HasColumnType("int"); + + b.Property("DeathYearInLHijri") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Nickname") + .HasColumnType("nvarchar(max)"); + + b.Property("PinOrder") + .HasColumnType("int"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("ValidBirthDate") + .HasColumnType("bit"); + + b.Property("ValidDeathDate") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("BirthLocationId"); + + b.HasIndex("DeathLocationId"); + + b.HasIndex("RImageId"); + + b.HasIndex("Published", "Id"); + + SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("Published", "Id"), new[] { "Name", "Nickname", "RImageId" }); + + b.ToTable("GanjoorPoets"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoetSuggestedPicture", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChosenOne") + .HasColumnType("bit"); + + b.Property("PicOrder") + .HasColumnType("int"); + + b.Property("PictureId") + .HasColumnType("uniqueidentifier"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PublicationDate") + .HasColumnType("datetime2"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PictureId"); + + b.HasIndex("PoetId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("GanjoorPoetSuggestedPictures"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoetSuggestedSpecLine", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Contents") + .HasColumnType("nvarchar(max)"); + + b.Property("LineOrder") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("PublicationDate") + .HasColumnType("datetime2"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PoetId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("GanjoorPoetSuggestedSpecLines"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorQuotedPoem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CachedRelatedPoemFullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("CachedRelatedPoemFullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("CachedRelatedPoemPoetDeathYearInLHijri") + .HasColumnType("int"); + + b.Property("CachedRelatedPoemPoetImage") + .HasColumnType("nvarchar(max)"); + + b.Property("CachedRelatedPoemPoetName") + .HasColumnType("nvarchar(max)"); + + b.Property("CachedRelatedPoemPoetUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ChosenForMainList") + .HasColumnType("bit"); + + b.Property("ClaimedByBothPoets") + .HasColumnType("bit"); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("CoupletVerse1") + .HasColumnType("nvarchar(max)"); + + b.Property("CoupletVerse1ShouldBeEmphasized") + .HasColumnType("bit"); + + b.Property("CoupletVerse2") + .HasColumnType("nvarchar(max)"); + + b.Property("CoupletVerse2ShouldBeEmphasized") + .HasColumnType("bit"); + + b.Property("IndirectQuotation") + .HasColumnType("bit"); + + b.Property("IsPriorToRelated") + .HasColumnType("bit"); + + b.Property("Note") + .HasColumnType("nvarchar(max)"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("Published") + .HasColumnType("bit"); + + b.Property("Rejected") + .HasColumnType("bit"); + + b.Property("RelatedCoupletIndex") + .HasColumnType("int"); + + b.Property("RelatedCoupletVerse1") + .HasColumnType("nvarchar(max)"); + + b.Property("RelatedCoupletVerse1ShouldBeEmphasized") + .HasColumnType("bit"); + + b.Property("RelatedCoupletVerse2") + .HasColumnType("nvarchar(max)"); + + b.Property("RelatedCoupletVerse2ShouldBeEmphasized") + .HasColumnType("bit"); + + b.Property("RelatedPoemId") + .HasColumnType("int"); + + b.Property("RelatedPoetId") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewerUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("SamePoemsQuotedCount") + .HasColumnType("int"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.HasIndex("ReviewerUserId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("GanjoorQuotedPoems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BirthLocationId") + .HasColumnType("int"); + + b.Property("BirthYearInLHijri") + .HasColumnType("int"); + + b.Property("DeathLocationId") + .HasColumnType("int"); + + b.Property("DeathYearInLHijri") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("FamilyTreeCaption") + .HasColumnType("nvarchar(max)"); + + b.Property("MachineGenerated") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ValidBirthDate") + .HasColumnType("bit"); + + b.Property("ValidDeathDate") + .HasColumnType("bit"); + + b.Property("WikiUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BirthLocationId"); + + b.HasIndex("DeathLocationId"); + + b.ToTable("GanjoorRelatedPersons"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("AlternateText") + .HasColumnType("nvarchar(max)"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("TargetUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RImageId"); + + b.ToTable("GanjoorSiteBanners"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikCat", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("PoetId") + .HasColumnType("int"); + + b.Property("TajikDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("TajikTitle") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("PoetId"); + + b.ToTable("TajikCats"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikPage", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("TajikHtmlText") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("TajikPages"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikPoem", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("CatId") + .HasColumnType("int"); + + b.Property("FullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("TajikPlainText") + .HasColumnType("nvarchar(max)"); + + b.Property("TajikTitle") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CatId"); + + b.ToTable("TajikPoems"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikPoet", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BirthYearInLHijri") + .HasColumnType("int"); + + b.Property("TajikDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("TajikNickname") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("TajikPoets"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikVerse", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("TajikText") + .HasColumnType("nvarchar(max)"); + + b.Property("VOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("TajikVerses"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorUserBookmark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("PrivateNote") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Verse2Id") + .HasColumnType("int"); + + b.Property("VerseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.HasIndex("UserId", "PoemId", "CoupletIndex"); + + b.ToTable("GanjoorUserBookmarks"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorUserPoemVisit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Counter") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PoemId"); + + b.HasIndex("UserId"); + + b.HasIndex("UserId", "PoemId"); + + b.ToTable("GanjoorUserPoemVisits"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("CoupletSummary") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SectionIndex1") + .HasColumnType("int"); + + b.Property("SectionIndex2") + .HasColumnType("int"); + + b.Property("SectionIndex3") + .HasColumnType("int"); + + b.Property("SectionIndex4") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("nvarchar(max)"); + + b.Property("VOrder") + .HasColumnType("int"); + + b.Property("VersePosition") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LanguageId"); + + b.HasIndex("PoemId"); + + b.HasIndex("PoemId", "CoupletIndex"); + + b.ToTable("GanjoorVerses"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseNumber", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("IsPoemVerse") + .HasColumnType("bit"); + + b.Property("Number") + .HasColumnType("int"); + + b.Property("NumberingId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("SameTypeNumber") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PoemId", "CoupletIndex"); + + b.HasIndex("NumberingId", "PoemId", "CoupletIndex") + .IsUnique(); + + b.ToTable("GanjoorVerseNumbers"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseVOrderText", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("CoupletSummary") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorPoemCorrectionId") + .HasColumnType("int"); + + b.Property("LanguageId") + .HasColumnType("int"); + + b.Property("LanguageReviewResult") + .HasColumnType("int"); + + b.Property("MarkForDelete") + .HasColumnType("bit"); + + b.Property("MarkForDeleteResult") + .HasColumnType("int"); + + b.Property("NewVerse") + .HasColumnType("bit"); + + b.Property("NewVerseResult") + .HasColumnType("int"); + + b.Property("OriginalCoupletSummary") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalLanguageId") + .HasColumnType("int"); + + b.Property("OriginalText") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalVersePosition") + .HasColumnType("int"); + + b.Property("Result") + .HasColumnType("int"); + + b.Property("ReviewNote") + .HasColumnType("nvarchar(max)"); + + b.Property("SummaryReviewResult") + .HasColumnType("int"); + + b.Property("Text") + .HasColumnType("nvarchar(max)"); + + b.Property("VORder") + .HasColumnType("int"); + + b.Property("VersePosition") + .HasColumnType("int"); + + b.Property("VersePositionResult") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorPoemCorrectionId"); + + b.ToTable("GanjoorVerseVOrderText"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemGeoDateTag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("IgnoreInCategory") + .HasColumnType("bit"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("LunarDateTotalNumber") + .HasColumnType("int"); + + b.Property("LunarDay") + .HasColumnType("int"); + + b.Property("LunarMonth") + .HasColumnType("int"); + + b.Property("LunarYear") + .HasColumnType("int"); + + b.Property("MachineGenerated") + .HasColumnType("bit"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("VerifiedDate") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("PersonId"); + + b.HasIndex("PoemId"); + + b.ToTable("PoemGeoDateTags"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AlbumName") + .HasColumnType("nvarchar(max)"); + + b.Property("AlbumUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ApprovalDate") + .HasColumnType("datetime2"); + + b.Property("Approved") + .HasColumnType("bit"); + + b.Property("ArtistName") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("BrokenLink") + .HasColumnType("bit"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorTrackId") + .HasColumnType("int"); + + b.Property("GolhaTrackId") + .HasColumnType("int"); + + b.Property("PoemId") + .HasColumnType("int"); + + b.Property("Rejected") + .HasColumnType("bit"); + + b.Property("RejectionCause") + .HasColumnType("nvarchar(max)"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("SongOrder") + .HasColumnType("int"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("TrackName") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackType") + .HasColumnType("int"); + + b.Property("TrackUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorTrackId"); + + b.HasIndex("GolhaTrackId"); + + b.HasIndex("PoemId"); + + b.HasIndex("SingerId"); + + b.HasIndex("SuggestedById"); + + b.HasIndex("Approved", "Rejected"); + + b.ToTable("GanjoorPoemMusicTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.SemanticSearch.SemanticSearchQueryLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClickedAtUtc") + .HasColumnType("datetime2"); + + b.Property("ClickedPoemId") + .HasColumnType("int"); + + b.Property("ClickedResultRank") + .HasColumnType("int"); + + b.Property("DateTimeUtc") + .HasColumnType("datetime2"); + + b.Property("DetectedCategoryName") + .HasColumnType("nvarchar(max)"); + + b.Property("DetectedPoetName") + .HasColumnType("nvarchar(max)"); + + b.Property("Query") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestedTopK") + .HasColumnType("int"); + + b.Property("ResultCount") + .HasColumnType("int"); + + b.Property("ScopeDetected") + .HasColumnType("bit"); + + b.Property("ScopeDetectionDisabled") + .HasColumnType("bit"); + + b.Property("TopResultScore") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.ToTable("SemanticSearchQueryLogs"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.UpdatingRelSectsLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("MeterId") + .HasColumnType("int"); + + b.Property("RhymeLettes") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("UpdatingRelSectsLogs"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AudioArtist") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioOrder") + .HasColumnType("int"); + + b.Property("AudioSrc") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSyncStatus") + .HasColumnType("int"); + + b.Property("AudioTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("FileLastUpdated") + .HasColumnType("datetime2"); + + b.Property("FileNameWithoutExtension") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorAudioId") + .HasColumnType("int"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("InSyncWithText") + .HasColumnType("bit"); + + b.Property("InitialScore") + .HasColumnType("int"); + + b.Property("LegacyAudioGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("LocalMp3FilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("LocalXmlFilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3FileCheckSum") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3SizeInBytes") + .HasColumnType("int"); + + b.Property("OggSizeInBytes") + .HasColumnType("int"); + + b.Property("OwnerId") + .HasColumnType("uniqueidentifier"); + + b.Property("RecitationType") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewMsg") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewStatus") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SoundFilesFolder") + .HasColumnType("nvarchar(max)"); + + b.Property("UploadDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("GanjoorAudioId"); + + b.HasIndex("GanjoorPostId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("ReviewStatus", "GanjoorPostId"); + + b.ToTable("Recitations"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationApprovedMistake", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("Mistake") + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfLinesAffected") + .HasColumnType("int"); + + b.Property("RecitationId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RecitationId"); + + b.ToTable("RecitationApprovedMistakes"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationErrorReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoupletIndex") + .HasColumnType("int"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("NumberOfLinesAffected") + .HasColumnType("int"); + + b.Property("ReasonText") + .HasColumnType("nvarchar(max)"); + + b.Property("RecitationId") + .HasColumnType("int"); + + b.Property("ReporterId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RecitationId"); + + b.HasIndex("ReporterId"); + + b.ToTable("RecitationErrorReports"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationPublishingTracker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FinishDate") + .HasColumnType("datetime2"); + + b.Property("Finished") + .HasColumnType("bit"); + + b.Property("FirstDbUpdated") + .HasColumnType("bit"); + + b.Property("LastException") + .HasColumnType("nvarchar(max)"); + + b.Property("Mp3FileCopied") + .HasColumnType("bit"); + + b.Property("PoemNarrationId") + .HasColumnType("int"); + + b.Property("SecondDbUpdated") + .HasColumnType("bit"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("XmlFileCopied") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("PoemNarrationId"); + + b.ToTable("RecitationPublishingTrackers"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationUserUpVote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("RecitationId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("RecitationId", "UserId") + .IsUnique() + .HasFilter("[UserId] IS NOT NULL"); + + b.ToTable("RecitationUserUpVotes"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.UserRecitationProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtistName") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtistUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrc") + .HasColumnType("nvarchar(max)"); + + b.Property("AudioSrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("FileSuffixWithoutDash") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserRecitationProfiles"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.GanjoorLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisplayOnPage") + .HasColumnType("bit"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("GanjoorTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("IsTextOriginalSource") + .HasColumnType("bit"); + + b.Property("ItemId") + .HasColumnType("uniqueidentifier"); + + b.Property("LinkToOriginalSource") + .HasColumnType("bit"); + + b.Property("OriginalSourceUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewResult") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.Property("Synchronized") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.HasIndex("ItemId"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("GanjoorLinks"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.GanjoorPaperSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BookFullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("BookFullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("BookType") + .HasColumnType("int"); + + b.Property("CoverThumbnailImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorCatFullTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorCatFullUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorCatId") + .HasColumnType("int"); + + b.Property("GanjoorPoetId") + .HasColumnType("int"); + + b.Property("HumanReviewed") + .HasColumnType("bit"); + + b.Property("IsTextOriginalSource") + .HasColumnType("bit"); + + b.Property("MatchPercent") + .HasColumnType("int"); + + b.Property("NaskbanBookId") + .HasColumnType("int"); + + b.Property("OrderIndicator") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("GanjoorPaperSources"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PDFGanjoorLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ExternalThumbnailImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("GanjoorTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("IsTextOriginalSource") + .HasColumnType("bit"); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.Property("PDFPageTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("PageNumber") + .HasColumnType("int"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewResult") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedByMachine") + .HasColumnType("bit"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.Property("Synchronized") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("PDFGanjoorLinks"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PinterestLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AltText") + .HasColumnType("nvarchar(max)"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("GanjoorPostId") + .HasColumnType("int"); + + b.Property("GanjoorTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("GanjoorUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("HumanReviewed") + .HasColumnType("bit"); + + b.Property("IsTextOriginalSource") + .HasColumnType("bit"); + + b.Property("ItemId") + .HasColumnType("uniqueidentifier"); + + b.Property("LinkType") + .HasColumnType("int"); + + b.Property("MatchPercent") + .HasColumnType("int"); + + b.Property("NaskbanLinkId") + .HasColumnType("uniqueidentifier"); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.Property("PageNumber") + .HasColumnType("int"); + + b.Property("PinterestImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PinterestUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewDate") + .HasColumnType("datetime2"); + + b.Property("ReviewDesc") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewResult") + .HasColumnType("int"); + + b.Property("ReviewerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SuggestionDate") + .HasColumnType("datetime2"); + + b.Property("Synchronized") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.HasIndex("ItemId"); + + b.HasIndex("ReviewerId"); + + b.HasIndex("SuggestedById"); + + b.ToTable("PinterestLinks"); + }); + + modelBuilder.Entity("RMuseum.Models.ImportJob.ImportJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtifactId") + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("FriendlyUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("JobType") + .HasColumnType("int"); + + b.Property("ProgressPercent") + .HasColumnType("decimal(18,2)"); + + b.Property("QueueTime") + .HasColumnType("datetime2"); + + b.Property("ResourceNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("SrcContent") + .HasColumnType("nvarchar(max)"); + + b.Property("SrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ArtifactId"); + + b.ToTable("ImportJobs"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("SingerId"); + + b.ToTable("GanjoorAlbum"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("RImageId"); + + b.ToTable("GanjoorSingers"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AlbumId") + .HasColumnType("int"); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlbumId"); + + b.HasIndex("Name"); + + b.ToTable("GanjoorMusicCatalogueTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaCollection", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GolhaCollections"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("GolhaCollectionId") + .HasColumnType("int"); + + b.Property("Mp3") + .HasColumnType("nvarchar(max)"); + + b.Property("ProgramOrder") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("GolhaCollectionId"); + + b.ToTable("GolhaPrograms"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("BlockReason") + .HasColumnType("nvarchar(max)"); + + b.Property("Blocked") + .HasColumnType("bit"); + + b.Property("GolhaProgramId") + .HasColumnType("int"); + + b.Property("SingerId") + .HasColumnType("int"); + + b.Property("Timing") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TrackNo") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("GolhaProgramId"); + + b.HasIndex("SingerId"); + + b.ToTable("GolhaTracks"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("HtmlContent") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Modified") + .HasColumnType("bit"); + + b.Property("NoteType") + .HasColumnType("int"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("RArtifactMasterRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReferenceNoteId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasIndex("RArtifactMasterRecordId"); + + b.HasIndex("ReferenceNoteId"); + + b.ToTable("UserNotes"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNoteAbuseReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("NoteId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReasonText") + .HasColumnType("nvarchar(max)"); + + b.Property("ReporterId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("NoteId"); + + b.HasIndex("ReporterId"); + + b.ToTable("ReportedUserNotes"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.Author", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Bio") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtenalImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NameInOriginalLanguage") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.ToTable("Authors"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.AuthorRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AuthorId") + .HasColumnType("int"); + + b.Property("BookId") + .HasColumnType("int"); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.Property("Role") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("BookId"); + + b.HasIndex("PDFBookId"); + + b.ToTable("AuthorRole"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoverImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtenalCoverImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CoverImageId"); + + b.ToTable("Books"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.MultiVolumePDFCollection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BookId") + .HasColumnType("int"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("VolumeCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BookId"); + + b.ToTable("MultiVolumePDFCollections"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.OCRQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("OCRQueuedItems"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFBook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AuthorsLine") + .HasColumnType("nvarchar(max)"); + + b.Property("BookId") + .HasColumnType("int"); + + b.Property("BookScriptType") + .HasColumnType("int"); + + b.Property("BookText") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimedPageCount") + .HasColumnType("int"); + + b.Property("CoverImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtenalCoverImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalPDFFileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("FileMD5CheckSum") + .HasColumnType("nvarchar(max)"); + + b.Property("ISBN") + .HasColumnType("nvarchar(max)"); + + b.Property("IsTranslation") + .HasColumnType("bit"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("MultiVolumePDFCollectionId") + .HasColumnType("int"); + + b.Property("OCRTime") + .HasColumnType("datetime2"); + + b.Property("OCRed") + .HasColumnType("bit"); + + b.Property("OriginalFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalFileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalSourceName") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalSourceUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("PDFFileId") + .HasColumnType("uniqueidentifier"); + + b.Property("PDFSourceId") + .HasColumnType("int"); + + b.Property("PageCount") + .HasColumnType("int"); + + b.Property("PublisherLine") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishingDate") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishingLocation") + .HasColumnType("nvarchar(max)"); + + b.Property("PublishingNumber") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("StorageFolderName") + .HasColumnType("nvarchar(max)"); + + b.Property("SubTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TitleInOriginalLanguage") + .HasColumnType("nvarchar(max)"); + + b.Property("TranslatorsLine") + .HasColumnType("nvarchar(max)"); + + b.Property("VolumeOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BookId"); + + b.HasIndex("CoverImageId"); + + b.HasIndex("MultiVolumePDFCollectionId"); + + b.HasIndex("PDFFileId"); + + b.HasIndex("PDFSourceId"); + + b.ToTable("PDFBooks"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtenalThumbnailImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("FullResolutionImageHeight") + .HasColumnType("int"); + + b.Property("FullResolutionImageWidth") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("OCRTime") + .HasColumnType("datetime2"); + + b.Property("OCRed") + .HasColumnType("bit"); + + b.Property("PDFBookId") + .HasColumnType("int"); + + b.Property("PageNumber") + .HasColumnType("int"); + + b.Property("PageText") + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailImageId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("PDFBookId"); + + b.HasIndex("ThumbnailImageId"); + + b.ToTable("PDFPages"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFSource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("PDFSources"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.QueuedPDFBook", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuthorsLine") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DownloadOrder") + .HasColumnType("int"); + + b.Property("IsTranslation") + .HasColumnType("bit"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalFileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalSourceName") + .HasColumnType("nvarchar(max)"); + + b.Property("OriginalSourceUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessResult") + .HasColumnType("nvarchar(max)"); + + b.Property("Processed") + .HasColumnType("bit"); + + b.Property("ResultId") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TranslatorsLine") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("QueuedPDFBooks"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ProcessEndTime") + .HasColumnType("datetime2"); + + b.Property("ProcessProgress") + .HasColumnType("int"); + + b.Property("ProcessStartTime") + .HasColumnType("datetime2"); + + b.Property("SessionType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UploadEndTime") + .HasColumnType("datetime2"); + + b.Property("UploadStartTime") + .HasColumnType("datetime2"); + + b.Property("UseId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UploadSessions"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSessionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContentDisposition") + .HasColumnType("nvarchar(max)"); + + b.Property("ContentType") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .HasColumnType("nvarchar(max)"); + + b.Property("FilePath") + .HasColumnType("nvarchar(max)"); + + b.Property("Length") + .HasColumnType("bigint"); + + b.Property("MP3FileCheckSum") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ProcessResult") + .HasColumnType("bit"); + + b.Property("ProcessResultMsg") + .HasColumnType("nvarchar(max)"); + + b.Property("UploadSessionId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UploadSessionId"); + + b.ToTable("UploadedFiles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Audit.Db.REvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Duration") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("EventType") + .HasColumnType("nvarchar(max)"); + + b.Property("IpAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("JsonData") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponseStatusCode") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UserName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("AuditLogs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.BannedEmail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("BannedEmails"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex") + .HasFilter("[NormalizedName] IS NOT NULL"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("Bio") + .HasColumnType("nvarchar(max)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("CreateDate") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("LockoutMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("NickName") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("ScreenName") + .HasColumnType("nvarchar(max)"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("SurName") + .HasColumnType("nvarchar(max)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("Website") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.HasIndex("RImageId"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RCaptchaImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("RImageId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RImageId"); + + b.ToTable("CaptchaImages"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RPermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("OperationShortName") + .HasColumnType("nvarchar(max)"); + + b.Property("RAppRoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurableItemShortName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RAppRoleId"); + + b.ToTable("Permissions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RTemporaryUserSession", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientAppName") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientIPAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("LastRenewal") + .HasColumnType("datetime2"); + + b.Property("LoginTime") + .HasColumnType("datetime2"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Token") + .HasColumnType("nvarchar(max)"); + + b.Property("ValidUntil") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.ToTable("Sessions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RUserBehaviourLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserBehaviourLogs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RVerifyQueueItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientAppName") + .HasColumnType("nvarchar(max)"); + + b.Property("ClientIPAddress") + .HasColumnType("nvarchar(max)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Language") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("QueueType") + .HasColumnType("int"); + + b.Property("Secret") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Secret") + .IsUnique() + .HasFilter("[Secret] IS NOT NULL"); + + b.ToTable("VerifyQueueItems"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.UserOldContact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeDate") + .HasColumnType("datetime2"); + + b.Property("IsEmail") + .HasColumnType("bit"); + + b.Property("NormalizedValue") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserOldContacts"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.ChangeTracking.RChangeLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("EntityId") + .HasColumnType("int"); + + b.Property("EntityJson") + .HasColumnType("nvarchar(max)"); + + b.Property("EntityName") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b.Property("EntityUId") + .HasColumnType("uniqueidentifier"); + + b.Property("Operation") + .HasMaxLength(24) + .HasColumnType("nvarchar(24)"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("WorkspaceId"); + + b.ToTable("RChangeLogs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSPermission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("OperationShortName") + .HasColumnType("nvarchar(max)"); + + b.Property("RWSRoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("SecurableItemShortName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RWSRoleId"); + + b.ToTable("RWSPermissions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalizedName") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WorkspaceId"); + + b.ToTable("RWSRoles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("InviteDate") + .HasColumnType("datetime2"); + + b.Property("MemberFrom") + .HasColumnType("datetime2"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RWorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("WorkspaceOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RAppUserId"); + + b.HasIndex("RWorkspaceId"); + + b.ToTable("RWSUsers"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSUserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.HasIndex("WorkspaceId"); + + b.ToTable("RWSUserRoles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWorkspace", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("CreateDate") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("RWorkspaces"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.WorkspaceUserInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("WorkspaceId"); + + b.ToTable("WorkspaceUserInvitations"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Generic.Db.RGenericOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("RAppUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.Property("WorkspaceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WorkspaceId"); + + b.HasIndex("RAppUserId", "Name") + .IsUnique() + .HasFilter("[RAppUserId] IS NOT NULL AND [Name] IS NOT NULL"); + + b.ToTable("Options"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Generic.Db.RLongRunningJobStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Exception") + .HasColumnType("nvarchar(max)"); + + b.Property("LastUpdate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Progress") + .HasColumnType("float"); + + b.Property("StartTime") + .HasColumnType("datetime2"); + + b.Property("Step") + .HasColumnType("nvarchar(max)"); + + b.Property("Succeeded") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("LongRunningJobs"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Image.RImage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ContentType") + .HasColumnType("nvarchar(max)"); + + b.Property("DataTime") + .HasColumnType("datetime2"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(13) + .HasColumnType("nvarchar(13)"); + + b.Property("FileSizeInBytes") + .HasColumnType("bigint"); + + b.Property("FolderName") + .HasColumnType("nvarchar(max)"); + + b.Property("ImageHeight") + .HasColumnType("int"); + + b.Property("ImageWidth") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("OriginalFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("StoredFileName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("GeneralImages"); + + b.HasDiscriminator("Discriminator").HasValue("RImage"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Notification.RUserNotification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("HtmlText") + .HasColumnType("nvarchar(max)"); + + b.Property("NotificationType") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Subject") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b => + { + b.HasBaseType("RSecurityBackend.Models.Image.RImage"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DescriptionInEnglish") + .HasColumnType("nvarchar(max)"); + + b.Property("ExternalNormalSizeImageUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModifiedMeta") + .HasColumnType("datetime2"); + + b.Property("NormalSizeImageHeight") + .HasColumnType("int"); + + b.Property("NormalSizeImageStoredFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("NormalSizeImageWidth") + .HasColumnType("int"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("RArtifactItemRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("SrcUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("ThumbnailImageHeight") + .HasColumnType("int"); + + b.Property("ThumbnailImageStoredFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailImageWidth") + .HasColumnType("int"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("TitleInEnglish") + .HasColumnType("nvarchar(max)"); + + b.HasIndex("RArtifactItemRecordId"); + + b.HasDiscriminator().HasValue("RPictureFile"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Accounting.DonationExpenditure", b => + { + b.HasOne("RMuseum.Models.Accounting.GanjoorDonation", "GanjoorDonation") + .WithMany() + .HasForeignKey("GanjoorDonationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Accounting.GanjoorExpense", null) + .WithMany("DonationExpenditures") + .HasForeignKey("GanjoorExpenseId"); + + b.Navigation("GanjoorDonation"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactItemRecord", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", null) + .WithMany("Items") + .HasForeignKey("RArtifactMasterRecordId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactMasterRecord", b => + { + b.HasOne("RMuseum.Models.Artifact.RPictureFile", "CoverImage") + .WithMany() + .HasForeignKey("CoverImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CoverImage"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RTagValue", b => + { + b.HasOne("RMuseum.Models.PDFLibrary.Book", null) + .WithMany("Tags") + .HasForeignKey("BookId"); + + b.HasOne("RMuseum.Models.PDFLibrary.PDFBook", null) + .WithMany("Tags") + .HasForeignKey("PDFBookId"); + + b.HasOne("RMuseum.Models.PDFLibrary.PDFPage", null) + .WithMany("Tags") + .HasForeignKey("PDFPageId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", null) + .WithMany("Tags") + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", null) + .WithMany("Tags") + .HasForeignKey("RArtifactMasterRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RTag", "RTag") + .WithMany() + .HasForeignKey("RTagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RTag"); + }); + + modelBuilder.Entity("RMuseum.Models.Bookmark.RUserBookmark", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "RArtifactItemRecord") + .WithMany() + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "RArtifactMasterRecord") + .WithMany() + .HasForeignKey("RArtifactMasterRecordId"); + + b.Navigation("RAppUser"); + + b.Navigation("RArtifactItemRecord"); + + b.Navigation("RArtifactMasterRecord"); + }); + + modelBuilder.Entity("RMuseum.Models.FAQ.FAQItem", b => + { + b.HasOne("RMuseum.Models.FAQ.FAQCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCachedRelatedPoem", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCachedRelatedSection", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCat", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId"); + + b.Navigation("Parent"); + + b.Navigation("Poet"); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCatCorrection", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat") + .WithMany() + .HasForeignKey("CatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cat"); + + b.Navigation("ReviewerUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCenturyPoet", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCentury", null) + .WithMany("Poets") + .HasForeignKey("GanjoorCenturyId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId"); + + b.Navigation("Poet"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorComment", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorComment", "InReplyTo") + .WithMany() + .HasForeignKey("InReplyToId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorVerse", "Verse1") + .WithMany() + .HasForeignKey("Verse1Id"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorVerse", "Verse2") + .WithMany() + .HasForeignKey("Verse2Id"); + + b.Navigation("InReplyTo"); + + b.Navigation("Poem"); + + b.Navigation("User"); + + b.Navigation("Verse1"); + + b.Navigation("Verse2"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCommentAbuseReport", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorComment", "GanjoorComment") + .WithMany() + .HasForeignKey("GanjoorCommentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReportedBy") + .WithMany() + .HasForeignKey("ReportedById"); + + b.Navigation("GanjoorComment"); + + b.Navigation("ReportedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCommentReaction", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorComment", "GanjoorComment") + .WithMany() + .HasForeignKey("GanjoorCommentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GanjoorComment"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorDuplicate", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "DestPoem") + .WithMany() + .HasForeignKey("DestPoemId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "SrcPoem") + .WithMany() + .HasForeignKey("SrcPoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DestPoem"); + + b.Navigation("SrcPoem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorNumbering", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "EndCat") + .WithMany() + .HasForeignKey("EndCatId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "StartCat") + .WithMany() + .HasForeignKey("StartCatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EndCat"); + + b.Navigation("StartCat"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPage", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat") + .WithMany() + .HasForeignKey("CatId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPage", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "SecondPoet") + .WithMany() + .HasForeignKey("SecondPoetId"); + + b.Navigation("Cat"); + + b.Navigation("Parent"); + + b.Navigation("Poem"); + + b.Navigation("Poet"); + + b.Navigation("SecondPoet"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPageSnapshot", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPage", "GanjoorPage") + .WithMany() + .HasForeignKey("GanjoorPageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "MadeObsoleteByUser") + .WithMany() + .HasForeignKey("MadeObsoleteByUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GanjoorPage"); + + b.Navigation("MadeObsoleteByUser"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonAffiliation", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person1") + .WithMany() + .HasForeignKey("Person1Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person2") + .WithMany() + .HasForeignKey("Person2Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Person1"); + + b.Navigation("Person2"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonEditSuggestion", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person") + .WithMany() + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "SuggestedBirthLocation") + .WithMany() + .HasForeignKey("SuggestedBirthLocationId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "SuggestedDeathLocation") + .WithMany() + .HasForeignKey("SuggestedDeathLocationId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Person"); + + b.Navigation("ReviewerUser"); + + b.Navigation("SuggestedBirthLocation"); + + b.Navigation("SuggestedDeathLocation"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonRelation", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person1") + .WithMany() + .HasForeignKey("Person1Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person2") + .WithMany() + .HasForeignKey("Person2Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Person1"); + + b.Navigation("Person2"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonRelationEditSuggestion", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPersonAffiliation", "ExistingAffiliation") + .WithMany() + .HasForeignKey("ExistingAffiliationId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPersonRelation", "ExistingRelation") + .WithMany() + .HasForeignKey("ExistingRelationId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person1") + .WithMany() + .HasForeignKey("Person1Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person2") + .WithMany() + .HasForeignKey("Person2Id") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExistingAffiliation"); + + b.Navigation("ExistingRelation"); + + b.Navigation("Person1"); + + b.Navigation("Person2"); + + b.Navigation("ReviewerUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoem", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorCat", "Cat") + .WithMany() + .HasForeignKey("CatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorMetre", "GanjoorMetre") + .WithMany() + .HasForeignKey("GanjoorMetreId"); + + b.Navigation("Cat"); + + b.Navigation("GanjoorMetre"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poem"); + + b.Navigation("ReviewerUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemGeoDateTagCorrection", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", null) + .WithMany("GeoDateTags") + .HasForeignKey("GanjoorPoemCorrectionId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person") + .WithMany() + .HasForeignKey("PersonId"); + + b.Navigation("Location"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemProbableMetre", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemSection", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorMetre", "GanjoorMetre") + .WithMany() + .HasForeignKey("GanjoorMetreId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId"); + + b.Navigation("GanjoorMetre"); + + b.Navigation("Poem"); + + b.Navigation("Poet"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemSectionCorrection", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoemSection", "Section") + .WithMany() + .HasForeignKey("SectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ReviewerUser"); + + b.Navigation("Section"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoet", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "BirthLocation") + .WithMany() + .HasForeignKey("BirthLocationId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "DeathLocation") + .WithMany() + .HasForeignKey("DeathLocationId"); + + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId"); + + b.Navigation("BirthLocation"); + + b.Navigation("DeathLocation"); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoetSuggestedPicture", b => + { + b.HasOne("RMuseum.Models.Artifact.RPictureFile", "Picture") + .WithMany() + .HasForeignKey("PictureId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + + b.Navigation("Picture"); + + b.Navigation("Poet"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoetSuggestedSpecLine", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + + b.Navigation("Poet"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorQuotedPoem", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "ReviewerUser") + .WithMany() + .HasForeignKey("ReviewerUserId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + + b.Navigation("Poem"); + + b.Navigation("ReviewerUser"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "BirthLocation") + .WithMany() + .HasForeignKey("BirthLocationId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "DeathLocation") + .WithMany() + .HasForeignKey("DeathLocationId"); + + b.Navigation("BirthLocation"); + + b.Navigation("DeathLocation"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorSiteBanner", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikCat", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorTajikPoet", "Poet") + .WithMany() + .HasForeignKey("PoetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poet"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorTajikPoem", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorTajikCat", "Cat") + .WithMany() + .HasForeignKey("CatId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cat"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorUserBookmark", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Poem"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorUserPoemVisit", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Poem"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerse", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorLanguage", "Language") + .WithMany() + .HasForeignKey("LanguageId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Language"); + + b.Navigation("Poem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseNumber", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorNumbering", "Numbering") + .WithMany() + .HasForeignKey("NumberingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Numbering"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorVerseVOrderText", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", null) + .WithMany("VerseOrderText") + .HasForeignKey("GanjoorPoemCorrectionId"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemGeoDateTag", b => + { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorGeoLocation", "Location") + .WithMany() + .HasForeignKey("LocationId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorRelatedPerson", "Person") + .WithMany() + .HasForeignKey("PersonId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Location"); + + b.Navigation("Person"); + + b.Navigation("Poem"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.PoemMusicTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorTrack", "GanjoorTrack") + .WithMany() + .HasForeignKey("GanjoorTrackId"); + + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaTrack", "GolhaTrack") + .WithMany() + .HasForeignKey("GolhaTrackId"); + + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPoem", "Poem") + .WithMany() + .HasForeignKey("PoemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + + b.Navigation("GanjoorTrack"); + + b.Navigation("GolhaTrack"); + + b.Navigation("Poem"); + + b.Navigation("Singer"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.Recitation", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.Navigation("Owner"); + + b.Navigation("Reviewer"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationApprovedMistake", b => + { + b.HasOne("RMuseum.Models.GanjoorAudio.Recitation", "Recitation") + .WithMany() + .HasForeignKey("RecitationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Recitation"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationErrorReport", b => + { + b.HasOne("RMuseum.Models.GanjoorAudio.Recitation", "Recitation") + .WithMany() + .HasForeignKey("RecitationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reporter") + .WithMany() + .HasForeignKey("ReporterId"); + + b.Navigation("Recitation"); + + b.Navigation("Reporter"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationPublishingTracker", b => + { + b.HasOne("RMuseum.Models.GanjoorAudio.Recitation", "PoemNarration") + .WithMany() + .HasForeignKey("PoemNarrationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PoemNarration"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.RecitationUserUpVote", b => + { + b.HasOne("RMuseum.Models.GanjoorAudio.Recitation", "Recitation") + .WithMany() + .HasForeignKey("RecitationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Recitation"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorAudio.UserRecitationProfile", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.GanjoorLink", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "Item") + .WithMany() + .HasForeignKey("ItemId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Artifact"); + + b.Navigation("Item"); + + b.Navigation("Reviewer"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PDFGanjoorLink", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Reviewer"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.GanjoorIntegration.PinterestLink", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "Item") + .WithMany() + .HasForeignKey("ItemId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reviewer") + .WithMany() + .HasForeignKey("ReviewerId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "SuggestedBy") + .WithMany() + .HasForeignKey("SuggestedById"); + + b.Navigation("Artifact"); + + b.Navigation("Item"); + + b.Navigation("Reviewer"); + + b.Navigation("SuggestedBy"); + }); + + modelBuilder.Entity("RMuseum.Models.ImportJob.ImportJob", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "Artifact") + .WithMany() + .HasForeignKey("ArtifactId"); + + b.Navigation("Artifact"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany("Albums") + .HasForeignKey("SingerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Singer"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId"); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorAlbum", "Album") + .WithMany("Tracks") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Album"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaCollection", "GolhaCollection") + .WithMany("Programs") + .HasForeignKey("GolhaCollectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("GolhaCollection"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaTrack", b => + { + b.HasOne("RMuseum.Models.MusicCatalogue.GolhaProgram", "GolhaProgram") + .WithMany("Tracks") + .HasForeignKey("GolhaProgramId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.MusicCatalogue.GanjoorSinger", "Singer") + .WithMany() + .HasForeignKey("SingerId"); + + b.Navigation("GolhaProgram"); + + b.Navigation("Singer"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNote", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", "RArtifactItemRecord") + .WithMany() + .HasForeignKey("RArtifactItemRecordId"); + + b.HasOne("RMuseum.Models.Artifact.RArtifactMasterRecord", "RArtifactMasterRecord") + .WithMany() + .HasForeignKey("RArtifactMasterRecordId"); + + b.HasOne("RMuseum.Models.Note.RUserNote", "ReferenceNote") + .WithMany() + .HasForeignKey("ReferenceNoteId"); + + b.Navigation("RAppUser"); + + b.Navigation("RArtifactItemRecord"); + + b.Navigation("RArtifactMasterRecord"); + + b.Navigation("ReferenceNote"); + }); + + modelBuilder.Entity("RMuseum.Models.Note.RUserNoteAbuseReport", b => + { + b.HasOne("RMuseum.Models.Note.RUserNote", "Note") + .WithMany() + .HasForeignKey("NoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "Reporter") + .WithMany() + .HasForeignKey("ReporterId"); + + b.Navigation("Note"); + + b.Navigation("Reporter"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.Author", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "Image") + .WithMany() + .HasForeignKey("ImageId"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.AuthorRole", b => + { + b.HasOne("RMuseum.Models.PDFLibrary.Author", "Author") + .WithMany() + .HasForeignKey("AuthorId"); + + b.HasOne("RMuseum.Models.PDFLibrary.Book", null) + .WithMany("Authors") + .HasForeignKey("BookId"); + + b.HasOne("RMuseum.Models.PDFLibrary.PDFBook", null) + .WithMany("Contributers") + .HasForeignKey("PDFBookId"); + + b.Navigation("Author"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.Book", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "CoverImage") + .WithMany() + .HasForeignKey("CoverImageId"); + + b.Navigation("CoverImage"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.MultiVolumePDFCollection", b => + { + b.HasOne("RMuseum.Models.PDFLibrary.Book", "Book") + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Book"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFBook", b => + { + b.HasOne("RMuseum.Models.PDFLibrary.Book", "Book") + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Image.RImage", "CoverImage") + .WithMany() + .HasForeignKey("CoverImageId"); + + b.HasOne("RMuseum.Models.PDFLibrary.MultiVolumePDFCollection", "MultiVolumePDFCollection") + .WithMany() + .HasForeignKey("MultiVolumePDFCollectionId"); + + b.HasOne("RSecurityBackend.Models.Image.RImage", "PDFFile") + .WithMany() + .HasForeignKey("PDFFileId"); + + b.HasOne("RMuseum.Models.PDFLibrary.PDFSource", "PDFSource") + .WithMany() + .HasForeignKey("PDFSourceId"); + + b.Navigation("Book"); + + b.Navigation("CoverImage"); + + b.Navigation("MultiVolumePDFCollection"); + + b.Navigation("PDFFile"); + + b.Navigation("PDFSource"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFPage", b => + { + b.HasOne("RMuseum.Models.PDFLibrary.PDFBook", null) + .WithMany("Pages") + .HasForeignKey("PDFBookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Image.RImage", "ThumbnailImage") + .WithMany() + .HasForeignKey("ThumbnailImageId"); + + b.Navigation("ThumbnailImage"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSessionFile", b => + { + b.HasOne("RMuseum.Models.UploadSession.UploadSession", null) + .WithMany("UploadedFiles") + .HasForeignKey("UploadSessionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppUser", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId"); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RCaptchaImage", b => + { + b.HasOne("RSecurityBackend.Models.Image.RImage", "RImage") + .WithMany() + .HasForeignKey("RImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RImage"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RPermission", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppRole", null) + .WithMany("Permissions") + .HasForeignKey("RAppRoleId"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RTemporaryUserSession", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RAppUser"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RUserBehaviourLog", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.UserOldContact", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.ChangeTracking.RChangeLog", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId"); + + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace") + .WithMany() + .HasForeignKey("WorkspaceId"); + + b.Navigation("RAppUser"); + + b.Navigation("Workspace"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSPermission", b => + { + b.HasOne("RSecurityBackend.Models.Cloud.RWSRole", null) + .WithMany("Permissions") + .HasForeignKey("RWSRoleId"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSRole", b => + { + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace") + .WithMany() + .HasForeignKey("WorkspaceId"); + + b.Navigation("Workspace"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSUser", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId"); + + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", null) + .WithMany("Members") + .HasForeignKey("RWorkspaceId"); + + b.Navigation("RAppUser"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSUserRole", b => + { + b.HasOne("RSecurityBackend.Models.Cloud.RWSRole", "Role") + .WithMany() + .HasForeignKey("RoleId"); + + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace") + .WithMany() + .HasForeignKey("WorkspaceId"); + + b.Navigation("Role"); + + b.Navigation("User"); + + b.Navigation("Workspace"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.WorkspaceUserInvitation", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace") + .WithMany() + .HasForeignKey("WorkspaceId"); + + b.Navigation("User"); + + b.Navigation("Workspace"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Generic.Db.RGenericOption", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "RAppUser") + .WithMany() + .HasForeignKey("RAppUserId"); + + b.HasOne("RSecurityBackend.Models.Cloud.RWorkspace", "Workspace") + .WithMany() + .HasForeignKey("WorkspaceId"); + + b.Navigation("RAppUser"); + + b.Navigation("Workspace"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Notification.RUserNotification", b => + { + b.HasOne("RSecurityBackend.Models.Auth.Db.RAppUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RPictureFile", b => + { + b.HasOne("RMuseum.Models.Artifact.RArtifactItemRecord", null) + .WithMany("Images") + .HasForeignKey("RArtifactItemRecordId"); + }); + + modelBuilder.Entity("RMuseum.Models.Accounting.GanjoorExpense", b => + { + b.Navigation("DonationExpenditures"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactItemRecord", b => + { + b.Navigation("Images"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.Artifact.RArtifactMasterRecord", b => + { + b.Navigation("Items"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorCentury", b => + { + b.Navigation("Poets"); + }); + + modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPoemCorrection", b => + { + b.Navigation("GeoDateTags"); + + b.Navigation("VerseOrderText"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorAlbum", b => + { + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GanjoorSinger", b => + { + b.Navigation("Albums"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaCollection", b => + { + b.Navigation("Programs"); + }); + + modelBuilder.Entity("RMuseum.Models.MusicCatalogue.GolhaProgram", b => + { + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.Book", b => + { + b.Navigation("Authors"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFBook", b => + { + b.Navigation("Contributers"); + + b.Navigation("Pages"); + + b.Navigation("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFPage", b => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b => + { + b.Navigation("UploadedFiles"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Auth.Db.RAppRole", b => + { + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWSRole", b => + { + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("RSecurityBackend.Models.Cloud.RWorkspace", b => + { + b.Navigation("Members"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.cs b/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.cs new file mode 100644 index 00000000..91b662c4 --- /dev/null +++ b/RMuseum/Migrations/20260930170542_AddPersonRelationSuggestionAffiliationSupport.cs @@ -0,0 +1,70 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace RMuseum.Migrations +{ + /// + public partial class AddPersonRelationSuggestionAffiliationSupport : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions", + type: "int", + nullable: true); + + migrationBuilder.AddColumn( + name: "Kind", + table: "GanjoorPersonRelationEditSuggestions", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "SuggestedAffiliationType", + table: "GanjoorPersonRelationEditSuggestions", + type: "int", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_GanjoorPersonRelationEditSuggestions_ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions", + column: "ExistingAffiliationId"); + + migrationBuilder.AddForeignKey( + name: "FK_GanjoorPersonRelationEditSuggestions_GanjoorPersonAffiliations_ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions", + column: "ExistingAffiliationId", + principalTable: "GanjoorPersonAffiliations", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_GanjoorPersonRelationEditSuggestions_GanjoorPersonAffiliations_ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions"); + + migrationBuilder.DropIndex( + name: "IX_GanjoorPersonRelationEditSuggestions_ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions"); + + migrationBuilder.DropColumn( + name: "ExistingAffiliationId", + table: "GanjoorPersonRelationEditSuggestions"); + + migrationBuilder.DropColumn( + name: "Kind", + table: "GanjoorPersonRelationEditSuggestions"); + + migrationBuilder.DropColumn( + name: "SuggestedAffiliationType", + table: "GanjoorPersonRelationEditSuggestions"); + } + } +} diff --git a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs index 6ca829d0..47a007d0 100644 --- a/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs +++ b/RMuseum/Migrations/RMuseumDbContextModelSnapshot.cs @@ -1557,9 +1557,15 @@ namespace RMuseum.Migrations b.Property("Date") .HasColumnType("datetime2"); + b.Property("ExistingAffiliationId") + .HasColumnType("int"); + b.Property("ExistingRelationId") .HasColumnType("int"); + b.Property("Kind") + .HasColumnType("int"); + b.Property("Person1Id") .HasColumnType("int"); @@ -1581,6 +1587,9 @@ namespace RMuseum.Migrations b.Property("ReviewerUserId") .HasColumnType("uniqueidentifier"); + b.Property("SuggestedAffiliationType") + .HasColumnType("int"); + b.Property("SuggestedDegreeHint") .HasColumnType("int"); @@ -1598,6 +1607,8 @@ namespace RMuseum.Migrations b.HasKey("Id"); + b.HasIndex("ExistingAffiliationId"); + b.HasIndex("ExistingRelationId"); b.HasIndex("Person1Id"); @@ -5514,6 +5525,11 @@ namespace RMuseum.Migrations modelBuilder.Entity("RMuseum.Models.Ganjoor.GanjoorPersonRelationEditSuggestion", b => { + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPersonAffiliation", "ExistingAffiliation") + .WithMany() + .HasForeignKey("ExistingAffiliationId") + .OnDelete(DeleteBehavior.Restrict); + b.HasOne("RMuseum.Models.Ganjoor.GanjoorPersonRelation", "ExistingRelation") .WithMany() .HasForeignKey("ExistingRelationId") @@ -5541,6 +5557,8 @@ namespace RMuseum.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("ExistingAffiliation"); + b.Navigation("ExistingRelation"); b.Navigation("Person1"); diff --git a/RMuseum/Models/Ganjoor/GanjoorPersonRelationEditSuggestion.cs b/RMuseum/Models/Ganjoor/GanjoorPersonRelationEditSuggestion.cs index 5c42d554..4458f1fc 100644 --- a/RMuseum/Models/Ganjoor/GanjoorPersonRelationEditSuggestion.cs +++ b/RMuseum/Models/Ganjoor/GanjoorPersonRelationEditSuggestion.cs @@ -23,17 +23,39 @@ namespace RMuseum.Models.Ganjoor public PersonRelationSuggestionAction Action { get; set; } /// - /// for Modify/Remove: the existing GanjoorPersonRelation row this suggestion targets. Null - /// for Add, where there's nothing existing yet. + /// whether this suggestion is about a kinship edge (Family, using SuggestedRelationType / + /// ExistingRelationId / ExistingRelation) or a non-family affiliation edge (Affiliation, using + /// SuggestedAffiliationType / ExistingAffiliationId / ExistingAffiliation instead). Defaults + /// to Family so rows created before this field existed keep working unchanged. + /// + public PersonRelationSuggestionKind Kind { get; set; } + + /// + /// for Modify/Remove when Kind is Family: the existing GanjoorPersonRelation row this + /// suggestion targets. Null for Add, where there's nothing existing yet, and for any + /// Kind == Affiliation suggestion (see ExistingAffiliationId instead). /// public int? ExistingRelationId { get; set; } /// /// the existing relation being modified/removed (for showing a before/after diff to the - /// moderator) - null for Add + /// moderator) - null for Add, and for Kind == Affiliation /// public virtual GanjoorPersonRelation ExistingRelation { get; set; } + /// + /// for Modify/Remove when Kind is Affiliation: the existing GanjoorPersonAffiliation row this + /// suggestion targets. Null for Add, and for any Kind == Family suggestion (see + /// ExistingRelationId instead). + /// + public int? ExistingAffiliationId { get; set; } + + /// + /// the existing affiliation being modified/removed (for showing a before/after diff to the + /// moderator) - null unless Kind is Affiliation and Action is Modify/Remove + /// + public virtual GanjoorPersonAffiliation ExistingAffiliation { get; set; } + /// /// the pair this suggestion is about. For Add, this and Person2Id define the new relation. /// For Modify/Remove, these are copied from ExistingRelation at submission time, so the @@ -58,11 +80,19 @@ namespace RMuseum.Models.Ganjoor public virtual GanjoorRelatedPerson Person2 { get; set; } /// - /// for Add/Modify: the relation type to create/change to. For Remove: a snapshot of the - /// existing relation's type at submission time, purely for display (removing doesn't use it). + /// for Add/Modify when Kind is Family: the relation type to create/change to. For Remove: a + /// snapshot of the existing relation's type at submission time, purely for display (removing + /// doesn't use it). Ignored when Kind is Affiliation - see SuggestedAffiliationType instead. /// public PersonRelationType SuggestedRelationType { get; set; } + /// + /// for Add/Modify when Kind is Affiliation: the affiliation type to create/change to. For + /// Remove: a snapshot of the existing affiliation's type at submission time, purely for + /// display. Null/ignored when Kind is Family - see SuggestedRelationType instead. + /// + public PersonAffiliationType? SuggestedAffiliationType { get; set; } + /// /// see GanjoorPersonRelation.DegreeHint - same for/Add/Modify/Remove-display purpose as /// SuggestedRelationType above diff --git a/RMuseum/Models/Ganjoor/PersonRelationSuggestionKind.cs b/RMuseum/Models/Ganjoor/PersonRelationSuggestionKind.cs new file mode 100644 index 00000000..32ad1f11 --- /dev/null +++ b/RMuseum/Models/Ganjoor/PersonRelationSuggestionKind.cs @@ -0,0 +1,16 @@ +namespace RMuseum.Models.Ganjoor +{ + /// + /// which kind of edge a GanjoorPersonRelationEditSuggestion is about: a kinship tie + /// (GanjoorPersonRelation, via SuggestedRelationType/ExistingRelationId) or a non-family + /// affiliation tie (GanjoorPersonAffiliation, via SuggestedAffiliationType/ExistingAffiliationId). + /// Defaults to Family (0), so every suggestion row created before this field existed keeps being + /// read exactly as it was before - a plain kinship suggestion. + /// + public enum PersonRelationSuggestionKind + { + Family = 0, + + Affiliation = 1, + } +} diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 44d9747f..371bc22a 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -4955,6 +4955,18 @@ + + + + + + + + + + + + donation expenditures @@ -9590,16 +9602,38 @@ what this suggestion proposes doing + + + whether this suggestion is about a kinship edge (Family, using SuggestedRelationType / + ExistingRelationId / ExistingRelation) or a non-family affiliation edge (Affiliation, using + SuggestedAffiliationType / ExistingAffiliationId / ExistingAffiliation instead). Defaults + to Family so rows created before this field existed keep working unchanged. + + - for Modify/Remove: the existing GanjoorPersonRelation row this suggestion targets. Null - for Add, where there's nothing existing yet. + for Modify/Remove when Kind is Family: the existing GanjoorPersonRelation row this + suggestion targets. Null for Add, where there's nothing existing yet, and for any + Kind == Affiliation suggestion (see ExistingAffiliationId instead). the existing relation being modified/removed (for showing a before/after diff to the - moderator) - null for Add + moderator) - null for Add, and for Kind == Affiliation + + + + + for Modify/Remove when Kind is Affiliation: the existing GanjoorPersonAffiliation row this + suggestion targets. Null for Add, and for any Kind == Family suggestion (see + ExistingRelationId instead). + + + + + the existing affiliation being modified/removed (for showing a before/after diff to the + moderator) - null unless Kind is Affiliation and Action is Modify/Remove @@ -9627,8 +9661,16 @@ - for Add/Modify: the relation type to create/change to. For Remove: a snapshot of the - existing relation's type at submission time, purely for display (removing doesn't use it). + for Add/Modify when Kind is Family: the relation type to create/change to. For Remove: a + snapshot of the existing relation's type at submission time, purely for display (removing + doesn't use it). Ignored when Kind is Affiliation - see SuggestedAffiliationType instead. + + + + + for Add/Modify when Kind is Affiliation: the affiliation type to create/change to. For + Remove: a snapshot of the existing affiliation's type at submission time, purely for + display. Null/ignored when Kind is Family - see SuggestedRelationType instead. @@ -11819,6 +11861,15 @@ remove the existing relation ExistingRelationId points to outright + + + which kind of edge a GanjoorPersonRelationEditSuggestion is about: a kinship tie + (GanjoorPersonRelation, via SuggestedRelationType/ExistingRelationId) or a non-family + affiliation tie (GanjoorPersonAffiliation, via SuggestedAffiliationType/ExistingAffiliationId). + Defaults to Family (0), so every suggestion row created before this field existed keeps being + read exactly as it was before - a plain kinship suggestion. + + the kind of kinship edge a GanjoorPersonRelation represents between two GanjoorRelatedPerson diff --git a/RMuseum/Services/Implementation/GanjoorRelatedPersonService.cs b/RMuseum/Services/Implementation/GanjoorRelatedPersonService.cs index 9dc6008d..fc2d5a7f 100644 --- a/RMuseum/Services/Implementation/GanjoorRelatedPersonService.cs +++ b/RMuseum/Services/Implementation/GanjoorRelatedPersonService.cs @@ -465,16 +465,18 @@ namespace RMuseum.Services.Implementation var affiliations = await _context.GanjoorPersonAffiliations .Where(a => a.Person1Id == person.Id || a.Person2Id == person.Id) .ToListAsync(); + var affiliationIds = affiliations.Select(a => a.Id).ToList(); // any other still-pending relation-edit suggestion that touches this person directly, or - // targets one of the relations we're about to remove, would otherwise dangle or violate - // the Restrict FK above - auto-reject those with an explanatory note rather than letting - // the delete fail or silently drop them + // targets one of the relations/affiliations we're about to remove, would otherwise dangle + // or violate the Restrict FKs above - auto-reject those with an explanatory note rather + // than letting the delete fail or silently drop them var conflictingRelationSuggestions = await _context.GanjoorPersonRelationEditSuggestions .Where(s => !s.Reviewed && ( s.Person1Id == person.Id || s.Person2Id == person.Id || - (s.ExistingRelationId != null && relationIds.Contains(s.ExistingRelationId.Value)) + (s.ExistingRelationId != null && relationIds.Contains(s.ExistingRelationId.Value)) || + (s.ExistingAffiliationId != null && affiliationIds.Contains(s.ExistingAffiliationId.Value)) )) .ToListAsync(); foreach (var conflicting in conflictingRelationSuggestions) @@ -553,34 +555,65 @@ namespace RMuseum.Services.Implementation } GanjoorPersonRelation existingRelation = null; + GanjoorPersonAffiliation existingAffiliation = null; if (suggestion.Action == PersonRelationSuggestionAction.Modify || suggestion.Action == PersonRelationSuggestionAction.Remove) { - if (suggestion.ExistingRelationId == null) + if (suggestion.Kind == PersonRelationSuggestionKind.Affiliation) { - return new RServiceResult(null, "نسبت مورد نظر برای ویرایش یا حذف مشخص نشده است."); + if (suggestion.ExistingAffiliationId == null) + { + return new RServiceResult(null, "وابستگی مورد نظر برای ویرایش یا حذف مشخص نشده است."); + } + + existingAffiliation = await _context.GanjoorPersonAffiliations + .Include(a => a.Person1) + .Include(a => a.Person2) + .Where(a => a.Id == suggestion.ExistingAffiliationId.Value) + .SingleOrDefaultAsync(); + + if (existingAffiliation == null) + { + return new RServiceResult(null, "وابستگی مورد نظر پیدا نشد."); + } + + // same trust-the-existing-row convention as the Family branch below + suggestion.Person1Id = existingAffiliation.Person1Id; + suggestion.Person2Id = existingAffiliation.Person2Id; + if (suggestion.Action == PersonRelationSuggestionAction.Remove) + { + suggestion.SuggestedAffiliationType = existingAffiliation.AffiliationType; + suggestion.SuggestedNote = existingAffiliation.Note; + } } - - existingRelation = await _context.GanjoorPersonRelations - .Include(r => r.Person1) - .Include(r => r.Person2) - .Where(r => r.Id == suggestion.ExistingRelationId.Value) - .SingleOrDefaultAsync(); - - if (existingRelation == null) + else { - return new RServiceResult(null, "نسبت مورد نظر پیدا نشد."); - } + if (suggestion.ExistingRelationId == null) + { + return new RServiceResult(null, "نسبت مورد نظر برای ویرایش یا حذف مشخص نشده است."); + } - // always trust the existing relation's own Person1Id/Person2Id/type/etc over - // whatever the client sent, so the suggestion is guaranteed self-consistent with - // what it actually targets, even for a Remove-display - suggestion.Person1Id = existingRelation.Person1Id; - suggestion.Person2Id = existingRelation.Person2Id; - if (suggestion.Action == PersonRelationSuggestionAction.Remove) - { - suggestion.SuggestedRelationType = existingRelation.RelationType; - suggestion.SuggestedDegreeHint = existingRelation.DegreeHint; - suggestion.SuggestedNote = existingRelation.Note; + existingRelation = await _context.GanjoorPersonRelations + .Include(r => r.Person1) + .Include(r => r.Person2) + .Where(r => r.Id == suggestion.ExistingRelationId.Value) + .SingleOrDefaultAsync(); + + if (existingRelation == null) + { + return new RServiceResult(null, "نسبت مورد نظر پیدا نشد."); + } + + // always trust the existing relation's own Person1Id/Person2Id/type/etc over + // whatever the client sent, so the suggestion is guaranteed self-consistent with + // what it actually targets, even for a Remove-display + suggestion.Person1Id = existingRelation.Person1Id; + suggestion.Person2Id = existingRelation.Person2Id; + if (suggestion.Action == PersonRelationSuggestionAction.Remove) + { + suggestion.SuggestedRelationType = existingRelation.RelationType; + suggestion.SuggestedDegreeHint = existingRelation.DegreeHint; + suggestion.SuggestedNote = existingRelation.Note; + } } } else // Add @@ -600,6 +633,7 @@ namespace RMuseum.Services.Implementation suggestion.Id = 0; suggestion.ExistingRelation = null; + suggestion.ExistingAffiliation = null; suggestion.Person1 = null; suggestion.Person2 = null; suggestion.Date = DateTime.Now; @@ -613,17 +647,19 @@ namespace RMuseum.Services.Implementation _context.GanjoorPersonRelationEditSuggestions.Add(suggestion); await _context.SaveChangesAsync(); + bool isAffiliation = suggestion.Kind == PersonRelationSuggestionKind.Affiliation; string actionTitle = suggestion.Action switch { - PersonRelationSuggestionAction.Add => "پیشنهاد نسبت خویشاوندی جدید", - PersonRelationSuggestionAction.Modify => "پیشنهاد ویرایش نسبت خویشاوندی", - _ => "پیشنهاد حذف نسبت خویشاوندی", + PersonRelationSuggestionAction.Add => isAffiliation ? "پیشنهاد وابستگی جدید" : "پیشنهاد نسبت خویشاوندی جدید", + PersonRelationSuggestionAction.Modify => isAffiliation ? "پیشنهاد ویرایش وابستگی" : "پیشنهاد ویرایش نسبت خویشاوندی", + _ => isAffiliation ? "پیشنهاد حذف وابستگی" : "پیشنهاد حذف نسبت خویشاوندی", }; + string edgeLabel = isAffiliation ? "وابستگی" : "نسبت خویشاوندی"; string actionText = suggestion.Action switch { - PersonRelationSuggestionAction.Add => $"کاربری پیشنهاد افزودن نسبت خویشاوندی جدید بین «{person1.Name}» و «{person2.Name}» را داده است.", - PersonRelationSuggestionAction.Modify => $"کاربری پیشنهاد ویرایش نسبت خویشاوندی بین «{person1.Name}» و «{person2.Name}» را داده است.", - _ => $"کاربری پیشنهاد حذف نسبت خویشاوندی بین «{person1.Name}» و «{person2.Name}» را داده است.", + PersonRelationSuggestionAction.Add => $"کاربری پیشنهاد افزودن {edgeLabel} جدید بین «{person1.Name}» و «{person2.Name}» را داده است.", + PersonRelationSuggestionAction.Modify => $"کاربری پیشنهاد ویرایش {edgeLabel} بین «{person1.Name}» و «{person2.Name}» را داده است.", + _ => $"کاربری پیشنهاد حذف {edgeLabel} بین «{person1.Name}» و «{person2.Name}» را داده است.", }; await NotifyModeratorsOfPendingSuggestionAsync( @@ -652,6 +688,7 @@ namespace RMuseum.Services.Implementation .Include(s => s.Person1) .Include(s => s.Person2) .Include(s => s.ExistingRelation) + .Include(s => s.ExistingAffiliation) .Include(s => s.User) .Where(s => s.Reviewed == false) .OrderBy(s => s.Id) @@ -715,51 +752,101 @@ namespace RMuseum.Services.Implementation if (result == CorrectionReviewResult.Approved) { - switch (suggestion.Action) + if (suggestion.Kind == PersonRelationSuggestionKind.Affiliation) { - case PersonRelationSuggestionAction.Add: - _context.GanjoorPersonRelations.Add(new GanjoorPersonRelation() - { - Person1Id = suggestion.Person1Id, - Person2Id = suggestion.Person2Id, - RelationType = suggestion.SuggestedRelationType, - DegreeHint = suggestion.SuggestedDegreeHint, - Note = suggestion.SuggestedNote, - }); - break; - case PersonRelationSuggestionAction.Modify: - { - var existing = await _context.GanjoorPersonRelations.Where(r => r.Id == suggestion.ExistingRelationId.Value).SingleOrDefaultAsync(); - if (existing == null) + switch (suggestion.Action) + { + case PersonRelationSuggestionAction.Add: + _context.GanjoorPersonAffiliations.Add(new GanjoorPersonAffiliation() { - return new RServiceResult(null, "نسبت مورد نظر دیگر وجود ندارد."); - } - existing.RelationType = suggestion.SuggestedRelationType; - existing.DegreeHint = suggestion.SuggestedDegreeHint; - existing.Note = suggestion.SuggestedNote; + Person1Id = suggestion.Person1Id, + Person2Id = suggestion.Person2Id, + AffiliationType = suggestion.SuggestedAffiliationType ?? PersonAffiliationType.Other, + Note = suggestion.SuggestedNote, + }); break; - } - case PersonRelationSuggestionAction.Remove: - { - var existing = await _context.GanjoorPersonRelations.Where(r => r.Id == suggestion.ExistingRelationId.Value).SingleOrDefaultAsync(); - if (existing != null) + case PersonRelationSuggestionAction.Modify: { - // any other still-pending suggestion targeting this same relation - // would otherwise dangle once it's gone - auto-reject those too - var conflicting = await _context.GanjoorPersonRelationEditSuggestions - .Where(s => !s.Reviewed && s.Id != suggestion.Id && s.ExistingRelationId == existing.Id) - .ToListAsync(); - foreach (var c in conflicting) + var existing = await _context.GanjoorPersonAffiliations.Where(a => a.Id == suggestion.ExistingAffiliationId.Value).SingleOrDefaultAsync(); + if (existing == null) { - c.Reviewed = true; - c.Result = CorrectionReviewResult.RejectedBecauseUnnecessaryChange; - c.ReviewNote = "این نسبت پیش‌تر حذف شد."; - c.ReviewDate = DateTime.Now; + return new RServiceResult(null, "وابستگی مورد نظر دیگر وجود ندارد."); } - _context.GanjoorPersonRelations.Remove(existing); + existing.AffiliationType = suggestion.SuggestedAffiliationType ?? existing.AffiliationType; + existing.Note = suggestion.SuggestedNote; + break; } + case PersonRelationSuggestionAction.Remove: + { + var existing = await _context.GanjoorPersonAffiliations.Where(a => a.Id == suggestion.ExistingAffiliationId.Value).SingleOrDefaultAsync(); + if (existing != null) + { + // any other still-pending suggestion targeting this same affiliation + // would otherwise dangle once it's gone - auto-reject those too + var conflicting = await _context.GanjoorPersonRelationEditSuggestions + .Where(s => !s.Reviewed && s.Id != suggestion.Id && s.ExistingAffiliationId == existing.Id) + .ToListAsync(); + foreach (var c in conflicting) + { + c.Reviewed = true; + c.Result = CorrectionReviewResult.RejectedBecauseUnnecessaryChange; + c.ReviewNote = "این وابستگی پیش‌تر حذف شد."; + c.ReviewDate = DateTime.Now; + } + _context.GanjoorPersonAffiliations.Remove(existing); + } + break; + } + } + } + else + { + switch (suggestion.Action) + { + case PersonRelationSuggestionAction.Add: + _context.GanjoorPersonRelations.Add(new GanjoorPersonRelation() + { + Person1Id = suggestion.Person1Id, + Person2Id = suggestion.Person2Id, + RelationType = suggestion.SuggestedRelationType, + DegreeHint = suggestion.SuggestedDegreeHint, + Note = suggestion.SuggestedNote, + }); break; - } + case PersonRelationSuggestionAction.Modify: + { + var existing = await _context.GanjoorPersonRelations.Where(r => r.Id == suggestion.ExistingRelationId.Value).SingleOrDefaultAsync(); + if (existing == null) + { + return new RServiceResult(null, "نسبت مورد نظر دیگر وجود ندارد."); + } + existing.RelationType = suggestion.SuggestedRelationType; + existing.DegreeHint = suggestion.SuggestedDegreeHint; + existing.Note = suggestion.SuggestedNote; + break; + } + case PersonRelationSuggestionAction.Remove: + { + var existing = await _context.GanjoorPersonRelations.Where(r => r.Id == suggestion.ExistingRelationId.Value).SingleOrDefaultAsync(); + if (existing != null) + { + // any other still-pending suggestion targeting this same relation + // would otherwise dangle once it's gone - auto-reject those too + var conflicting = await _context.GanjoorPersonRelationEditSuggestions + .Where(s => !s.Reviewed && s.Id != suggestion.Id && s.ExistingRelationId == existing.Id) + .ToListAsync(); + foreach (var c in conflicting) + { + c.Reviewed = true; + c.Result = CorrectionReviewResult.RejectedBecauseUnnecessaryChange; + c.ReviewNote = "این نسبت پیش‌تر حذف شد."; + c.ReviewDate = DateTime.Now; + } + _context.GanjoorPersonRelations.Remove(existing); + } + break; + } + } } } @@ -771,11 +858,12 @@ namespace RMuseum.Services.Implementation await _context.SaveChangesAsync(); + string edgeLabel = suggestion.Kind == PersonRelationSuggestionKind.Affiliation ? "وابستگی" : "نسبت خویشاوندی"; string actionLabel = suggestion.Action switch { - PersonRelationSuggestionAction.Add => "افزودن نسبت خویشاوندی", - PersonRelationSuggestionAction.Modify => "ویرایش نسبت خویشاوندی", - _ => "حذف نسبت خویشاوندی", + PersonRelationSuggestionAction.Add => $"افزودن {edgeLabel}", + PersonRelationSuggestionAction.Modify => $"ویرایش {edgeLabel}", + _ => $"حذف {edgeLabel}", }; if (result == CorrectionReviewResult.Approved)