添加项目文件。
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using GroupService.Domain.Enums;
|
||||
using GroupService.Domain.Events;
|
||||
using GroupService.Domain.ValueObjects;
|
||||
using IM.DomainCommons;
|
||||
|
||||
namespace GroupService.Domain.Entities
|
||||
{
|
||||
public class GroupInvitation : AggregateRootEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 群聊编号
|
||||
/// </summary>
|
||||
public Guid GroupId { get; private set; }
|
||||
public GroupProfile GroupProfile { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被邀请用户
|
||||
/// </summary>
|
||||
public Guid UserId { get; private set; }
|
||||
public UserProfile UserProfile { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邀请用户
|
||||
/// </summary>
|
||||
public Guid OperatorId { get; private set; }
|
||||
public UserProfile OperatorProfile { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态(0:待被邀请人同意
|
||||
/// 1:被邀请人已同意)
|
||||
/// </summary>
|
||||
public GroupInvitationState State { get; private set; } = GroupInvitationState.Pending;
|
||||
|
||||
|
||||
private GroupInvitation() { }
|
||||
public GroupInvitation(Guid groupId, GroupProfile groupProfile, Guid userId, UserProfile userProfile, Guid operatorId, UserProfile operatorProfile)
|
||||
{
|
||||
GroupId = groupId;
|
||||
GroupProfile = groupProfile;
|
||||
UserId = userId;
|
||||
UserProfile = userProfile;
|
||||
OperatorId = operatorId;
|
||||
OperatorProfile = operatorProfile;
|
||||
AddDomainEvent(new GroupInvitationCreateDomainEvent(this));
|
||||
}
|
||||
|
||||
public void Accept()
|
||||
{
|
||||
if (State != GroupInvitationState.Pending) return;
|
||||
State = GroupInvitationState.Passed;
|
||||
ModificationTime = DateTime.Now;
|
||||
AddDomainEvent(new GroupInvitationAcceptDomainEvent(this));
|
||||
}
|
||||
|
||||
public void Reject()
|
||||
{
|
||||
if (State != GroupInvitationState.Pending) return;
|
||||
State = GroupInvitationState.Reject;
|
||||
ModificationTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user