fix: align backend APIs and upload flow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using GroupService.Domain.Enums;
|
||||
using GroupService.Domain.Enums;
|
||||
using GroupService.Domain.Events;
|
||||
using IM.DomainCommons;
|
||||
|
||||
@@ -65,13 +65,15 @@ namespace GroupService.Domain.Entities
|
||||
AddDomainEvent(new AllMembersBannedDomainEvent(this));
|
||||
}
|
||||
|
||||
public void Ban()
|
||||
public void Ban(bool notify = true)
|
||||
{
|
||||
Status = GroupState.Blocked;
|
||||
ModificationTime = DateTime.Now;
|
||||
AddDomainEvent(new GroupBlockedDomainEvent(this));
|
||||
if (notify) AddDomainEvent(new GroupBlockedDomainEvent(this));
|
||||
}
|
||||
|
||||
public void Unban() { Status = GroupState.Normal; ModificationTime = DateTime.Now; }
|
||||
|
||||
public void Update(string? name, GroupAuthorityType? groupAuthority, string? announcement, string? avatar)
|
||||
{
|
||||
bool isChanged = false;
|
||||
|
||||
@@ -49,5 +49,12 @@ namespace GroupService.Domain.Entities
|
||||
{
|
||||
GroupNickName = nickname;
|
||||
}
|
||||
|
||||
public void Leave()
|
||||
{
|
||||
if (IsDeleted) return;
|
||||
SoftDelete();
|
||||
AddDomainEvent(new GroupMemberLeftDomainEvent(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
using GroupService.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace GroupService.Domain.Events
|
||||
{
|
||||
public record GroupMemberLeftDomainEvent(GroupMember Member) : INotification;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace GroupService.Domain.IReposities
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Group>> FindByMasterIdAsync(Guid userId);
|
||||
Task<IEnumerable<Group>> FindByMemberIdAsync(Guid userId);
|
||||
/// <summary>
|
||||
/// 创建群聊
|
||||
/// </summary>
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace GroupService.Domain.IReposities
|
||||
Task<GroupJoinRequest> FindByIdAsync(Guid id);
|
||||
Task<IEnumerable<GroupJoinRequest?>> FindByGroupIdAsync(Guid groupId);
|
||||
Task<IEnumerable<GroupJoinRequest>> FindByUserIdAsync(Guid userId);
|
||||
Task<IEnumerable<GroupJoinRequest>> FindVisibleToUserAsync(Guid userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user