Add project files
This commit is contained in:
parent
4dafed3553
commit
8cf01ead74
40 changed files with 3967 additions and 0 deletions
83
StalwartSimpleLoginMiddleware/Migrations/20250510085312_Initial.Designer.cs
generated
Normal file
83
StalwartSimpleLoginMiddleware/Migrations/20250510085312_Initial.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using StalwartSimpleLoginMiddleware.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StalwartSimpleLoginMiddleware.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApiKeyContext))]
|
||||
[Migration("20250510085312_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.ApiKey", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(88)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("character varying(88)");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("OwnerEmail")
|
||||
.IsRequired()
|
||||
.HasMaxLength(254)
|
||||
.HasColumnType("character varying(254)");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("ApiKeys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.Member", b =>
|
||||
{
|
||||
b.Property<string>("ApiKeyId")
|
||||
.HasMaxLength(88)
|
||||
.HasColumnType("character varying(88)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(254)
|
||||
.HasColumnType("character varying(254)");
|
||||
|
||||
b.Property<bool>("IsExternal")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("ApiKeyId", "Email");
|
||||
|
||||
b.ToTable("Members");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.Member", b =>
|
||||
{
|
||||
b.HasOne("StalwartSimpleLoginMiddleware.Entities.ApiKey", "ApiKey")
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("ApiKeyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApiKey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.ApiKey", b =>
|
||||
{
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StalwartSimpleLoginMiddleware.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApiKeys",
|
||||
columns: table => new
|
||||
{
|
||||
Key = table.Column<string>(type: "character varying(88)", unicode: false, maxLength: 88, nullable: false),
|
||||
OwnerEmail = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
|
||||
IsAdmin = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApiKeys", x => x.Key);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Members",
|
||||
columns: table => new
|
||||
{
|
||||
ApiKeyId = table.Column<string>(type: "character varying(88)", maxLength: 88, nullable: false),
|
||||
Email = table.Column<string>(type: "character varying(254)", maxLength: 254, nullable: false),
|
||||
IsExternal = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Members", x => new { x.ApiKeyId, x.Email });
|
||||
table.ForeignKey(
|
||||
name: "FK_Members_ApiKeys_ApiKeyId",
|
||||
column: x => x.ApiKeyId,
|
||||
principalTable: "ApiKeys",
|
||||
principalColumn: "Key",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Members");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApiKeys");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
// <auto-generated />
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using StalwartSimpleLoginMiddleware.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StalwartSimpleLoginMiddleware.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApiKeyContext))]
|
||||
partial class ApiKeyContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.ApiKey", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(88)
|
||||
.IsUnicode(false)
|
||||
.HasColumnType("character varying(88)");
|
||||
|
||||
b.Property<bool>("IsAdmin")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("OwnerEmail")
|
||||
.IsRequired()
|
||||
.HasMaxLength(254)
|
||||
.HasColumnType("character varying(254)");
|
||||
|
||||
b.HasKey("Key");
|
||||
|
||||
b.ToTable("ApiKeys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.Member", b =>
|
||||
{
|
||||
b.Property<string>("ApiKeyId")
|
||||
.HasMaxLength(88)
|
||||
.HasColumnType("character varying(88)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(254)
|
||||
.HasColumnType("character varying(254)");
|
||||
|
||||
b.Property<bool>("IsExternal")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("ApiKeyId", "Email");
|
||||
|
||||
b.ToTable("Members");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.Member", b =>
|
||||
{
|
||||
b.HasOne("StalwartSimpleLoginMiddleware.Entities.ApiKey", "ApiKey")
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("ApiKeyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ApiKey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("StalwartSimpleLoginMiddleware.Entities.ApiKey", b =>
|
||||
{
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue