mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 12:12:32 +00:00
Regenerate spacebar db for admin api
This commit is contained in:
1 parent
f60ceae1a0
commit
4443b76dc7
11 files changed
+184
-52
No files matched your search
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Spacebar.Db.Models;
|
||||
using Stream = Spacebar.Db.Models.Stream;
|
||||
|
||||
namespace Spacebar.Db.Contexts;
|
||||
|
||||
@@ -15,6 +14,8 @@ public partial class SpacebarDbContext : DbContext
|
||||
|
||||
public virtual DbSet<Application> Applications { get; set; }
|
||||
|
||||
public virtual DbSet<ApplicationCommand> ApplicationCommands { get; set; }
|
||||
|
||||
public virtual DbSet<Attachment> Attachments { get; set; }
|
||||
|
||||
public virtual DbSet<AuditLog> AuditLogs { get; set; }
|
||||
@@ -47,6 +48,8 @@ public partial class SpacebarDbContext : DbContext
|
||||
|
||||
public virtual DbSet<Guild> Guilds { get; set; }
|
||||
|
||||
public virtual DbSet<InstanceBan> InstanceBans { get; set; }
|
||||
|
||||
public virtual DbSet<Invite> Invites { get; set; }
|
||||
|
||||
public virtual DbSet<Member> Members { get; set; }
|
||||
@@ -120,6 +123,16 @@ public partial class SpacebarDbContext : DbContext
|
||||
.HasConstraintName("FK_a36ed02953077f408d0f3ebc424");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ApplicationCommand>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_0f73c2f025989c407947e1f75fe");
|
||||
|
||||
entity.Property(e => e.DmPermission).HasDefaultValue(true);
|
||||
entity.Property(e => e.Options).HasDefaultValueSql("'[]'::text");
|
||||
entity.Property(e => e.Type).HasDefaultValue(1);
|
||||
entity.Property(e => e.Version).HasDefaultValueSql("'0'::character varying");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Attachment>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_5e1f050bcff31e3084a1d662412");
|
||||
@@ -266,6 +279,17 @@ public partial class SpacebarDbContext : DbContext
|
||||
entity.HasOne(d => d.WidgetChannel).WithMany(p => p.GuildWidgetChannels).HasConstraintName("FK_9d1d665379eefde7876a17afa99");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<InstanceBan>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_3aa6e80a6d325601054892b1340");
|
||||
|
||||
entity.Property(e => e.CreatedAt).HasDefaultValueSql("now()");
|
||||
|
||||
entity.HasOne(d => d.OriginInstanceBan).WithOne(p => p.InverseOriginInstanceBan)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("FK_0b02d18d0d830f160c921192a30");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Invite>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Code).HasName("PK_33fd8a248db1cd832baa8aa25bf");
|
||||
@@ -321,7 +345,6 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_18325f38ae6de43878487eff986");
|
||||
|
||||
entity.Property(e => e.Flags).HasDefaultValue(0);
|
||||
entity.Property(e => e.Timestamp).HasDefaultValueSql("now()");
|
||||
|
||||
entity.HasOne(d => d.Application).WithMany(p => p.Messages).HasConstraintName("FK_5d3ec1cb962de6488637fd779d6");
|
||||
@@ -342,7 +365,9 @@ public partial class SpacebarDbContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_b0525304f2262b7014245351c76");
|
||||
|
||||
entity.HasOne(d => d.MessageReferenceNavigation).WithMany(p => p.InverseMessageReferenceNavigation).HasConstraintName("FK_61a92bb65b302a76d9c1fcd3174");
|
||||
entity.HasOne(d => d.MessageReferenceNavigation).WithMany(p => p.InverseMessageReferenceNavigation)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("FK_61a92bb65b302a76d9c1fcd3174");
|
||||
|
||||
entity.HasOne(d => d.Webhook).WithMany(p => p.Messages).HasConstraintName("FK_f83c04bcf1df4e5c0e7a52ed348");
|
||||
|
||||
@@ -475,8 +500,6 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_de8fc5a9c364568f294798fe1e9");
|
||||
|
||||
entity.Property(e => e.Closed).HasDefaultValue(false);
|
||||
|
||||
entity.HasOne(d => d.Channel).WithMany(p => p.Recipients).HasConstraintName("FK_2f18ee1ba667f233ae86c0ea60e");
|
||||
|
||||
entity.HasOne(d => d.User).WithMany(p => p.Recipients).HasConstraintName("FK_6157e8b6ba4e6e3089616481fe2");
|
||||
@@ -495,8 +518,6 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_c1433d71a4838793a49dcad46ab");
|
||||
|
||||
entity.Property(e => e.Flags).HasDefaultValue(0);
|
||||
|
||||
entity.HasOne(d => d.Guild).WithMany(p => p.Roles).HasConstraintName("FK_c32c1ab1c4dc7dcb0278c4b1b8b");
|
||||
});
|
||||
|
||||
@@ -518,6 +539,8 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_3238ef96f18b355b671619111bc");
|
||||
|
||||
entity.Property(e => e.Activities).HasDefaultValueSql("'[]'::text");
|
||||
|
||||
entity.HasOne(d => d.User).WithMany(p => p.Sessions)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_085d540d9f418cfbdc7bd55bb19");
|
||||
@@ -560,8 +583,6 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_49bdc3f66394c12478f8371c546");
|
||||
|
||||
entity.Property(e => e.Used).HasDefaultValue(false);
|
||||
|
||||
entity.HasOne(d => d.Stream).WithMany(p => p.StreamSessions).HasConstraintName("FK_8b5a028a34dae9ee54af37c9c32");
|
||||
|
||||
entity.HasOne(d => d.User).WithMany(p => p.StreamSessions).HasConstraintName("FK_13ae5c29aff4d0890c54179511a");
|
||||
@@ -602,8 +623,6 @@ public partial class SpacebarDbContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_a3ffb1c0c8416b9fc6f907b7433");
|
||||
|
||||
entity.Property(e => e.WebauthnEnabled).HasDefaultValue(false);
|
||||
|
||||
entity.HasOne(d => d.SettingsIndexNavigation).WithOne(p => p.User).HasConstraintName("FK_0c14beb78d8c5ccba66072adbc7");
|
||||
});
|
||||
|
||||
|
||||
@@ -86,12 +86,6 @@ public partial class Application
|
||||
[Column("privacy_policy_url", TypeName = "character varying")]
|
||||
public string? PrivacyPolicyUrl { get; set; }
|
||||
|
||||
[Column("guild_id", TypeName = "character varying")]
|
||||
public string? GuildId { get; set; }
|
||||
|
||||
[Column("custom_install_url", TypeName = "character varying")]
|
||||
public string? CustomInstallUrl { get; set; }
|
||||
|
||||
[Column("owner_id", TypeName = "character varying")]
|
||||
public string? OwnerId { get; set; }
|
||||
|
||||
@@ -101,6 +95,12 @@ public partial class Application
|
||||
[Column("team_id", TypeName = "character varying")]
|
||||
public string? TeamId { get; set; }
|
||||
|
||||
[Column("guild_id", TypeName = "character varying")]
|
||||
public string? GuildId { get; set; }
|
||||
|
||||
[Column("custom_install_url", TypeName = "character varying")]
|
||||
public string? CustomInstallUrl { get; set; }
|
||||
|
||||
[ForeignKey("BotUserId")]
|
||||
[InverseProperty("ApplicationBotUser")]
|
||||
public virtual User? BotUser { get; set; }
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Spacebar.Db.Models;
|
||||
|
||||
[Table("application_commands")]
|
||||
public partial class ApplicationCommand
|
||||
{
|
||||
[Key]
|
||||
[Column("id", TypeName = "character varying")]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
[Column("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
[Column("application_id", TypeName = "character varying")]
|
||||
public string ApplicationId { get; set; } = null!;
|
||||
|
||||
[Column("guild_id", TypeName = "character varying")]
|
||||
public string? GuildId { get; set; }
|
||||
|
||||
[Column("name", TypeName = "character varying")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Column("name_localizations")]
|
||||
public string? NameLocalizations { get; set; }
|
||||
|
||||
[Column("description", TypeName = "character varying")]
|
||||
public string Description { get; set; } = null!;
|
||||
|
||||
[Column("description_localizations")]
|
||||
public string? DescriptionLocalizations { get; set; }
|
||||
|
||||
[Column("options")]
|
||||
public string Options { get; set; } = null!;
|
||||
|
||||
[Column("default_member_permissions", TypeName = "character varying")]
|
||||
public string? DefaultMemberPermissions { get; set; }
|
||||
|
||||
[Column("dm_permission")]
|
||||
public bool DmPermission { get; set; }
|
||||
|
||||
[Column("permissions")]
|
||||
public string? Permissions { get; set; }
|
||||
|
||||
[Column("nsfw")]
|
||||
public bool Nsfw { get; set; }
|
||||
|
||||
[Column("integration_types")]
|
||||
public string? IntegrationTypes { get; set; }
|
||||
|
||||
[Column("global_popularity_rank")]
|
||||
public int GlobalPopularityRank { get; set; }
|
||||
|
||||
[Column("contexts")]
|
||||
public string? Contexts { get; set; }
|
||||
|
||||
[Column("version", TypeName = "character varying")]
|
||||
public string Version { get; set; } = null!;
|
||||
|
||||
[Column("handler")]
|
||||
public int Handler { get; set; }
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public partial class Ban
|
||||
public string? ExecutorId { get; set; }
|
||||
|
||||
[Column("ip", TypeName = "character varying")]
|
||||
public string Ip { get; set; } = null!;
|
||||
public string? Ip { get; set; }
|
||||
|
||||
[Column("reason", TypeName = "character varying")]
|
||||
public string? Reason { get; set; }
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Spacebar.Db.Models;
|
||||
|
||||
[Table("instance_bans")]
|
||||
[Index("OriginInstanceBanId", Name = "REL_0b02d18d0d830f160c921192a3", IsUnique = true)]
|
||||
public partial class InstanceBan
|
||||
{
|
||||
[Key]
|
||||
[Column("id", TypeName = "character varying")]
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
[Column("created_at", TypeName = "timestamp without time zone")]
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
[Column("reason", TypeName = "character varying")]
|
||||
public string Reason { get; set; } = null!;
|
||||
|
||||
[Column("user_id", TypeName = "character varying")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
[Column("fingerprint", TypeName = "character varying")]
|
||||
public string? Fingerprint { get; set; }
|
||||
|
||||
[Column("ip_address", TypeName = "character varying")]
|
||||
public string? IpAddress { get; set; }
|
||||
|
||||
[Column("is_from_other_instance_ban")]
|
||||
public bool IsFromOtherInstanceBan { get; set; }
|
||||
|
||||
[Column("origin_instance_ban_id", TypeName = "character varying")]
|
||||
public string? OriginInstanceBanId { get; set; }
|
||||
|
||||
[Column("is_allowlisted")]
|
||||
public bool IsAllowlisted { get; set; }
|
||||
|
||||
[InverseProperty("OriginInstanceBan")]
|
||||
public virtual InstanceBan? InverseOriginInstanceBan { get; set; }
|
||||
|
||||
[ForeignKey("OriginInstanceBanId")]
|
||||
[InverseProperty("InverseOriginInstanceBan")]
|
||||
public virtual InstanceBan? OriginInstanceBan { get; set; }
|
||||
}
|
||||
@@ -58,18 +58,12 @@ public partial class Message
|
||||
[Column("nonce")]
|
||||
public string? Nonce { get; set; }
|
||||
|
||||
[Column("pinned_at", TypeName = "timestamp without time zone")]
|
||||
public DateTime? PinnedAt { get; set; }
|
||||
|
||||
[Column("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
[Column("activity")]
|
||||
public string? Activity { get; set; }
|
||||
|
||||
[Column("flags")]
|
||||
public int Flags { get; set; }
|
||||
|
||||
[Column("message_reference")]
|
||||
public string? MessageReference { get; set; }
|
||||
|
||||
@@ -79,6 +73,12 @@ public partial class Message
|
||||
[Column("components")]
|
||||
public string? Components { get; set; }
|
||||
|
||||
[Column("message_reference_id", TypeName = "character varying")]
|
||||
public string? MessageReferenceId { get; set; }
|
||||
|
||||
[Column("flags")]
|
||||
public int Flags { get; set; }
|
||||
|
||||
[Column("poll")]
|
||||
public string? Poll { get; set; }
|
||||
|
||||
@@ -88,8 +88,11 @@ public partial class Message
|
||||
[Column("avatar", TypeName = "character varying")]
|
||||
public string? Avatar { get; set; }
|
||||
|
||||
[Column("message_reference_id", TypeName = "character varying")]
|
||||
public string? MessageReferenceId { get; set; }
|
||||
[Column("pinned_at", TypeName = "timestamp without time zone")]
|
||||
public DateTime? PinnedAt { get; set; }
|
||||
|
||||
[Column("interaction_metadata")]
|
||||
public string? InteractionMetadata { get; set; }
|
||||
|
||||
[ForeignKey("ApplicationId")]
|
||||
[InverseProperty("Messages")]
|
||||
|
||||
@@ -20,17 +20,17 @@ public partial class Session
|
||||
public string SessionId { get; set; } = null!;
|
||||
|
||||
[Column("activities")]
|
||||
public string? Activities { get; set; }
|
||||
public string Activities { get; set; } = null!;
|
||||
|
||||
[Column("client_info")]
|
||||
public string ClientInfo { get; set; } = null!;
|
||||
|
||||
[Column("client_status")]
|
||||
public string ClientStatus { get; set; } = null!;
|
||||
|
||||
[Column("status", TypeName = "character varying")]
|
||||
public string Status { get; set; } = null!;
|
||||
|
||||
[Column("client_status")]
|
||||
public string ClientStatus { get; set; } = null!;
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
[InverseProperty("Sessions")]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
@@ -19,15 +19,15 @@ public partial class TeamMember
|
||||
[Column("permissions")]
|
||||
public string Permissions { get; set; } = null!;
|
||||
|
||||
[Column("role", TypeName = "character varying")]
|
||||
public string Role { get; set; } = null!;
|
||||
|
||||
[Column("team_id", TypeName = "character varying")]
|
||||
public string? TeamId { get; set; }
|
||||
|
||||
[Column("user_id", TypeName = "character varying")]
|
||||
public string? UserId { get; set; }
|
||||
|
||||
[Column("role", TypeName = "character varying")]
|
||||
public string Role { get; set; } = null!;
|
||||
|
||||
[ForeignKey("TeamId")]
|
||||
[InverseProperty("TeamMembers")]
|
||||
public virtual Team? Team { get; set; }
|
||||
|
||||
@@ -65,9 +65,6 @@ public partial class User
|
||||
[Column("mfa_enabled")]
|
||||
public bool MfaEnabled { get; set; }
|
||||
|
||||
[Column("webauthn_enabled")]
|
||||
public bool WebauthnEnabled { get; set; }
|
||||
|
||||
[Column("totp_secret", TypeName = "character varying")]
|
||||
public string? TotpSecret { get; set; }
|
||||
|
||||
@@ -92,20 +89,20 @@ public partial class User
|
||||
[Column("email", TypeName = "character varying")]
|
||||
public string? Email { get; set; }
|
||||
|
||||
[Column("flags", TypeName = "character varying")]
|
||||
public string Flags { get; set; }
|
||||
[Column("flags")]
|
||||
public long Flags { get; set; }
|
||||
|
||||
[Column("public_flags")]
|
||||
public ulong PublicFlags { get; set; }
|
||||
public long PublicFlags { get; set; }
|
||||
|
||||
[Column("purchased_flags")]
|
||||
public int PurchasedFlags { get; set; }
|
||||
public long PurchasedFlags { get; set; }
|
||||
|
||||
[Column("premium_usage_flags")]
|
||||
public int PremiumUsageFlags { get; set; }
|
||||
|
||||
[Column("rights")]
|
||||
public ulong Rights { get; set; }
|
||||
public long Rights { get; set; }
|
||||
|
||||
[Column("data")]
|
||||
public string Data { get; set; } = null!;
|
||||
@@ -116,12 +113,15 @@ public partial class User
|
||||
[Column("extended_settings")]
|
||||
public string ExtendedSettings { get; set; } = null!;
|
||||
|
||||
[Column("badge_ids")]
|
||||
public string? BadgeIds { get; set; }
|
||||
|
||||
[Column("settingsIndex")]
|
||||
public int? SettingsIndex { get; set; }
|
||||
|
||||
[Column("webauthn_enabled")]
|
||||
public bool WebauthnEnabled { get; set; }
|
||||
|
||||
[Column("badge_ids")]
|
||||
public string? BadgeIds { get; set; }
|
||||
|
||||
[InverseProperty("BotUser")]
|
||||
public virtual Application? ApplicationBotUser { get; set; }
|
||||
|
||||
|
||||
@@ -52,9 +52,6 @@ public partial class UserSetting
|
||||
[Column("explicit_content_filter")]
|
||||
public int? ExplicitContentFilter { get; set; }
|
||||
|
||||
[Column("friend_discovery_flags")]
|
||||
public int? FriendDiscoveryFlags { get; set; }
|
||||
|
||||
[Column("friend_source_flags")]
|
||||
public string? FriendSourceFlags { get; set; }
|
||||
|
||||
@@ -109,6 +106,9 @@ public partial class UserSetting
|
||||
[Column("timezone_offset")]
|
||||
public int? TimezoneOffset { get; set; }
|
||||
|
||||
[Column("friend_discovery_flags")]
|
||||
public int? FriendDiscoveryFlags { get; set; }
|
||||
|
||||
[Column("view_nsfw_guilds")]
|
||||
public bool? ViewNsfwGuilds { get; set; }
|
||||
|
||||
|
||||
@@ -7,11 +7,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="*" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in new issue
Block a user