초기커밋
This commit is contained in:
60
BrokerApiCore/Entity/BrokerMailEntity.cs
Normal file
60
BrokerApiCore/Entity/BrokerMailEntity.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
namespace BrokerCore.Entity;
|
||||
|
||||
using Actions;
|
||||
|
||||
|
||||
public class BrokerMailEntity : EntityBase, IWithLogActor
|
||||
{
|
||||
private readonly EntityBase m_parent;
|
||||
private readonly IServerLogic m_server_logic;
|
||||
|
||||
// !! 주의 현상태에서는 EntityBase는 반드시 UserBase여야 한다.
|
||||
// !! MailAttribute가 AccountAttribute를 참조하고, AccountAttribute는 UserBase를 참조하기 때문
|
||||
public BrokerMailEntity(EntityBase parent, IServerLogic serverLogic)
|
||||
: base(EntityType.Mail, parent)
|
||||
{
|
||||
this.m_parent = parent;
|
||||
this.m_server_logic = serverLogic;
|
||||
}
|
||||
|
||||
//====================================================================================================
|
||||
// mail에 동록된 모든 Attribute와 Action을 초기화
|
||||
//====================================================================================================
|
||||
public override async Task<Result> onInit()
|
||||
{
|
||||
addEntityAttribute(new MailAttribute(this, m_parent));
|
||||
addEntityAction(new BrokerMailSendAction(this, m_server_logic.getDynamoDbClient()));
|
||||
addEntityAction(new BrokerMailRecvAction(this, m_server_logic.getDynamoDbClient()));
|
||||
|
||||
var mail_attribute = this.getEntityAttributeNotNull<MailAttribute>();
|
||||
var result = await mail_attribute.onInit();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var mail_send_action = this.getEntityActionNotNull<BrokerMailSendAction>();
|
||||
result = await mail_send_action.onInit();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return await base.onInit();
|
||||
}
|
||||
|
||||
public ILogActor toLogActor()
|
||||
{
|
||||
var log_actor = m_parent as IWithLogActor;
|
||||
NullReferenceCheckHelper.throwIfNull(log_actor,
|
||||
() => $"m_parent is not IWithLogActor");
|
||||
return log_actor.toLogActor();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user