basic profile info endpoints created
This commit is contained in:
19
WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs
Normal file
19
WatchIt.Common/WatchIt.Common.Model/Accounts/Account.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WatchIt.Common.Model.Accounts;
|
||||
|
||||
public abstract class Account
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
[JsonPropertyName("username")]
|
||||
public required string Username { get; set; }
|
||||
|
||||
[JsonPropertyName("email")]
|
||||
public required string Email { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace WatchIt.Common.Model.Accounts;
|
||||
|
||||
public class AccountRequest : Account
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
[JsonPropertyName("gender_id")]
|
||||
public short GenderId { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region PUBLIC METHODS
|
||||
|
||||
public void UpdateAccount(Database.Model.Account.Account account)
|
||||
{
|
||||
account.Username = Username;
|
||||
account.Email = Email;
|
||||
account.Description = Description;
|
||||
account.GenderId = GenderId;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
[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;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class RegisterResponse
|
||||
public RegisterResponse() {}
|
||||
|
||||
[SetsRequiredMembers]
|
||||
public RegisterResponse(Account account)
|
||||
public RegisterResponse(Database.Model.Account.Account account)
|
||||
{
|
||||
Id = account.Id;
|
||||
Username = account.Username;
|
||||
|
||||
Reference in New Issue
Block a user