Split creators out of identity
This commit is contained in:
@@ -49,8 +49,8 @@ public class AddMessage(
|
||||
CreatedByName = User.GetAlias() ?? $"{User.GetFirstName()} {User.GetLastName()}",
|
||||
CreatedByPortraitUrl = User.GetPortraitUrl(),
|
||||
Value = req.Message
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
await context.Messages.AddAsync(message, ct);
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Messages.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Messages.Migrations
|
||||
{
|
||||
[DbContext(typeof(MessagingDbContext))]
|
||||
[Migration("20240721041322_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Messaging")
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Messages.Data.Message", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CreatedByName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CreatedByPortraitUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("ParentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SubjectId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Messages", "Messaging");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Messages.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangedAuthorDefinition : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CreatedByPortraitUrl",
|
||||
schema: "Messaging",
|
||||
table: "Messages",
|
||||
type: "character varying(256)",
|
||||
maxLength: 256,
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CreatedByName",
|
||||
schema: "Messaging",
|
||||
table: "Messages",
|
||||
type: "character varying(64)",
|
||||
maxLength: 64,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CreatedByPortraitUrl",
|
||||
schema: "Messaging",
|
||||
table: "Messages",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(256)",
|
||||
oldMaxLength: 256,
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "CreatedByName",
|
||||
schema: "Messaging",
|
||||
table: "Messages",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(64)",
|
||||
oldMaxLength: 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Hutopy.Web.Features.Messages.Migrations
|
||||
{
|
||||
[DbContext(typeof(MessagingDbContext))]
|
||||
[Migration("20240721064224_ChangedAuthorDefinition")]
|
||||
partial class ChangedAuthorDefinition
|
||||
[Migration("20240802044717_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -22,8 +22,8 @@ namespace Hutopy.Web.Features.Messages.Migrations
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
SubjectId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedByName = table.Column<string>(type: "text", nullable: false),
|
||||
CreatedByPortraitUrl = table.Column<string>(type: "text", nullable: true),
|
||||
CreatedByName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
|
||||
CreatedByPortraitUrl = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
|
||||
ParentId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
Value = table.Column<string>(type: "text", nullable: false)
|
||||
Reference in New Issue
Block a user