package com.custom.webui.service;
|
|
import com.custom.webui.dto.req.ChatGroupRequest;
|
import com.custom.webui.dto.resp.ChatGroupDTO;
|
import com.custom.webui.entity.ChatGroup;
|
|
import java.util.List;
|
|
/**
|
* 对话分组服务(用户自建的文件夹)。
|
*
|
* <p><b>数据隔离约定</b>:所有方法都必须接收 {@code userId} 并在查询条件里带上,
|
* 与 {@link ChatService} 一致。分组与收藏夹类似,越权读取他人分组名同样属于信息泄露。
|
*/
|
public interface ChatGroupService {
|
|
/** 当前用户的全部分组,按创建顺序(新建的排在后面) */
|
List<ChatGroupDTO> listByUser(Long userId);
|
|
/** 新建分组,同名时返回 400 而不是数据库唯一键错误 */
|
ChatGroupDTO create(Long userId, ChatGroupRequest request);
|
|
/** 重命名分组 */
|
ChatGroupDTO rename(Long userId, Long groupId, ChatGroupRequest request);
|
|
/**
|
* 删除分组。
|
*
|
* <p><b>不会删除组内会话</b>:只把它们的 group_id 置空,回到「未分组」
|
* 继续按时间归类。分组只是整理手段,删一个文件夹不该连带毁掉里面的内容。
|
*
|
* @return 被移出分组的会话数,用于给用户一个明确提示
|
*/
|
int delete(Long userId, Long groupId);
|
|
/** 校验分组归属;不属于该用户时抛 404(而非 403,避免探测他人分组是否存在) */
|
ChatGroup requireOwnedGroup(Long userId, Long groupId);
|
}
|