76 lines
2.0 KiB
C#
76 lines
2.0 KiB
C#
namespace BrokerCore.Entity;
|
|
|
|
using Actions;
|
|
|
|
using BrokerBusinessLog;
|
|
|
|
using ServerCommon;
|
|
|
|
using ServerCore; using ServerBase;
|
|
|
|
public sealed class PlanetUserEntity : EntityBase, IWithLogActor
|
|
{
|
|
private readonly DynamoDbClient m_dynamo_db_client;
|
|
private readonly IServerLogic m_server_logic;
|
|
private string m_planet_id = string.Empty;
|
|
// private BrokerMail m_broker_mail = null!;
|
|
|
|
public string AccountId
|
|
=> this.getEntityAttributeNotNull<AccountAttribute>().AccountId;
|
|
|
|
public string UserGuid
|
|
=> this.getEntityAttributeNotNull<UserAttribute>().UserGuid;
|
|
|
|
public string Nickname
|
|
=> this.getEntityAttributeNotNull<NicknameAttribute>().Nickname;
|
|
|
|
public PlanetUserEntity(IServerLogic serverLogic) : base(EntityType.PlanetUser)
|
|
{
|
|
m_server_logic = serverLogic;
|
|
m_dynamo_db_client = serverLogic.getDynamoDbClient();
|
|
}
|
|
|
|
public override OwnerEntityType onGetOwnerEntityType()
|
|
{
|
|
return OwnerEntityType.User;
|
|
}
|
|
public override async Task<Result> onInit()
|
|
{
|
|
try
|
|
{
|
|
addEntityAttribute(new UserAttribute(this));
|
|
addEntityAttribute(new NicknameAttribute(this));
|
|
addEntityAction(new UserAuthAction(this, m_dynamo_db_client));
|
|
addEntityAttribute(new AccountAttribute(this));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.getLogger().Error(ex, $"{nameof(PlanetUserEntity)}.onInit() Exception => {ex.Message}");
|
|
}
|
|
return await base.onInit();
|
|
}
|
|
|
|
public void setPlanetId(string planetId)
|
|
{
|
|
m_planet_id = planetId;
|
|
}
|
|
|
|
// IWithLogActor 구현
|
|
public ILogActor toLogActor()
|
|
{
|
|
var account = this.getEntityAttributeNotNull<AccountAttribute>();
|
|
var nickname = this.getEntityAttributeNotNull<NicknameAttribute>();
|
|
var log_actor = new PlanetUserLogActor
|
|
{
|
|
ServerType = m_server_logic.getServerType().toServerType(),
|
|
PlanetId = m_planet_id,
|
|
AccountType = account.AccountType,
|
|
AccountId = account.AccountId,
|
|
AccountIdString = account.AccountIdString,
|
|
UserNickname = nickname.Nickname,
|
|
UserGuid = account.UserGuid,
|
|
};
|
|
return log_actor;
|
|
}
|
|
}
|