Fixed endpoints for /users and /messages.

This commit is contained in:
2025-07-05 10:22:45 +02:00
parent 070ccd79fd
commit 468d029ed5
11 changed files with 303 additions and 8 deletions

View File

@ -0,0 +1,83 @@
// <auto-generated />
using System;
using MessengerBroker.Db.Sql;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MessengerBroker.Db.Sql.Migrations
{
[DbContext(typeof(BrokerSqlDbContext))]
[Migration("20250705074809_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("MessengerBroker.Db.Model.Message", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Messages");
});
modelBuilder.Entity("MessengerBroker.Db.Model.Sync", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.Property<long?>("Changes")
.HasColumnType("bigint");
b.Property<DateTime?>("FinishedUtc")
.HasColumnType("datetime2");
b.Property<DateTime>("StartedUtc")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Syncs");
});
modelBuilder.Entity("MessengerBroker.Db.Model.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MessengerBroker.Db.Sql.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BrokerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Syncs",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
BrokerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StartedUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
FinishedUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
Changes = table.Column<long>(type: "bigint", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Syncs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BrokerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Syncs");
migrationBuilder.DropTable(
name: "Users");
}
}
}

View File

@ -0,0 +1,80 @@
// <auto-generated />
using System;
using MessengerBroker.Db.Sql;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MessengerBroker.Db.Sql.Migrations
{
[DbContext(typeof(BrokerSqlDbContext))]
partial class BrokerSqlDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("MessengerBroker.Db.Model.Message", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Messages");
});
modelBuilder.Entity("MessengerBroker.Db.Model.Sync", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.Property<long?>("Changes")
.HasColumnType("bigint");
b.Property<DateTime?>("FinishedUtc")
.HasColumnType("datetime2");
b.Property<DateTime>("StartedUtc")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("Syncs");
});
modelBuilder.Entity("MessengerBroker.Db.Model.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BrokerId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}