Files
Admin 0623875dfa Add Ping backend
.NET 10 solution for Ping, a Discord style chat app: Domain, Application
and Infrastructure projects plus the Api host. SignalR for chat and
presence, LiveKit for call tokens, EF Core on Postgres, S3 compatible
storage for attachments, and OIDC auth shared with the Musify Zitadel
instance. Includes the Compose stack for local development.
2026-09-21 19:32:55 +02:00

412 lines
14 KiB
C#

using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Ping.Infrastructure.Persistence;
#nullable disable
namespace Ping.Infrastructure.Persistence.Migrations
{
[DbContext(typeof(Database))]
partial class DatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Ping.Domain.Entities.Attachment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Bucket")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("ContentType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property<int>("Kind")
.HasColumnType("integer");
b.Property<Guid>("MessageId")
.HasColumnType("uuid");
b.Property<long>("SizeBytes")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("MessageId");
b.ToTable("Attachment");
});
modelBuilder.Entity("Ping.Domain.Entities.Channel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Name")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<int>("Position")
.HasColumnType("integer");
b.Property<Guid?>("ServerId")
.HasColumnType("uuid");
b.Property<string>("Topic")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property<int>("Type")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ServerId");
b.ToTable("Channel");
});
modelBuilder.Entity("Ping.Domain.Entities.ChannelMember", b =>
{
b.Property<Guid>("ChannelId")
.HasColumnType("uuid");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.HasKey("ChannelId", "UserId");
b.HasIndex("UserId");
b.ToTable("ChannelMembers");
});
modelBuilder.Entity("Ping.Domain.Entities.Friendship", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<long>("AddresseeId")
.HasColumnType("bigint");
b.Property<long?>("BlockedById")
.HasColumnType("bigint");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<long>("RequesterId")
.HasColumnType("bigint");
b.Property<DateTime?>("RespondedAt")
.HasColumnType("timestamp with time zone");
b.Property<int>("Status")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("AddresseeId");
b.HasIndex("RequesterId", "AddresseeId")
.IsUnique();
b.ToTable("Friendship");
});
modelBuilder.Entity("Ping.Domain.Entities.Message", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<long>("AuthorId")
.HasColumnType("bigint");
b.Property<Guid>("ChannelId")
.HasColumnType("uuid");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(4000)
.HasColumnType("character varying(4000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("EditedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("ReplyToMessageId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("ChannelId", "CreatedAt");
b.ToTable("Message");
});
modelBuilder.Entity("Ping.Domain.Entities.Server", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("IconUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<long>("OwnerId")
.HasColumnType("bigint");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.ToTable("Server");
});
modelBuilder.Entity("Ping.Domain.Entities.ServerMember", b =>
{
b.Property<Guid>("ServerId")
.HasColumnType("uuid");
b.Property<long>("UserId")
.HasColumnType("bigint");
b.Property<DateTime>("JoinedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Nickname")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<int>("Role")
.HasColumnType("integer");
b.HasKey("ServerId", "UserId");
b.HasIndex("UserId");
b.ToTable("ServerMember");
});
modelBuilder.Entity("Ping.Domain.Entities.User", b =>
{
b.Property<long>("Id")
.HasColumnType("bigint");
b.Property<string>("AvatarUrl")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("DisplayName")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<string>("NormalizedUsername")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.HasKey("Id");
b.ToTable("User");
});
modelBuilder.Entity("Ping.Domain.Entities.Attachment", b =>
{
b.HasOne("Ping.Domain.Entities.Message", "Message")
.WithMany("Attachments")
.HasForeignKey("MessageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Message");
});
modelBuilder.Entity("Ping.Domain.Entities.Channel", b =>
{
b.HasOne("Ping.Domain.Entities.Server", "ServerNavigation")
.WithMany("Channels")
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("ServerNavigation");
});
modelBuilder.Entity("Ping.Domain.Entities.ChannelMember", b =>
{
b.HasOne("Ping.Domain.Entities.Channel", "Channel")
.WithMany("Members")
.HasForeignKey("ChannelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Ping.Domain.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Channel");
b.Navigation("User");
});
modelBuilder.Entity("Ping.Domain.Entities.Friendship", b =>
{
b.HasOne("Ping.Domain.Entities.User", "Addressee")
.WithMany()
.HasForeignKey("AddresseeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Ping.Domain.Entities.User", "Requester")
.WithMany()
.HasForeignKey("RequesterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Addressee");
b.Navigation("Requester");
});
modelBuilder.Entity("Ping.Domain.Entities.Message", b =>
{
b.HasOne("Ping.Domain.Entities.User", "Author")
.WithMany()
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Ping.Domain.Entities.Channel", "Channel")
.WithMany()
.HasForeignKey("ChannelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Channel");
});
modelBuilder.Entity("Ping.Domain.Entities.Server", b =>
{
b.HasOne("Ping.Domain.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("Ping.Domain.Entities.ServerMember", b =>
{
b.HasOne("Ping.Domain.Entities.Server", "Server")
.WithMany("Members")
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Ping.Domain.Entities.User", "User")
.WithMany("ServerMemberships")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Server");
b.Navigation("User");
});
modelBuilder.Entity("Ping.Domain.Entities.Channel", b =>
{
b.Navigation("Members");
});
modelBuilder.Entity("Ping.Domain.Entities.Message", b =>
{
b.Navigation("Attachments");
});
modelBuilder.Entity("Ping.Domain.Entities.Server", b =>
{
b.Navigation("Channels");
b.Navigation("Members");
});
modelBuilder.Entity("Ping.Domain.Entities.User", b =>
{
b.Navigation("ServerMemberships");
});
#pragma warning restore 612, 618
}
}
}