Endpoints changed and added for Groups #7

Merged
cake merged 19 commits from endpoints_groups into 1.12.0-server 2025-09-25 16:03:17 +00:00
3 changed files with 13 additions and 2 deletions
Showing only changes of commit deea39d621 - Show all commits

View File

@@ -1,6 +1,7 @@
using LightlessSync.API.Data.Enum;
using LightlessSync.API.Data.Extensions;
using LightlessSync.API.Dto.Group;
using LightlessSync.API.Dto.User;
using LightlessSyncServer.Utils;
using LightlessSyncShared.Models;
using LightlessSyncShared.Utils;
@@ -604,6 +605,17 @@ public partial class LightlessHub
}
}
[Authorize(Policy = "Identified")]
public async Task<GroupProfileDto> GroupGetProfile(GroupDto dto)
{
_logger.LogCallInfo(LightlessHubLogger.Args(dto));
var data = await DbContext.GroupProfiles.SingleOrDefaultAsync(g => g.GroupGID == dto.Group.GID, cancellationToken: _contextAccessor.HttpContext.RequestAborted).ConfigureAwait(false);
if (data == null) return new GroupProfileDto(dto.Group, null, null, null);
return new GroupProfileDto(dto.Group, data.Description, data.Tags, data.Base64GroupProfileImage);
}
[Authorize(Policy = "Identified")]
public async Task GroupSetProfile(GroupProfileDto dto)
{

View File

@@ -10,7 +10,7 @@ public static class Extensions
{
public static GroupData ToGroupData(this Group group)
{
return new GroupData(group.GID, group.Alias, group.CreatedDate, group.Profile.Description, group.Profile.Tags, group.Profile.Base64GroupProfileImage);
return new GroupData(group.GID, group.Alias, group.CreatedDate);
}
public static UserData ToUserData(this GroupPair pair)

View File

@@ -9,7 +9,6 @@ public class Group
public string GID { get; set; }
public string OwnerUID { get; set; }
public User Owner { get; set; }
public GroupProfile? Profile { get; set; }
[MaxLength(50)]
public string Alias { get; set; }
public bool InvitesEnabled { get; set; }