Ajoute une table de gestion des utilisateurs

This commit is contained in:
2026-04-15 21:53:24 +02:00
parent 655637072c
commit 0e6115e423
8 changed files with 865 additions and 189 deletions

View File

@@ -123,6 +123,11 @@ public sealed class MySqlUserProfileStore(
ORDER BY updated_utc DESC, created_utc DESC, username ASC;
""";
private const string DeleteProfileSql = """
DELETE FROM site_users
WHERE subject = @subject;
""";
private readonly SiteDataOptions _options = options.Value;
private readonly ILogger<MySqlUserProfileStore> _logger = logger;
@@ -285,6 +290,17 @@ public sealed class MySqlUserProfileStore(
return await ReadProfileAsync(connection, subject, cancellationToken);
}
public async Task DeleteAsync(string subject, CancellationToken cancellationToken)
{
await using var connection = new MySqlConnection(_options.BuildConnectionString());
await connection.OpenAsync(cancellationToken);
await using var command = connection.CreateCommand();
command.CommandText = DeleteProfileSql;
command.Parameters.AddWithValue("@subject", subject);
await command.ExecuteNonQueryAsync(cancellationToken);
}
private static UserProfileInput NormalizeInput(AuthenticatedSiteUser user, UpdateUserProfileRequest request)
=> NormalizeInput(user.DisplayName, request);