Refactor group existence checks and add group repo tests

Renamed IGroupsExist and related methods from Exists to Exist for consistency. Added integration tests for GroupRepository. Introduced entity configurations for ChatGroup, GroupAdmins, GroupInvitation, and updated GroupMembership configuration. Updated usages and tests to match new method names and improved equality checks for ChatGroup.
This commit is contained in:
Artemy
2025-07-07 20:49:20 +07:00
parent 42be589a26
commit a68feb4a17
12 changed files with 421 additions and 13 deletions
+12
View File
@@ -11,4 +11,16 @@ public class ChatGroup
public List<GroupAdmins> Admins { get; set; } = new();
public List<GroupMembership> Members { get; set; } = new();
public List<GroupInvitation> InviteCodes { get; set; } = new();
public override bool Equals(object? obj)
{
ChatGroup chatGroup = obj as ChatGroup;
return Id == chatGroup.Id &&
Name == chatGroup.Name &&
Description == chatGroup.Description &&
ImageId == chatGroup.ImageId &&
IsChannel == chatGroup.IsChannel &&
IsPrivate == chatGroup.IsPrivate;
}
}
@@ -4,6 +4,6 @@ namespace Govor.Core.Repositories.Groups;
public interface IGroupsExist
{
public bool Exists(Guid groupId);
public bool Exists(ChatGroup chatGroup);
public bool Exist(Guid groupId);
public bool Exist(ChatGroup chatGroup);
}