Chat realtime calls

This commit is contained in:
2025-05-07 00:47:57 +08:00
parent 02aee07116
commit fb07071603
13 changed files with 2839 additions and 22 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
/// <inheritdoc />
public partial class AddChatRealtimeCall : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "content",
table: "chat_messages",
type: "character varying(4096)",
maxLength: 4096,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(4096)",
oldMaxLength: 4096);
migrationBuilder.AddColumn<string>(
name: "type",
table: "chat_messages",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "chat_realtime_call",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
title = table.Column<string>(type: "text", nullable: true),
ended_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
sender_id = table.Column<Guid>(type: "uuid", nullable: false),
room_id = table.Column<long>(type: "bigint", nullable: false),
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_chat_realtime_call", x => x.id);
table.ForeignKey(
name: "fk_chat_realtime_call_chat_members_sender_id",
column: x => x.sender_id,
principalTable: "chat_members",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_chat_realtime_call_chat_rooms_room_id",
column: x => x.room_id,
principalTable: "chat_rooms",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_room_id",
table: "chat_realtime_call",
column: "room_id");
migrationBuilder.CreateIndex(
name: "ix_chat_realtime_call_sender_id",
table: "chat_realtime_call",
column: "sender_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "chat_realtime_call");
migrationBuilder.DropColumn(
name: "type",
table: "chat_messages");
migrationBuilder.AlterColumn<string>(
name: "content",
table: "chat_messages",
type: "character varying(4096)",
maxLength: 4096,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(4096)",
oldMaxLength: 4096,
oldNullable: true);
}
}
}

View File

@ -785,7 +785,6 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnName("chat_room_id");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)")
.HasColumnName("content");
@ -828,6 +827,11 @@ namespace DysonNetwork.Sphere.Migrations
.HasColumnType("uuid")
.HasColumnName("sender_id");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("text")
.HasColumnName("type");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
@ -934,6 +938,53 @@ namespace DysonNetwork.Sphere.Migrations
b.ToTable("chat_statuses", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid")
.HasColumnName("id");
b.Property<Instant>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<Instant?>("DeletedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("deleted_at");
b.Property<Instant?>("EndedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("ended_at");
b.Property<long>("RoomId")
.HasColumnType("bigint")
.HasColumnName("room_id");
b.Property<Guid>("SenderId")
.HasColumnType("uuid")
.HasColumnName("sender_id");
b.Property<string>("Title")
.HasColumnType("text")
.HasColumnName("title");
b.Property<Instant>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("updated_at");
b.HasKey("Id")
.HasName("pk_chat_realtime_call");
b.HasIndex("RoomId")
.HasDatabaseName("ix_chat_realtime_call_room_id");
b.HasIndex("SenderId")
.HasDatabaseName("ix_chat_realtime_call_sender_id");
b.ToTable("chat_realtime_call", (string)null);
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroup", b =>
{
b.Property<Guid>("Id")
@ -2038,6 +2089,27 @@ namespace DysonNetwork.Sphere.Migrations
b.Navigation("Sender");
});
modelBuilder.Entity("DysonNetwork.Sphere.Chat.RealtimeCall", b =>
{
b.HasOne("DysonNetwork.Sphere.Chat.ChatRoom", "Room")
.WithMany()
.HasForeignKey("RoomId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id");
b.HasOne("DysonNetwork.Sphere.Chat.ChatMember", "Sender")
.WithMany()
.HasForeignKey("SenderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_chat_realtime_call_chat_members_sender_id");
b.Navigation("Room");
b.Navigation("Sender");
});
modelBuilder.Entity("DysonNetwork.Sphere.Permission.PermissionGroupMember", b =>
{
b.HasOne("DysonNetwork.Sphere.Permission.PermissionGroup", "Group")