- 从文件模块的多部分上传处理器中移除未使用的实体引用 - 从即时通讯模块的群组成员处理器中移除未使用的实体引用 - 从RAG模块的AI模型配置中移除未使用的实体引用 - 从监控模块的告警规则配置中移除未使用的实体引用 - 从平台模块的角色权限处理器中移除未使用的实体引用 - 从脚本模块的执行日志实体引用中进行清理 - 从多个基础设施配置类中移除未使用的依赖项 - 优化测试文件中的导入声明,移除不必要的引用
51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
using IM.Domain.Entities.Conversation;
|
||
using IM.Domain.Entities.ConversationParticipant;
|
||
using IM.Domain.Enums;
|
||
|
||
namespace BuildFlow.IM.Tests;
|
||
|
||
/// <summary>
|
||
/// 测试数据工厂。集中处理 IFullAudit 实体的审计字段填充(InMemory 无 AuditInterceptor 自动补值)。
|
||
/// </summary>
|
||
internal static class ImTestData
|
||
{
|
||
private const string SystemUser = "system";
|
||
private const string LocalIp = "127.0.0.1";
|
||
|
||
/// <summary>构造一个带参与者的会话,审计字段已补齐。</summary>
|
||
internal static ConversationEntity BuildConversation(
|
||
Guid id,
|
||
ConversationTypeEnum type,
|
||
params (Guid UserId, int UnreadCount)[] participants)
|
||
{
|
||
var now = DateTime.UtcNow;
|
||
var conv = new ConversationEntity
|
||
{
|
||
Id = id,
|
||
Type = type,
|
||
CreatedBy = SystemUser,
|
||
CreatedAt = now,
|
||
UpdatedBy = SystemUser,
|
||
UpdatedAt = now,
|
||
OperatorIP = LocalIp,
|
||
};
|
||
|
||
foreach (var (userId, unread) in participants)
|
||
{
|
||
conv.Participants.Add(new ConversationParticipantEntity
|
||
{
|
||
ConversationId = id,
|
||
UserId = userId,
|
||
UnreadCount = unread,
|
||
JoinedAt = now,
|
||
CreatedBy = SystemUser,
|
||
CreatedAt = now,
|
||
UpdatedBy = SystemUser,
|
||
UpdatedAt = now,
|
||
});
|
||
}
|
||
|
||
return conv;
|
||
}
|
||
}
|