Admin notes (#7259)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2022-04-16 20:57:50 +02:00
committed by GitHub
parent 0041b9d933
commit 5227d1a023
38 changed files with 4009 additions and 23 deletions

View File

@@ -1,5 +1,3 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Net;
@@ -11,7 +9,6 @@ using Content.Server.Preferences.Managers;
using Content.Shared.CCVar;
using Microsoft.EntityFrameworkCore;
using Robust.Shared.Configuration;
using Robust.Shared.IoC;
using Robust.Shared.Network;
using Robust.Shared.Utility;
@@ -491,6 +488,22 @@ namespace Content.Server.Database
await db.DbContext.SaveChangesAsync();
}
public override async Task<int> AddAdminNote(AdminNote note)
{
await using (var db = await GetDb())
{
var nextId = 1;
if (await db.DbContext.AdminNotes.AnyAsync())
{
nextId = await db.DbContext.AdminNotes.MaxAsync(dbVersion => dbVersion.Id) + 1;
}
note.Id = nextId;
}
return await base.AddAdminNote(note);
}
private async Task<DbGuardImpl> GetDbImpl()
{
await _dbReadyTask;