chat: add database types and auth middleware
This commit is contained in:
parent
656eec81d8
commit
6f6e19bbb5
24 changed files with 1165 additions and 15 deletions
9
Foxchat.Chat/Database/Models/Channel.cs
Normal file
9
Foxchat.Chat/Database/Models/Channel.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace Foxchat.Chat.Database.Models;
|
||||
|
||||
public class Channel : BaseModel
|
||||
{
|
||||
public Ulid GuildId { get; init; }
|
||||
public Guild Guild { get; init; } = null!;
|
||||
public string Name { get; set; } = null!;
|
||||
public string? Topic { get; set; }
|
||||
}
|
11
Foxchat.Chat/Database/Models/Guild.cs
Normal file
11
Foxchat.Chat/Database/Models/Guild.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace Foxchat.Chat.Database.Models;
|
||||
|
||||
public class Guild : BaseModel
|
||||
{
|
||||
public string Name { get; set; } = null!;
|
||||
public Ulid OwnerId { get; set; }
|
||||
public User Owner { get; set; } = null!;
|
||||
|
||||
public List<User> Users { get; } = [];
|
||||
public List<Channel> Channels { get; } = [];
|
||||
}
|
17
Foxchat.Chat/Database/Models/IdentityInstance.cs
Normal file
17
Foxchat.Chat/Database/Models/IdentityInstance.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
namespace Foxchat.Chat.Database.Models;
|
||||
|
||||
public class IdentityInstance : BaseModel
|
||||
{
|
||||
public string Domain { get; init; } = null!;
|
||||
public string BaseUrl { get; init; } = null!;
|
||||
public string PublicKey { get; init; } = null!;
|
||||
|
||||
public InstanceStatus Status { get; set; } = InstanceStatus.Active;
|
||||
public string? Reason { get; set; }
|
||||
|
||||
public enum InstanceStatus
|
||||
{
|
||||
Active,
|
||||
Suspended,
|
||||
}
|
||||
}
|
15
Foxchat.Chat/Database/Models/Message.cs
Normal file
15
Foxchat.Chat/Database/Models/Message.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using NodaTime;
|
||||
|
||||
namespace Foxchat.Chat.Database.Models;
|
||||
|
||||
public class Message : BaseModel
|
||||
{
|
||||
public Ulid ChannelId { get; init; }
|
||||
public Channel Channel { get; init; } = null!;
|
||||
public Ulid AuthorId { get; init; }
|
||||
public User Author { get; init; } = null!;
|
||||
|
||||
public string? Content { get; set; }
|
||||
|
||||
public Instant? UpdatedAt { get; set; }
|
||||
}
|
14
Foxchat.Chat/Database/Models/User.cs
Normal file
14
Foxchat.Chat/Database/Models/User.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
namespace Foxchat.Chat.Database.Models;
|
||||
|
||||
public class User : BaseModel
|
||||
{
|
||||
public Ulid InstanceId { get; init; }
|
||||
public IdentityInstance Instance { get; init; } = null!;
|
||||
public string RemoteUserId { get; init; } = null!;
|
||||
public string Username { get; init; } = null!;
|
||||
|
||||
public string? Avatar { get; set; }
|
||||
|
||||
public List<Guild> Guilds { get; } = [];
|
||||
public List<Guild> OwnedGuilds { get; } = [];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue