✨ Swagger UI
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using NodaTime;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Org.BouncyCastle.Security;
|
||||
@ -23,7 +24,7 @@ public class AccountContact : BaseModel
|
||||
public Instant? VerifiedAt { get; set; }
|
||||
[MaxLength(1024)] public string Content { get; set; } = string.Empty;
|
||||
|
||||
public Account Account { get; set; } = null!;
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
}
|
||||
|
||||
public enum AccountContactType
|
||||
@ -37,7 +38,7 @@ public class AccountAuthFactor : BaseModel
|
||||
public AccountAuthFactorType Type { get; set; }
|
||||
public string? Secret { get; set; } = null;
|
||||
|
||||
public Account Account { get; set; } = null!;
|
||||
[JsonIgnore] public Account Account { get; set; } = null!;
|
||||
|
||||
public AccountAuthFactor HashSecret(int cost = 12)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DysonNetwork.Sphere.Account;
|
||||
|
||||
@ -12,8 +13,8 @@ public class AccountController(AppDatabase db)
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<Account?>> GetByName(string name)
|
||||
{
|
||||
var account = await db.Accounts.FindAsync(name);
|
||||
return account;
|
||||
var account = await db.Accounts.Where(a => a.Name == name).FirstOrDefaultAsync();
|
||||
return account is null ? new NotFoundResult() : account;
|
||||
}
|
||||
|
||||
public class AccountCreateRequest
|
||||
@ -32,9 +33,9 @@ public class AccountController(AppDatabase db)
|
||||
{
|
||||
Name = request.Name,
|
||||
Nick = request.Nick,
|
||||
Contacts = new List<AccountContact>()
|
||||
Contacts = new List<AccountContact>
|
||||
{
|
||||
new AccountContact
|
||||
new()
|
||||
{
|
||||
Type = AccountContactType.Email,
|
||||
Content = request.Email
|
||||
|
Reference in New Issue
Block a user