Added get of group profile, removed group from model. redone group data.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using LightlessSync.API.Data.Enum;
|
using LightlessSync.API.Data.Enum;
|
||||||
using LightlessSync.API.Data.Extensions;
|
using LightlessSync.API.Data.Extensions;
|
||||||
using LightlessSync.API.Dto.Group;
|
using LightlessSync.API.Dto.Group;
|
||||||
|
using LightlessSync.API.Dto.User;
|
||||||
using LightlessSyncServer.Utils;
|
using LightlessSyncServer.Utils;
|
||||||
using LightlessSyncShared.Models;
|
using LightlessSyncShared.Models;
|
||||||
using LightlessSyncShared.Utils;
|
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")]
|
[Authorize(Policy = "Identified")]
|
||||||
public async Task GroupSetProfile(GroupProfileDto dto)
|
public async Task GroupSetProfile(GroupProfileDto dto)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public static class Extensions
|
|||||||
{
|
{
|
||||||
public static GroupData ToGroupData(this Group group)
|
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)
|
public static UserData ToUserData(this GroupPair pair)
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ public class Group
|
|||||||
public string GID { get; set; }
|
public string GID { get; set; }
|
||||||
public string OwnerUID { get; set; }
|
public string OwnerUID { get; set; }
|
||||||
public User Owner { get; set; }
|
public User Owner { get; set; }
|
||||||
public GroupProfile? Profile { get; set; }
|
|
||||||
[MaxLength(50)]
|
[MaxLength(50)]
|
||||||
public string Alias { get; set; }
|
public string Alias { get; set; }
|
||||||
public bool InvitesEnabled { get; set; }
|
public bool InvitesEnabled { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user