Files
WatchIt/WatchIt.Common/WatchIt.Common.Model/Accounts/AccountResponse.cs

49 lines
1.2 KiB
C#
Raw Normal View History

2024-10-26 02:23:33 +02:00
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using WatchIt.Common.Model.Genders;
namespace WatchIt.Common.Model.Accounts;
public class AccountResponse : Account
{
#region PROPERTIES
[JsonPropertyName("id")]
public required long Id { get; set; }
[JsonPropertyName("gender")]
public GenderResponse? Gender { get; set; }
2024-10-30 23:28:47 +01:00
[JsonPropertyName("last_active")]
public DateTime LastActive { get; set; }
[JsonPropertyName("creation_date")]
public DateTime CreationDate { get; set; }
[JsonPropertyName("is_admin")]
public bool IsAdmin { get; set; }
2024-10-26 02:23:33 +02:00
#endregion
#region CONSTRUCTORS
2024-10-28 00:35:32 +01:00
[JsonConstructor]
public AccountResponse() {}
2024-10-26 02:23:33 +02:00
[SetsRequiredMembers]
public AccountResponse(Database.Model.Account.Account account)
{
Id = account.Id;
Username = account.Username;
Email = account.Email;
Description = account.Description;
Gender = account.Gender is not null ? new GenderResponse(account.Gender) : null;
2024-10-30 23:28:47 +01:00
LastActive = account.LastActive;
CreationDate = account.CreationDate;
IsAdmin = account.IsAdmin;
2024-10-26 02:23:33 +02:00
}
#endregion
}