mirror of
https://github.com/Kareadita/Kavita.git
synced 2026-06-06 14:55:19 -04:00
More Polish (#4336)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace API.Services;
|
||||
|
||||
public interface IAuthKeyService
|
||||
{
|
||||
Task UpdateLastAccessedAsync(string authKey);
|
||||
}
|
||||
|
||||
public class AuthKeyService(DataContext context, ILogger<AuthKeyService> logger) : IAuthKeyService
|
||||
{
|
||||
public async Task UpdateLastAccessedAsync(string authKey)
|
||||
{
|
||||
logger.LogTrace("Updating last accessed Auth key: {AuthKey}", authKey);
|
||||
await context.AppUserAuthKey
|
||||
.Where(k => k.Key == authKey)
|
||||
.ExecuteUpdateAsync(s => s.SetProperty(k => k.LastAccessedAtUtc, DateTime.UtcNow));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user