nullref fixes
This commit is contained in:
parent
fd5b7959c5
commit
fda37f0e15
3 changed files with 10 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -378,3 +378,4 @@ site/
|
|||
|
||||
.aider.*
|
||||
PROMPT.md
|
||||
.aider*
|
|
@ -10,12 +10,6 @@ public static class DbExtensions
|
|||
where T : DbEntity
|
||||
=> set.FirstOrDefault(x => x.Id == id);
|
||||
|
||||
public static GuildConfig GuildConfigsForId(this DbContext ctx, ulong guildId)
|
||||
{
|
||||
var query = ctx.Set<GuildConfig>().Where(gc => gc.GuildId == guildId);
|
||||
return query.FirstOrDefault();
|
||||
}
|
||||
|
||||
public static GuildFilterConfig FilterConfigForId(
|
||||
this DbContext ctx,
|
||||
ulong guildId,
|
||||
|
@ -29,9 +23,9 @@ public static class DbExtensions
|
|||
|
||||
if (gfc is null)
|
||||
{
|
||||
ctx.Add(gfc = new GuildFilterConfig()
|
||||
ctx.Add(gfc = new()
|
||||
{
|
||||
GuildId = guildId
|
||||
GuildId = guildId,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,10 +45,9 @@ public static class DbExtensions
|
|||
|
||||
if (gc is null)
|
||||
{
|
||||
ctx.Add(gc = new GuildConfig()
|
||||
ctx.Add(gc = new()
|
||||
{
|
||||
GuildId = guildId,
|
||||
Permissions = []
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -65,5 +65,5 @@ public class GuildConfig : DbEntity
|
|||
public string TimeZoneId { get; set; }
|
||||
public string Locale { get; set; }
|
||||
|
||||
public List<Permissionv2> Permissions { get; set; }
|
||||
public List<Permissionv2> Permissions { get; set; } = [];
|
||||
}
|
Loading…
Add table
Reference in a new issue