Fix admin api build
This commit is contained in:
parent
7777595125
commit
c07c764208
@ -1,16 +1,8 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ArcaneLibs;
|
using ArcaneLibs;
|
||||||
using ArcaneLibs.Extensions;
|
using ArcaneLibs.Extensions;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using RabbitMQ.Client;
|
using RabbitMQ.Client;
|
||||||
using Spacebar.AdminApi.Models;
|
using Spacebar.AdminApi.Models;
|
||||||
using Spacebar.AdminAPI.Services;
|
using Spacebar.AdminAPI.Services;
|
||||||
@ -53,10 +45,10 @@ public class UserController(ILogger<UserController> logger, Configuration config
|
|||||||
Disabled = x.Disabled,
|
Disabled = x.Disabled,
|
||||||
Deleted = x.Deleted,
|
Deleted = x.Deleted,
|
||||||
Email = x.Email,
|
Email = x.Email,
|
||||||
Flags = x.Flags,
|
Flags = ulong.Parse(x.Flags),
|
||||||
PublicFlags = x.PublicFlags,
|
PublicFlags = x.PublicFlags,
|
||||||
Rights = x.Rights,
|
Rights = x.Rights,
|
||||||
ApplicationBotUser = x.ApplicationBotUser == null ? null : new() { },
|
ApplicationBotUser = x.ApplicationBotUser == null ? null : new(),
|
||||||
ConnectedAccounts = new List<UserModel.ConnectedAccountModel>(),
|
ConnectedAccounts = new List<UserModel.ConnectedAccountModel>(),
|
||||||
MessageCount = x.MessageAuthors.Count, // This property is weirdly named due to scaffolding, might patch later
|
MessageCount = x.MessageAuthors.Count, // This property is weirdly named due to scaffolding, might patch later
|
||||||
SessionCount = x.Sessions.Count,
|
SessionCount = x.Sessions.Count,
|
||||||
@ -272,7 +264,7 @@ public class UserController(ILogger<UserController> logger, Configuration config
|
|||||||
Embeds = msg.Embeds,
|
Embeds = msg.Embeds,
|
||||||
Reactions = msg.Reactions,
|
Reactions = msg.Reactions,
|
||||||
Nonce = msg.Nonce,
|
Nonce = msg.Nonce,
|
||||||
Pinned = msg.Pinned,
|
PinnedAt = msg.PinnedAt,
|
||||||
Type = msg.Type,
|
Type = msg.Type,
|
||||||
};
|
};
|
||||||
db.Messages.Add(newMsg);
|
db.Messages.Add(newMsg);
|
||||||
@ -313,7 +305,7 @@ public class UserController(ILogger<UserController> logger, Configuration config
|
|||||||
Embeds = msg.Embeds,
|
Embeds = msg.Embeds,
|
||||||
Reactions = msg.Reactions,
|
Reactions = msg.Reactions,
|
||||||
Nonce = msg.Nonce,
|
Nonce = msg.Nonce,
|
||||||
Pinned = msg.Pinned,
|
PinnedAt = msg.PinnedAt,
|
||||||
Type = msg.Type,
|
Type = msg.Type,
|
||||||
};
|
};
|
||||||
db.Messages.Add(newMsg);
|
db.Messages.Add(newMsg);
|
||||||
@ -350,7 +342,7 @@ public class UserController(ILogger<UserController> logger, Configuration config
|
|||||||
await using var _db = scope.ServiceProvider.GetRequiredService<SpacebarDbContext>();
|
await using var _db = scope.ServiceProvider.GetRequiredService<SpacebarDbContext>();
|
||||||
// set timeout
|
// set timeout
|
||||||
_db.Database.SetCommandTimeout(6000);
|
_db.Database.SetCommandTimeout(6000);
|
||||||
await _db.Database.ExecuteSqlRawAsync($"""
|
await _db.Database.ExecuteSqlAsync($"""
|
||||||
DELETE FROM messages
|
DELETE FROM messages
|
||||||
WHERE channel_id = '{channelId}'
|
WHERE channel_id = '{channelId}'
|
||||||
AND guild_id = '{guildId}'
|
AND guild_id = '{guildId}'
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Spacebar.Db.Models;
|
using Spacebar.Db.Models;
|
||||||
|
using Stream = Spacebar.Db.Models.Stream;
|
||||||
|
|
||||||
namespace Spacebar.Db.Contexts;
|
namespace Spacebar.Db.Contexts;
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public partial class User
|
|||||||
public string Flags { get; set; }
|
public string Flags { get; set; }
|
||||||
|
|
||||||
[Column("public_flags")]
|
[Column("public_flags")]
|
||||||
public int PublicFlags { get; set; }
|
public ulong PublicFlags { get; set; }
|
||||||
|
|
||||||
[Column("purchased_flags")]
|
[Column("purchased_flags")]
|
||||||
public int PurchasedFlags { get; set; }
|
public int PurchasedFlags { get; set; }
|
||||||
@ -105,7 +105,7 @@ public partial class User
|
|||||||
public int PremiumUsageFlags { get; set; }
|
public int PremiumUsageFlags { get; set; }
|
||||||
|
|
||||||
[Column("rights")]
|
[Column("rights")]
|
||||||
public long Rights { get; set; }
|
public ulong Rights { get; set; }
|
||||||
|
|
||||||
[Column("data")]
|
[Column("data")]
|
||||||
public string Data { get; set; } = null!;
|
public string Data { get; set; } = null!;
|
||||||
|
|||||||
Reference in New Issue
Block a user