Remove Casbin package references, configurations, and unused imports across multiple files. This change simplifies the codebase by eliminating unnecessary dependencies and reducing complexity. ✨ add new chat features and improve message handling Introduce new chat features including message notifications, nicknames, and improved message handling. Enhance the WebSocket service to support new packet handlers and improve message delivery. 🗃️ add new migrations for chat-related changes Add new migrations to support the latest chat features, including changes to chat members, messages, and reactions. These migrations ensure the database schema is up-to-date with the latest code changes.
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Text.Json.Serialization;
|
|
using DysonNetwork.Sphere.Chat;
|
|
using DysonNetwork.Sphere.Storage;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using NodaTime;
|
|
|
|
namespace DysonNetwork.Sphere.Realm;
|
|
|
|
[Index(nameof(Slug), IsUnique = true)]
|
|
public class Realm : ModelBase
|
|
{
|
|
public long Id { get; set; }
|
|
[MaxLength(1024)] public string Slug { get; set; } = string.Empty;
|
|
[MaxLength(1024)] public string Name { get; set; } = string.Empty;
|
|
[MaxLength(4096)] public string Description { get; set; } = string.Empty;
|
|
[MaxLength(4096)] public string? VerifiedAs { get; set; }
|
|
public Instant? VerifiedAt { get; set; }
|
|
public bool IsCommunity { get; set; }
|
|
public bool IsPublic { get; set; }
|
|
|
|
public CloudFile? Picture { get; set; }
|
|
public CloudFile? Background { get; set; }
|
|
|
|
[JsonIgnore] public ICollection<RealmMember> Members { get; set; } = new List<RealmMember>();
|
|
[JsonIgnore] public ICollection<ChatRoom> ChatRooms { get; set; } = new List<ChatRoom>();
|
|
|
|
public long AccountId { get; set; }
|
|
[JsonIgnore] public Account.Account Account { get; set; } = null!;
|
|
}
|
|
|
|
public enum RealmMemberRole
|
|
{
|
|
Owner = 100,
|
|
Moderator = 50,
|
|
Normal = 0
|
|
}
|
|
|
|
public class RealmMember : ModelBase
|
|
{
|
|
public long RealmId { get; set; }
|
|
[JsonIgnore] public Realm Realm { get; set; } = null!;
|
|
public long AccountId { get; set; }
|
|
[JsonIgnore] public Account.Account Account { get; set; } = null!;
|
|
|
|
public RealmMemberRole Role { get; set; } = RealmMemberRole.Normal;
|
|
public Instant? JoinedAt { get; set; }
|
|
} |