Added tags on call for user profile calls, added disabled on syncshell profiles. reworked the calls
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using LightlessSync.API.Data.Enum;
|
||||
using LightlessSync.API.Data.Extensions;
|
||||
using LightlessSync.API.Dto.Group;
|
||||
using LightlessSync.API.Dto.User;
|
||||
using LightlessSyncShared.Models;
|
||||
using static LightlessSyncServer.Hubs.LightlessHub;
|
||||
|
||||
@@ -19,6 +20,16 @@ public static class Extensions
|
||||
if (dto.IsNsfw.HasValue) profile.IsNSFW = dto.IsNsfw.Value;
|
||||
}
|
||||
|
||||
public static void UpdateProfileFromDto(this UserProfileData profile, UserProfileDto dto)
|
||||
{
|
||||
if (profile == null || dto == null) return;
|
||||
|
||||
profile.Base64ProfileImage = string.IsNullOrWhiteSpace(dto.ProfilePictureBase64) ? null : dto.ProfilePictureBase64;
|
||||
if (dto.Tags != null) profile.Tags = dto.Tags;
|
||||
if (dto.Description != null) profile.UserDescription = dto.Description;
|
||||
if (dto.IsNSFW.HasValue) profile.IsNSFW = dto.IsNSFW.Value;
|
||||
}
|
||||
|
||||
public static GroupProfileDto ToDTO(this GroupProfile groupProfile)
|
||||
{
|
||||
if (groupProfile == null)
|
||||
@@ -38,6 +49,25 @@ public static class Extensions
|
||||
);
|
||||
}
|
||||
|
||||
public static UserProfileDto ToDTO(this UserProfileData userProfileData)
|
||||
{
|
||||
if (userProfileData == null)
|
||||
{
|
||||
return new UserProfileDto(User: null, Disabled: false, IsNSFW: null, ProfilePictureBase64: null, Description: null, Tags: []);
|
||||
}
|
||||
|
||||
var userData = userProfileData.User?.ToUserData();
|
||||
|
||||
return new UserProfileDto(
|
||||
userData,
|
||||
userProfileData.ProfileDisabled,
|
||||
userProfileData.IsNSFW,
|
||||
userProfileData.Base64ProfileImage,
|
||||
userProfileData.UserDescription,
|
||||
userProfileData.Tags
|
||||
);
|
||||
}
|
||||
|
||||
public static GroupData ToGroupData(this Group group)
|
||||
{
|
||||
if (group == null)
|
||||
|
||||
Reference in New Issue
Block a user