添加项目文件。
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using GroupService.Domain.Enums;
|
||||
using GroupService.Domain.Events;
|
||||
using IM.DomainCommons;
|
||||
|
||||
namespace GroupService.Domain.Entities
|
||||
{
|
||||
public class GroupMember : AggregateRootEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户编号
|
||||
/// </summary>
|
||||
public Guid UserId { get; private set; }
|
||||
public string GroupNickName { get; private set; }
|
||||
public string? Avatar { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 群聊编号
|
||||
/// </summary>
|
||||
public Guid GroupId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成员角色(0:普通成员,1:管理员,2:群主)
|
||||
/// </summary>
|
||||
public GroupMemberRole Role { get; private set; }
|
||||
|
||||
private GroupMember() { }
|
||||
|
||||
public GroupMember(Guid userId, Guid groupId, string groupNickname, string? avatar, GroupMemberRole role = GroupMemberRole.Normal)
|
||||
{
|
||||
UserId = userId;
|
||||
GroupId = groupId;
|
||||
Role = role;
|
||||
GroupNickName = groupNickname;
|
||||
Avatar = avatar;
|
||||
AddDomainEvent(new GroupMemberJoinedDomainEvent(this));
|
||||
}
|
||||
|
||||
public void UpdateRole(GroupMemberRole role)
|
||||
{
|
||||
if (role == Role) return;
|
||||
Role = role;
|
||||
}
|
||||
|
||||
public void UpdateAvatar(string avatar)
|
||||
{
|
||||
Avatar = avatar;
|
||||
}
|
||||
public void UpdateGroupNickname(string nickname)
|
||||
{
|
||||
GroupNickName = nickname;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user