< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 1046
Coverable lines: 1046
Total lines: 1169
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
File 1: Up(...)100%210%
File 1: SeedSystemTemplates(...)100%210%
File 1: Down(...)100%210%
File 2: BuildTargetModel(...)100%210%

File(s)

/home/runner/work/chronicis/chronicis/src/Chronicis.Api/Migrations/20251226052536_AddSummaryTemplatesAndConfiguration.cs

#LineLine coverage
 1using Microsoft.EntityFrameworkCore.Migrations;
 2
 3#nullable disable
 4
 5namespace Chronicis.Api.Migrations
 6{
 7    /// <inheritdoc />
 8    public partial class AddSummaryTemplatesAndConfiguration : Migration
 9    {
 10        /// <inheritdoc />
 11        protected override void Up(MigrationBuilder migrationBuilder)
 12        {
 013            migrationBuilder.AddColumn<string>(
 014                name: "AISummary",
 015                table: "Campaigns",
 016                type: "nvarchar(max)",
 017                nullable: true);
 18
 019            migrationBuilder.AddColumn<DateTime>(
 020                name: "AISummaryGeneratedAt",
 021                table: "Campaigns",
 022                type: "datetime2",
 023                nullable: true);
 24
 025            migrationBuilder.AddColumn<string>(
 026                name: "SummaryCustomPrompt",
 027                table: "Campaigns",
 028                type: "nvarchar(max)",
 029                nullable: true);
 30
 031            migrationBuilder.AddColumn<bool>(
 032                name: "SummaryIncludeWebSources",
 033                table: "Campaigns",
 034                type: "bit",
 035                nullable: false,
 036                defaultValue: false);
 37
 038            migrationBuilder.AddColumn<Guid>(
 039                name: "SummaryTemplateId",
 040                table: "Campaigns",
 041                type: "uniqueidentifier",
 042                nullable: true);
 43
 044            migrationBuilder.AddColumn<string>(
 045                name: "SummaryCustomPrompt",
 046                table: "Articles",
 047                type: "nvarchar(max)",
 048                nullable: true);
 49
 050            migrationBuilder.AddColumn<bool>(
 051                name: "SummaryIncludeWebSources",
 052                table: "Articles",
 053                type: "bit",
 054                nullable: false,
 055                defaultValue: false);
 56
 057            migrationBuilder.AddColumn<Guid>(
 058                name: "SummaryTemplateId",
 059                table: "Articles",
 060                type: "uniqueidentifier",
 061                nullable: true);
 62
 063            migrationBuilder.AddColumn<string>(
 064                name: "AISummary",
 065                table: "Arcs",
 066                type: "nvarchar(max)",
 067                nullable: true);
 68
 069            migrationBuilder.AddColumn<DateTime>(
 070                name: "AISummaryGeneratedAt",
 071                table: "Arcs",
 072                type: "datetime2",
 073                nullable: true);
 74
 075            migrationBuilder.AddColumn<string>(
 076                name: "SummaryCustomPrompt",
 077                table: "Arcs",
 078                type: "nvarchar(max)",
 079                nullable: true);
 80
 081            migrationBuilder.AddColumn<bool>(
 082                name: "SummaryIncludeWebSources",
 083                table: "Arcs",
 084                type: "bit",
 085                nullable: false,
 086                defaultValue: false);
 87
 088            migrationBuilder.AddColumn<Guid>(
 089                name: "SummaryTemplateId",
 090                table: "Arcs",
 091                type: "uniqueidentifier",
 092                nullable: true);
 93
 094            migrationBuilder.CreateTable(
 095                name: "SummaryTemplates",
 096                columns: table => new
 097                {
 098                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
 099                    WorldId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
 0100                    Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
 0101                    Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
 0102                    PromptTemplate = table.Column<string>(type: "nvarchar(max)", nullable: false),
 0103                    IsSystem = table.Column<bool>(type: "bit", nullable: false),
 0104                    CreatedBy = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
 0105                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
 0106                },
 0107                constraints: table =>
 0108                {
 0109                    table.PrimaryKey("PK_SummaryTemplates", x => x.Id);
 0110                    table.ForeignKey(
 0111                        name: "FK_SummaryTemplates_Users_CreatedBy",
 0112                        column: x => x.CreatedBy,
 0113                        principalTable: "Users",
 0114                        principalColumn: "Id",
 0115                        onDelete: ReferentialAction.Restrict);
 0116                    table.ForeignKey(
 0117                        name: "FK_SummaryTemplates_Worlds_WorldId",
 0118                        column: x => x.WorldId,
 0119                        principalTable: "Worlds",
 0120                        principalColumn: "Id",
 0121                        onDelete: ReferentialAction.Cascade);
 0122                });
 123
 0124            migrationBuilder.CreateIndex(
 0125                name: "IX_Campaigns_SummaryTemplateId",
 0126                table: "Campaigns",
 0127                column: "SummaryTemplateId");
 128
 0129            migrationBuilder.CreateIndex(
 0130                name: "IX_Articles_SummaryTemplateId",
 0131                table: "Articles",
 0132                column: "SummaryTemplateId");
 133
 0134            migrationBuilder.CreateIndex(
 0135                name: "IX_Arcs_SummaryTemplateId",
 0136                table: "Arcs",
 0137                column: "SummaryTemplateId");
 138
 0139            migrationBuilder.CreateIndex(
 0140                name: "IX_SummaryTemplates_CreatedBy",
 0141                table: "SummaryTemplates",
 0142                column: "CreatedBy");
 143
 0144            migrationBuilder.CreateIndex(
 0145                name: "IX_SummaryTemplates_IsSystem",
 0146                table: "SummaryTemplates",
 0147                column: "IsSystem");
 148
 0149            migrationBuilder.CreateIndex(
 0150                name: "IX_SummaryTemplates_WorldId",
 0151                table: "SummaryTemplates",
 0152                column: "WorldId");
 153
 0154            migrationBuilder.AddForeignKey(
 0155                name: "FK_Arcs_SummaryTemplates_SummaryTemplateId",
 0156                table: "Arcs",
 0157                column: "SummaryTemplateId",
 0158                principalTable: "SummaryTemplates",
 0159                principalColumn: "Id",
 0160                onDelete: ReferentialAction.SetNull);
 161
 0162            migrationBuilder.AddForeignKey(
 0163                name: "FK_Articles_SummaryTemplates_SummaryTemplateId",
 0164                table: "Articles",
 0165                column: "SummaryTemplateId",
 0166                principalTable: "SummaryTemplates",
 0167                principalColumn: "Id",
 0168                onDelete: ReferentialAction.SetNull);
 169
 0170            migrationBuilder.AddForeignKey(
 0171                name: "FK_Campaigns_SummaryTemplates_SummaryTemplateId",
 0172                table: "Campaigns",
 0173                column: "SummaryTemplateId",
 0174                principalTable: "SummaryTemplates",
 0175                principalColumn: "Id",
 0176                onDelete: ReferentialAction.SetNull);
 177
 178            // Seed system templates
 0179            SeedSystemTemplates(migrationBuilder);
 0180        }
 181
 182        private void SeedSystemTemplates(MigrationBuilder migrationBuilder)
 183        {
 0184            var defaultTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000001");
 0185            var characterTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000002");
 0186            var locationTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000003");
 0187            var bestiaryTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000004");
 0188            var factionTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000005");
 0189            var campaignRecapTemplateId = Guid.Parse("00000000-0000-0000-0000-000000000006");
 190
 191            // Default template
 0192            migrationBuilder.InsertData(
 0193                table: "SummaryTemplates",
 0194                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0195                values: new object[] {
 0196                    defaultTemplateId,
 0197                    null,
 0198                    "Default",
 0199                    "General purpose summary suitable for most content types.",
 0200                    @"You are analyzing tabletop RPG campaign notes to create a comprehensive summary about: {EntityName
 0201
 0202This entity is mentioned in the following campaign notes:
 0203
 0204{SourceContent}
 0205
 0206{WebContent}
 0207
 0208Based on all mentions above, provide a 2-4 paragraph summary including:
 02091. Who/what this entity is (identity, nature, role)
 02102. Key relationships with other entities
 02113. Important events involving this entity
 02124. Current status or last known information
 0213
 0214Focus on facts from the notes. If information conflicts between sources, note the discrepancy.
 0215Keep the tone informative and campaign-focused.",
 0216                    true,
 0217                    null,
 0218                    DateTime.UtcNow
 0219                });
 220
 221            // Character template
 0222            migrationBuilder.InsertData(
 0223                table: "SummaryTemplates",
 0224                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0225                values: new object[] {
 0226                    characterTemplateId,
 0227                    null,
 0228                    "Character",
 0229                    "Focused on personality, motivations, relationships, and character development.",
 0230                    @"You are analyzing tabletop RPG campaign notes to create a character profile for: {EntityName}
 0231
 0232This character is mentioned in the following campaign notes:
 0233
 0234{SourceContent}
 0235
 0236{WebContent}
 0237
 0238Create a character summary (2-4 paragraphs) covering:
 02391. **Identity & Appearance**: Who they are, what they look like, their role in the story
 02402. **Personality & Motivations**: What drives them, their quirks, how they interact with others
 02413. **Key Relationships**: Important connections to other characters (allies, enemies, family)
 02424. **Character Arc**: How they've changed or developed throughout the campaign
 02435. **Current Status**: Where they are now, what they're doing, any unresolved threads
 0244
 0245Write in a way that would help a player or DM quickly understand this character's significance to the campaign.",
 0246                    true,
 0247                    null,
 0248                    DateTime.UtcNow
 0249                });
 250
 251            // Location template
 0252            migrationBuilder.InsertData(
 0253                table: "SummaryTemplates",
 0254                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0255                values: new object[] {
 0256                    locationTemplateId,
 0257                    null,
 0258                    "Location",
 0259                    "Focused on geography, inhabitants, history, and significance to the story.",
 0260                    @"You are analyzing tabletop RPG campaign notes to create a location guide for: {EntityName}
 0261
 0262This location is mentioned in the following campaign notes:
 0263
 0264{SourceContent}
 0265
 0266{WebContent}
 0267
 0268Create a location summary (2-4 paragraphs) covering:
 02691. **Overview**: What kind of place this is, its general atmosphere and feel
 02702. **Geography & Layout**: Physical description, notable landmarks, surrounding areas
 02713. **Inhabitants**: Who lives or operates here, important NPCs associated with the location
 02724. **History & Significance**: Why this place matters to the campaign, key events that happened here
 02735. **Current State**: What's happening there now, any ongoing situations or dangers
 0274
 0275Write in a way that would help a DM set the scene or a player understand why this location matters.",
 0276                    true,
 0277                    null,
 0278                    DateTime.UtcNow
 0279                });
 280
 281            // Bestiary template
 0282            migrationBuilder.InsertData(
 0283                table: "SummaryTemplates",
 0284                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0285                values: new object[] {
 0286                    bestiaryTemplateId,
 0287                    null,
 0288                    "Bestiary",
 0289                    "Focused on creature nature, abilities, behavior, and encounters.",
 0290                    @"You are analyzing tabletop RPG campaign notes to create a bestiary entry for: {EntityName}
 0291
 0292This creature is mentioned in the following campaign notes:
 0293
 0294{SourceContent}
 0295
 0296{WebContent}
 0297
 0298Create a bestiary entry (2-4 paragraphs) covering:
 02991. **Nature & Description**: What kind of creature this is, its appearance and demeanor
 03002. **Abilities & Tactics**: Known powers, combat behavior, strengths and weaknesses
 03013. **Habitat & Behavior**: Where they're found, how they act, what they want
 03024. **Encounters**: Notable encounters the party has had with this creature type
 03035. **Lore & Secrets**: Any discovered information about their origins, society, or vulnerabilities
 0304
 0305Include any campaign-specific variations from standard lore. This should help players prepare for future encounters.",
 0306                    true,
 0307                    null,
 0308                    DateTime.UtcNow
 0309                });
 310
 311            // Faction template
 0312            migrationBuilder.InsertData(
 0313                table: "SummaryTemplates",
 0314                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0315                values: new object[] {
 0316                    factionTemplateId,
 0317                    null,
 0318                    "Faction",
 0319                    "Focused on members, goals, alliances, conflicts, and influence.",
 0320                    @"You are analyzing tabletop RPG campaign notes to create a faction profile for: {EntityName}
 0321
 0322This faction is mentioned in the following campaign notes:
 0323
 0324{SourceContent}
 0325
 0326{WebContent}
 0327
 0328Create a faction summary (2-4 paragraphs) covering:
 03291. **Overview**: What this faction is, their public face and reputation
 03302. **Leadership & Members**: Key figures, notable members the party has encountered
 03313. **Goals & Methods**: What they want, how they operate, their resources
 03324. **Alliances & Enemies**: Relationships with other factions, ongoing conflicts
 03335. **Party Relations**: How the party has interacted with this faction, current standing
 0334
 0335Highlight any secrets the party has discovered about the faction's true nature or hidden agendas.",
 0336                    true,
 0337                    null,
 0338                    DateTime.UtcNow
 0339                });
 340
 341            // Campaign Recap template
 0342            migrationBuilder.InsertData(
 0343                table: "SummaryTemplates",
 0344                columns: new[] { "Id", "WorldId", "Name", "Description", "PromptTemplate", "IsSystem", "CreatedBy", "Cre
 0345                values: new object[] {
 0346                    campaignRecapTemplateId,
 0347                    null,
 0348                    "Campaign Recap",
 0349                    "Summarizes story progression, major events, and plot threads for campaigns and arcs.",
 0350                    @"You are analyzing tabletop RPG session notes to create a campaign/arc recap for: {EntityName}
 0351
 0352Here are the session notes to summarize:
 0353
 0354{SourceContent}
 0355
 0356{WebContent}
 0357
 0358Create a narrative recap (3-5 paragraphs) covering:
 03591. **Story So Far**: The major plot developments and how the story has progressed
 03602. **Key Events**: The most significant moments, victories, and setbacks
 03613. **Character Moments**: Important character development, decisions, and roleplay highlights
 03624. **Active Plot Threads**: Unresolved mysteries, ongoing quests, looming threats
 03635. **Current Situation**: Where things stand now, what the party is facing next
 0364
 0365Write in an engaging narrative style that could be read aloud at the start of a session to remind players where they lef
 0366                    true,
 0367                    null,
 0368                    DateTime.UtcNow
 0369                });
 0370        }
 371
 372        /// <inheritdoc />
 373        protected override void Down(MigrationBuilder migrationBuilder)
 374        {
 0375            migrationBuilder.DropForeignKey(
 0376                name: "FK_Arcs_SummaryTemplates_SummaryTemplateId",
 0377                table: "Arcs");
 378
 0379            migrationBuilder.DropForeignKey(
 0380                name: "FK_Articles_SummaryTemplates_SummaryTemplateId",
 0381                table: "Articles");
 382
 0383            migrationBuilder.DropForeignKey(
 0384                name: "FK_Campaigns_SummaryTemplates_SummaryTemplateId",
 0385                table: "Campaigns");
 386
 0387            migrationBuilder.DropTable(
 0388                name: "SummaryTemplates");
 389
 0390            migrationBuilder.DropIndex(
 0391                name: "IX_Campaigns_SummaryTemplateId",
 0392                table: "Campaigns");
 393
 0394            migrationBuilder.DropIndex(
 0395                name: "IX_Articles_SummaryTemplateId",
 0396                table: "Articles");
 397
 0398            migrationBuilder.DropIndex(
 0399                name: "IX_Arcs_SummaryTemplateId",
 0400                table: "Arcs");
 401
 0402            migrationBuilder.DropColumn(
 0403                name: "AISummary",
 0404                table: "Campaigns");
 405
 0406            migrationBuilder.DropColumn(
 0407                name: "AISummaryGeneratedAt",
 0408                table: "Campaigns");
 409
 0410            migrationBuilder.DropColumn(
 0411                name: "SummaryCustomPrompt",
 0412                table: "Campaigns");
 413
 0414            migrationBuilder.DropColumn(
 0415                name: "SummaryIncludeWebSources",
 0416                table: "Campaigns");
 417
 0418            migrationBuilder.DropColumn(
 0419                name: "SummaryTemplateId",
 0420                table: "Campaigns");
 421
 0422            migrationBuilder.DropColumn(
 0423                name: "SummaryCustomPrompt",
 0424                table: "Articles");
 425
 0426            migrationBuilder.DropColumn(
 0427                name: "SummaryIncludeWebSources",
 0428                table: "Articles");
 429
 0430            migrationBuilder.DropColumn(
 0431                name: "SummaryTemplateId",
 0432                table: "Articles");
 433
 0434            migrationBuilder.DropColumn(
 0435                name: "AISummary",
 0436                table: "Arcs");
 437
 0438            migrationBuilder.DropColumn(
 0439                name: "AISummaryGeneratedAt",
 0440                table: "Arcs");
 441
 0442            migrationBuilder.DropColumn(
 0443                name: "SummaryCustomPrompt",
 0444                table: "Arcs");
 445
 0446            migrationBuilder.DropColumn(
 0447                name: "SummaryIncludeWebSources",
 0448                table: "Arcs");
 449
 0450            migrationBuilder.DropColumn(
 0451                name: "SummaryTemplateId",
 0452                table: "Arcs");
 0453        }
 454    }
 455}

/home/runner/work/chronicis/chronicis/src/Chronicis.Api/Migrations/20251226052536_AddSummaryTemplatesAndConfiguration.Designer.cs

#LineLine coverage
 1// <auto-generated />
 2using System;
 3using Chronicis.Api.Data;
 4using Microsoft.EntityFrameworkCore;
 5using Microsoft.EntityFrameworkCore.Infrastructure;
 6using Microsoft.EntityFrameworkCore.Metadata;
 7using Microsoft.EntityFrameworkCore.Migrations;
 8using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 9
 10#nullable disable
 11
 12namespace Chronicis.Api.Migrations
 13{
 14    [DbContext(typeof(ChronicisDbContext))]
 15    [Migration("20251226052536_AddSummaryTemplatesAndConfiguration")]
 16    partial class AddSummaryTemplatesAndConfiguration
 17    {
 18        /// <inheritdoc />
 19        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 20        {
 21#pragma warning disable 612, 618
 022            modelBuilder
 023                .HasAnnotation("ProductVersion", "9.0.0")
 024                .HasAnnotation("Relational:MaxIdentifierLength", 128);
 25
 026            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
 27
 028            modelBuilder.Entity("Chronicis.Shared.Models.Arc", b =>
 029                {
 030                    b.Property<Guid>("Id")
 031                        .ValueGeneratedOnAdd()
 032                        .HasColumnType("uniqueidentifier");
 033
 034                    b.Property<string>("AISummary")
 035                        .HasColumnType("nvarchar(max)");
 036
 037                    b.Property<DateTime?>("AISummaryGeneratedAt")
 038                        .HasColumnType("datetime2");
 039
 040                    b.Property<Guid>("CampaignId")
 041                        .HasColumnType("uniqueidentifier");
 042
 043                    b.Property<DateTime>("CreatedAt")
 044                        .HasColumnType("datetime2");
 045
 046                    b.Property<Guid>("CreatedBy")
 047                        .HasColumnType("uniqueidentifier");
 048
 049                    b.Property<string>("Description")
 050                        .HasMaxLength(1000)
 051                        .HasColumnType("nvarchar(1000)");
 052
 053                    b.Property<string>("Name")
 054                        .IsRequired()
 055                        .HasMaxLength(200)
 056                        .HasColumnType("nvarchar(200)");
 057
 058                    b.Property<int>("SortOrder")
 059                        .HasColumnType("int");
 060
 061                    b.Property<string>("SummaryCustomPrompt")
 062                        .HasColumnType("nvarchar(max)");
 063
 064                    b.Property<bool>("SummaryIncludeWebSources")
 065                        .HasColumnType("bit");
 066
 067                    b.Property<Guid?>("SummaryTemplateId")
 068                        .HasColumnType("uniqueidentifier");
 069
 070                    b.HasKey("Id");
 071
 072                    b.HasIndex("CampaignId");
 073
 074                    b.HasIndex("CreatedBy");
 075
 076                    b.HasIndex("SummaryTemplateId");
 077
 078                    b.HasIndex("CampaignId", "SortOrder");
 079
 080                    b.ToTable("Arcs");
 081                });
 82
 083            modelBuilder.Entity("Chronicis.Shared.Models.Article", b =>
 084                {
 085                    b.Property<Guid>("Id")
 086                        .ValueGeneratedOnAdd()
 087                        .HasColumnType("uniqueidentifier");
 088
 089                    b.Property<string>("AISummary")
 090                        .HasColumnType("nvarchar(max)");
 091
 092                    b.Property<DateTime?>("AISummaryGeneratedAt")
 093                        .HasColumnType("datetime2");
 094
 095                    b.Property<Guid?>("ArcId")
 096                        .HasColumnType("uniqueidentifier");
 097
 098                    b.Property<string>("Body")
 099                        .HasColumnType("nvarchar(max)");
 0100
 0101                    b.Property<Guid?>("CampaignId")
 0102                        .HasColumnType("uniqueidentifier");
 0103
 0104                    b.Property<DateTime>("CreatedAt")
 0105                        .HasColumnType("datetime2");
 0106
 0107                    b.Property<Guid>("CreatedBy")
 0108                        .HasColumnType("uniqueidentifier");
 0109
 0110                    b.Property<DateTime>("EffectiveDate")
 0111                        .HasColumnType("datetime2");
 0112
 0113                    b.Property<string>("IconEmoji")
 0114                        .HasMaxLength(50)
 0115                        .HasColumnType("nvarchar(50)");
 0116
 0117                    b.Property<string>("InGameDate")
 0118                        .HasMaxLength(100)
 0119                        .HasColumnType("nvarchar(100)");
 0120
 0121                    b.Property<Guid?>("LastModifiedBy")
 0122                        .HasColumnType("uniqueidentifier");
 0123
 0124                    b.Property<DateTime?>("ModifiedAt")
 0125                        .HasColumnType("datetime2");
 0126
 0127                    b.Property<Guid?>("ParentId")
 0128                        .HasColumnType("uniqueidentifier");
 0129
 0130                    b.Property<Guid?>("PlayerId")
 0131                        .HasColumnType("uniqueidentifier");
 0132
 0133                    b.Property<DateTime?>("SessionDate")
 0134                        .HasColumnType("datetime2");
 0135
 0136                    b.Property<string>("Slug")
 0137                        .IsRequired()
 0138                        .HasMaxLength(200)
 0139                        .HasColumnType("nvarchar(200)");
 0140
 0141                    b.Property<string>("SummaryCustomPrompt")
 0142                        .HasColumnType("nvarchar(max)");
 0143
 0144                    b.Property<bool>("SummaryIncludeWebSources")
 0145                        .HasColumnType("bit");
 0146
 0147                    b.Property<Guid?>("SummaryTemplateId")
 0148                        .HasColumnType("uniqueidentifier");
 0149
 0150                    b.Property<string>("Title")
 0151                        .IsRequired()
 0152                        .HasMaxLength(500)
 0153                        .HasColumnType("nvarchar(500)");
 0154
 0155                    b.Property<int>("Type")
 0156                        .HasColumnType("int");
 0157
 0158                    b.Property<int>("Visibility")
 0159                        .HasColumnType("int");
 0160
 0161                    b.Property<Guid?>("WorldId")
 0162                        .HasColumnType("uniqueidentifier");
 0163
 0164                    b.HasKey("Id");
 0165
 0166                    b.HasIndex("ArcId");
 0167
 0168                    b.HasIndex("CampaignId");
 0169
 0170                    b.HasIndex("CreatedBy");
 0171
 0172                    b.HasIndex("LastModifiedBy");
 0173
 0174                    b.HasIndex("ParentId");
 0175
 0176                    b.HasIndex("PlayerId");
 0177
 0178                    b.HasIndex("SummaryTemplateId");
 0179
 0180                    b.HasIndex("Title");
 0181
 0182                    b.HasIndex("Type");
 0183
 0184                    b.HasIndex("WorldId");
 0185
 0186                    b.HasIndex("ParentId", "Slug")
 0187                        .IsUnique()
 0188                        .HasDatabaseName("IX_Articles_ParentId_Slug")
 0189                        .HasFilter("[ParentId] IS NOT NULL");
 0190
 0191                    b.HasIndex("WorldId", "Slug")
 0192                        .IsUnique()
 0193                        .HasDatabaseName("IX_Articles_WorldId_Slug_Root")
 0194                        .HasFilter("[ParentId] IS NULL");
 0195
 0196                    b.ToTable("Articles");
 0197                });
 198
 0199            modelBuilder.Entity("Chronicis.Shared.Models.ArticleLink", b =>
 0200                {
 0201                    b.Property<Guid>("Id")
 0202                        .ValueGeneratedOnAdd()
 0203                        .HasColumnType("uniqueidentifier");
 0204
 0205                    b.Property<DateTime>("CreatedAt")
 0206                        .HasColumnType("datetime2");
 0207
 0208                    b.Property<string>("DisplayText")
 0209                        .HasMaxLength(500)
 0210                        .HasColumnType("nvarchar(500)");
 0211
 0212                    b.Property<int>("Position")
 0213                        .HasColumnType("int");
 0214
 0215                    b.Property<Guid>("SourceArticleId")
 0216                        .HasColumnType("uniqueidentifier");
 0217
 0218                    b.Property<Guid>("TargetArticleId")
 0219                        .HasColumnType("uniqueidentifier");
 0220
 0221                    b.HasKey("Id");
 0222
 0223                    b.HasIndex("SourceArticleId");
 0224
 0225                    b.HasIndex("TargetArticleId");
 0226
 0227                    b.HasIndex("SourceArticleId", "TargetArticleId", "Position")
 0228                        .IsUnique();
 0229
 0230                    b.ToTable("ArticleLinks");
 0231                });
 232
 0233            modelBuilder.Entity("Chronicis.Shared.Models.Campaign", b =>
 0234                {
 0235                    b.Property<Guid>("Id")
 0236                        .ValueGeneratedOnAdd()
 0237                        .HasColumnType("uniqueidentifier");
 0238
 0239                    b.Property<string>("AISummary")
 0240                        .HasColumnType("nvarchar(max)");
 0241
 0242                    b.Property<DateTime?>("AISummaryGeneratedAt")
 0243                        .HasColumnType("datetime2");
 0244
 0245                    b.Property<DateTime>("CreatedAt")
 0246                        .HasColumnType("datetime2");
 0247
 0248                    b.Property<string>("Description")
 0249                        .HasMaxLength(1000)
 0250                        .HasColumnType("nvarchar(1000)");
 0251
 0252                    b.Property<DateTime?>("EndedAt")
 0253                        .HasColumnType("datetime2");
 0254
 0255                    b.Property<string>("Name")
 0256                        .IsRequired()
 0257                        .HasMaxLength(200)
 0258                        .HasColumnType("nvarchar(200)");
 0259
 0260                    b.Property<Guid>("OwnerId")
 0261                        .HasColumnType("uniqueidentifier");
 0262
 0263                    b.Property<DateTime?>("StartedAt")
 0264                        .HasColumnType("datetime2");
 0265
 0266                    b.Property<string>("SummaryCustomPrompt")
 0267                        .HasColumnType("nvarchar(max)");
 0268
 0269                    b.Property<bool>("SummaryIncludeWebSources")
 0270                        .HasColumnType("bit");
 0271
 0272                    b.Property<Guid?>("SummaryTemplateId")
 0273                        .HasColumnType("uniqueidentifier");
 0274
 0275                    b.Property<Guid>("WorldId")
 0276                        .HasColumnType("uniqueidentifier");
 0277
 0278                    b.HasKey("Id");
 0279
 0280                    b.HasIndex("OwnerId");
 0281
 0282                    b.HasIndex("SummaryTemplateId");
 0283
 0284                    b.HasIndex("WorldId");
 0285
 0286                    b.ToTable("Campaigns");
 0287                });
 288
 0289            modelBuilder.Entity("Chronicis.Shared.Models.CampaignMember", b =>
 0290                {
 0291                    b.Property<Guid>("Id")
 0292                        .ValueGeneratedOnAdd()
 0293                        .HasColumnType("uniqueidentifier");
 0294
 0295                    b.Property<Guid>("CampaignId")
 0296                        .HasColumnType("uniqueidentifier");
 0297
 0298                    b.Property<string>("CharacterName")
 0299                        .HasMaxLength(100)
 0300                        .HasColumnType("nvarchar(100)");
 0301
 0302                    b.Property<DateTime>("JoinedAt")
 0303                        .HasColumnType("datetime2");
 0304
 0305                    b.Property<int>("Role")
 0306                        .HasColumnType("int");
 0307
 0308                    b.Property<Guid>("UserId")
 0309                        .HasColumnType("uniqueidentifier");
 0310
 0311                    b.HasKey("Id");
 0312
 0313                    b.HasIndex("UserId");
 0314
 0315                    b.HasIndex("CampaignId", "UserId")
 0316                        .IsUnique();
 0317
 0318                    b.ToTable("CampaignMembers");
 0319                });
 320
 0321            modelBuilder.Entity("Chronicis.Shared.Models.SummaryTemplate", b =>
 0322                {
 0323                    b.Property<Guid>("Id")
 0324                        .ValueGeneratedOnAdd()
 0325                        .HasColumnType("uniqueidentifier");
 0326
 0327                    b.Property<DateTime>("CreatedAt")
 0328                        .HasColumnType("datetime2");
 0329
 0330                    b.Property<Guid?>("CreatedBy")
 0331                        .HasColumnType("uniqueidentifier");
 0332
 0333                    b.Property<string>("Description")
 0334                        .HasMaxLength(500)
 0335                        .HasColumnType("nvarchar(500)");
 0336
 0337                    b.Property<bool>("IsSystem")
 0338                        .HasColumnType("bit");
 0339
 0340                    b.Property<string>("Name")
 0341                        .IsRequired()
 0342                        .HasMaxLength(200)
 0343                        .HasColumnType("nvarchar(200)");
 0344
 0345                    b.Property<string>("PromptTemplate")
 0346                        .IsRequired()
 0347                        .HasColumnType("nvarchar(max)");
 0348
 0349                    b.Property<Guid?>("WorldId")
 0350                        .HasColumnType("uniqueidentifier");
 0351
 0352                    b.HasKey("Id");
 0353
 0354                    b.HasIndex("CreatedBy");
 0355
 0356                    b.HasIndex("IsSystem");
 0357
 0358                    b.HasIndex("WorldId");
 0359
 0360                    b.ToTable("SummaryTemplates");
 0361                });
 362
 0363            modelBuilder.Entity("Chronicis.Shared.Models.User", b =>
 0364                {
 0365                    b.Property<Guid>("Id")
 0366                        .ValueGeneratedOnAdd()
 0367                        .HasColumnType("uniqueidentifier");
 0368
 0369                    b.Property<string>("Auth0UserId")
 0370                        .IsRequired()
 0371                        .HasMaxLength(256)
 0372                        .HasColumnType("nvarchar(256)");
 0373
 0374                    b.Property<string>("AvatarUrl")
 0375                        .HasMaxLength(500)
 0376                        .HasColumnType("nvarchar(500)");
 0377
 0378                    b.Property<DateTime>("CreatedAt")
 0379                        .HasColumnType("datetime2");
 0380
 0381                    b.Property<string>("DisplayName")
 0382                        .IsRequired()
 0383                        .HasMaxLength(100)
 0384                        .HasColumnType("nvarchar(100)");
 0385
 0386                    b.Property<string>("Email")
 0387                        .IsRequired()
 0388                        .HasMaxLength(256)
 0389                        .HasColumnType("nvarchar(256)");
 0390
 0391                    b.Property<DateTime>("LastLoginAt")
 0392                        .HasColumnType("datetime2");
 0393
 0394                    b.HasKey("Id");
 0395
 0396                    b.HasIndex("Auth0UserId")
 0397                        .IsUnique();
 0398
 0399                    b.HasIndex("Email");
 0400
 0401                    b.ToTable("Users");
 0402                });
 403
 0404            modelBuilder.Entity("Chronicis.Shared.Models.World", b =>
 0405                {
 0406                    b.Property<Guid>("Id")
 0407                        .ValueGeneratedOnAdd()
 0408                        .HasColumnType("uniqueidentifier");
 0409
 0410                    b.Property<DateTime>("CreatedAt")
 0411                        .HasColumnType("datetime2");
 0412
 0413                    b.Property<string>("Description")
 0414                        .HasMaxLength(1000)
 0415                        .HasColumnType("nvarchar(1000)");
 0416
 0417                    b.Property<string>("Name")
 0418                        .IsRequired()
 0419                        .HasMaxLength(200)
 0420                        .HasColumnType("nvarchar(200)");
 0421
 0422                    b.Property<Guid>("OwnerId")
 0423                        .HasColumnType("uniqueidentifier");
 0424
 0425                    b.Property<string>("Slug")
 0426                        .IsRequired()
 0427                        .HasMaxLength(200)
 0428                        .HasColumnType("nvarchar(200)");
 0429
 0430                    b.HasKey("Id");
 0431
 0432                    b.HasIndex("OwnerId");
 0433
 0434                    b.HasIndex("OwnerId", "Slug")
 0435                        .IsUnique()
 0436                        .HasDatabaseName("IX_Worlds_OwnerId_Slug");
 0437
 0438                    b.ToTable("Worlds");
 0439                });
 440
 0441            modelBuilder.Entity("Chronicis.Shared.Models.WorldLink", b =>
 0442                {
 0443                    b.Property<Guid>("Id")
 0444                        .ValueGeneratedOnAdd()
 0445                        .HasColumnType("uniqueidentifier");
 0446
 0447                    b.Property<DateTime>("CreatedAt")
 0448                        .HasColumnType("datetime2");
 0449
 0450                    b.Property<string>("Description")
 0451                        .HasMaxLength(500)
 0452                        .HasColumnType("nvarchar(500)");
 0453
 0454                    b.Property<string>("Title")
 0455                        .IsRequired()
 0456                        .HasMaxLength(200)
 0457                        .HasColumnType("nvarchar(200)");
 0458
 0459                    b.Property<string>("Url")
 0460                        .IsRequired()
 0461                        .HasMaxLength(2048)
 0462                        .HasColumnType("nvarchar(2048)");
 0463
 0464                    b.Property<Guid>("WorldId")
 0465                        .HasColumnType("uniqueidentifier");
 0466
 0467                    b.HasKey("Id");
 0468
 0469                    b.HasIndex("WorldId");
 0470
 0471                    b.ToTable("WorldLinks");
 0472                });
 473
 0474            modelBuilder.Entity("Chronicis.Shared.Models.Arc", b =>
 0475                {
 0476                    b.HasOne("Chronicis.Shared.Models.Campaign", "Campaign")
 0477                        .WithMany("Arcs")
 0478                        .HasForeignKey("CampaignId")
 0479                        .OnDelete(DeleteBehavior.Cascade)
 0480                        .IsRequired();
 0481
 0482                    b.HasOne("Chronicis.Shared.Models.User", "Creator")
 0483                        .WithMany("CreatedArcs")
 0484                        .HasForeignKey("CreatedBy")
 0485                        .OnDelete(DeleteBehavior.Restrict)
 0486                        .IsRequired();
 0487
 0488                    b.HasOne("Chronicis.Shared.Models.SummaryTemplate", "SummaryTemplate")
 0489                        .WithMany()
 0490                        .HasForeignKey("SummaryTemplateId")
 0491                        .OnDelete(DeleteBehavior.SetNull);
 0492
 0493                    b.Navigation("Campaign");
 0494
 0495                    b.Navigation("Creator");
 0496
 0497                    b.Navigation("SummaryTemplate");
 0498                });
 499
 0500            modelBuilder.Entity("Chronicis.Shared.Models.Article", b =>
 0501                {
 0502                    b.HasOne("Chronicis.Shared.Models.Arc", "Arc")
 0503                        .WithMany("Sessions")
 0504                        .HasForeignKey("ArcId")
 0505                        .OnDelete(DeleteBehavior.Restrict);
 0506
 0507                    b.HasOne("Chronicis.Shared.Models.Campaign", "Campaign")
 0508                        .WithMany("Articles")
 0509                        .HasForeignKey("CampaignId")
 0510                        .OnDelete(DeleteBehavior.Restrict);
 0511
 0512                    b.HasOne("Chronicis.Shared.Models.User", "Creator")
 0513                        .WithMany("CreatedArticles")
 0514                        .HasForeignKey("CreatedBy")
 0515                        .OnDelete(DeleteBehavior.Restrict)
 0516                        .IsRequired();
 0517
 0518                    b.HasOne("Chronicis.Shared.Models.User", "Modifier")
 0519                        .WithMany("ModifiedArticles")
 0520                        .HasForeignKey("LastModifiedBy")
 0521                        .OnDelete(DeleteBehavior.Restrict);
 0522
 0523                    b.HasOne("Chronicis.Shared.Models.Article", "Parent")
 0524                        .WithMany("Children")
 0525                        .HasForeignKey("ParentId")
 0526                        .OnDelete(DeleteBehavior.Restrict);
 0527
 0528                    b.HasOne("Chronicis.Shared.Models.User", "Player")
 0529                        .WithMany("OwnedCharacters")
 0530                        .HasForeignKey("PlayerId")
 0531                        .OnDelete(DeleteBehavior.Restrict);
 0532
 0533                    b.HasOne("Chronicis.Shared.Models.SummaryTemplate", "SummaryTemplate")
 0534                        .WithMany()
 0535                        .HasForeignKey("SummaryTemplateId")
 0536                        .OnDelete(DeleteBehavior.SetNull);
 0537
 0538                    b.HasOne("Chronicis.Shared.Models.World", "World")
 0539                        .WithMany("Articles")
 0540                        .HasForeignKey("WorldId")
 0541                        .OnDelete(DeleteBehavior.Restrict);
 0542
 0543                    b.Navigation("Arc");
 0544
 0545                    b.Navigation("Campaign");
 0546
 0547                    b.Navigation("Creator");
 0548
 0549                    b.Navigation("Modifier");
 0550
 0551                    b.Navigation("Parent");
 0552
 0553                    b.Navigation("Player");
 0554
 0555                    b.Navigation("SummaryTemplate");
 0556
 0557                    b.Navigation("World");
 0558                });
 559
 0560            modelBuilder.Entity("Chronicis.Shared.Models.ArticleLink", b =>
 0561                {
 0562                    b.HasOne("Chronicis.Shared.Models.Article", "SourceArticle")
 0563                        .WithMany("OutgoingLinks")
 0564                        .HasForeignKey("SourceArticleId")
 0565                        .OnDelete(DeleteBehavior.Cascade)
 0566                        .IsRequired();
 0567
 0568                    b.HasOne("Chronicis.Shared.Models.Article", "TargetArticle")
 0569                        .WithMany("IncomingLinks")
 0570                        .HasForeignKey("TargetArticleId")
 0571                        .OnDelete(DeleteBehavior.NoAction)
 0572                        .IsRequired();
 0573
 0574                    b.Navigation("SourceArticle");
 0575
 0576                    b.Navigation("TargetArticle");
 0577                });
 578
 0579            modelBuilder.Entity("Chronicis.Shared.Models.Campaign", b =>
 0580                {
 0581                    b.HasOne("Chronicis.Shared.Models.User", "Owner")
 0582                        .WithMany("OwnedCampaigns")
 0583                        .HasForeignKey("OwnerId")
 0584                        .OnDelete(DeleteBehavior.Restrict)
 0585                        .IsRequired();
 0586
 0587                    b.HasOne("Chronicis.Shared.Models.SummaryTemplate", "SummaryTemplate")
 0588                        .WithMany()
 0589                        .HasForeignKey("SummaryTemplateId")
 0590                        .OnDelete(DeleteBehavior.SetNull);
 0591
 0592                    b.HasOne("Chronicis.Shared.Models.World", "World")
 0593                        .WithMany("Campaigns")
 0594                        .HasForeignKey("WorldId")
 0595                        .OnDelete(DeleteBehavior.Restrict)
 0596                        .IsRequired();
 0597
 0598                    b.Navigation("Owner");
 0599
 0600                    b.Navigation("SummaryTemplate");
 0601
 0602                    b.Navigation("World");
 0603                });
 604
 0605            modelBuilder.Entity("Chronicis.Shared.Models.CampaignMember", b =>
 0606                {
 0607                    b.HasOne("Chronicis.Shared.Models.Campaign", "Campaign")
 0608                        .WithMany("Members")
 0609                        .HasForeignKey("CampaignId")
 0610                        .OnDelete(DeleteBehavior.Cascade)
 0611                        .IsRequired();
 0612
 0613                    b.HasOne("Chronicis.Shared.Models.User", "User")
 0614                        .WithMany("CampaignMemberships")
 0615                        .HasForeignKey("UserId")
 0616                        .OnDelete(DeleteBehavior.Cascade)
 0617                        .IsRequired();
 0618
 0619                    b.Navigation("Campaign");
 0620
 0621                    b.Navigation("User");
 0622                });
 623
 0624            modelBuilder.Entity("Chronicis.Shared.Models.SummaryTemplate", b =>
 0625                {
 0626                    b.HasOne("Chronicis.Shared.Models.User", "Creator")
 0627                        .WithMany()
 0628                        .HasForeignKey("CreatedBy")
 0629                        .OnDelete(DeleteBehavior.Restrict);
 0630
 0631                    b.HasOne("Chronicis.Shared.Models.World", "World")
 0632                        .WithMany()
 0633                        .HasForeignKey("WorldId")
 0634                        .OnDelete(DeleteBehavior.Cascade);
 0635
 0636                    b.Navigation("Creator");
 0637
 0638                    b.Navigation("World");
 0639                });
 640
 0641            modelBuilder.Entity("Chronicis.Shared.Models.World", b =>
 0642                {
 0643                    b.HasOne("Chronicis.Shared.Models.User", "Owner")
 0644                        .WithMany("OwnedWorlds")
 0645                        .HasForeignKey("OwnerId")
 0646                        .OnDelete(DeleteBehavior.Restrict)
 0647                        .IsRequired();
 0648
 0649                    b.Navigation("Owner");
 0650                });
 651
 0652            modelBuilder.Entity("Chronicis.Shared.Models.WorldLink", b =>
 0653                {
 0654                    b.HasOne("Chronicis.Shared.Models.World", "World")
 0655                        .WithMany("Links")
 0656                        .HasForeignKey("WorldId")
 0657                        .OnDelete(DeleteBehavior.Cascade)
 0658                        .IsRequired();
 0659
 0660                    b.Navigation("World");
 0661                });
 662
 0663            modelBuilder.Entity("Chronicis.Shared.Models.Arc", b =>
 0664                {
 0665                    b.Navigation("Sessions");
 0666                });
 667
 0668            modelBuilder.Entity("Chronicis.Shared.Models.Article", b =>
 0669                {
 0670                    b.Navigation("Children");
 0671
 0672                    b.Navigation("IncomingLinks");
 0673
 0674                    b.Navigation("OutgoingLinks");
 0675                });
 676
 0677            modelBuilder.Entity("Chronicis.Shared.Models.Campaign", b =>
 0678                {
 0679                    b.Navigation("Arcs");
 0680
 0681                    b.Navigation("Articles");
 0682
 0683                    b.Navigation("Members");
 0684                });
 685
 0686            modelBuilder.Entity("Chronicis.Shared.Models.User", b =>
 0687                {
 0688                    b.Navigation("CampaignMemberships");
 0689
 0690                    b.Navigation("CreatedArcs");
 0691
 0692                    b.Navigation("CreatedArticles");
 0693
 0694                    b.Navigation("ModifiedArticles");
 0695
 0696                    b.Navigation("OwnedCampaigns");
 0697
 0698                    b.Navigation("OwnedCharacters");
 0699
 0700                    b.Navigation("OwnedWorlds");
 0701                });
 702
 0703            modelBuilder.Entity("Chronicis.Shared.Models.World", b =>
 0704                {
 0705                    b.Navigation("Articles");
 0706
 0707                    b.Navigation("Campaigns");
 0708
 0709                    b.Navigation("Links");
 0710                });
 711#pragma warning restore 612, 618
 0712        }
 713    }
 714}