From 563e840bb8998d445d70bcdfc78289291c714681 Mon Sep 17 00:00:00 2001 From: Douglas Sebastian Date: Fri, 18 Oct 2024 15:14:31 -0300 Subject: [PATCH] change: Folder.assignedBy as list --- src/pages/Content/ContentHeader/ContentHeader.less | 2 +- src/pages/Content/ContentHeader/ContentHeader.tsx | 11 +++++++++-- src/pages/Profile/loader.ts | 2 +- src/services/UniversimeApi/Profile.ts | 2 -- src/types/Capacity.ts | 7 +++---- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/pages/Content/ContentHeader/ContentHeader.less b/src/pages/Content/ContentHeader/ContentHeader.less index ccb618b5..9d628a53 100644 --- a/src/pages/Content/ContentHeader/ContentHeader.less +++ b/src/pages/Content/ContentHeader/ContentHeader.less @@ -64,7 +64,7 @@ margin-right: .25em; } - #assigned-by-link { + .assigned-by-link { margin-left: .25em; } } diff --git a/src/pages/Content/ContentHeader/ContentHeader.tsx b/src/pages/Content/ContentHeader/ContentHeader.tsx index 89c96ad7..1240d4b8 100644 --- a/src/pages/Content/ContentHeader/ContentHeader.tsx +++ b/src/pages/Content/ContentHeader/ContentHeader.tsx @@ -17,7 +17,7 @@ export function ContentHeader() { const author = new ProfileClass(context.content.author); const assignedBy = context.content.assignedBy && !context.watchingProfile - ? new ProfileClass(context.content.assignedBy) + ? context.content.assignedBy.map(ProfileClass.new) : undefined; const materialCount = context.materials.length; @@ -51,7 +51,14 @@ export function ContentHeader() {
AtribuĂ­do a vocĂȘ por - { assignedBy.fullname } + { + assignedBy.map( ( p, i, arr ) => { + return <> + { p.fullname } + { arr.length - 1 !== i && ', ' } + + } ) + }
} diff --git a/src/pages/Profile/loader.ts b/src/pages/Profile/loader.ts index 75bce30c..68d3b922 100644 --- a/src/pages/Profile/loader.ts +++ b/src/pages/Profile/loader.ts @@ -58,7 +58,7 @@ export async function fetchProfilePageData(username: string | undefined): Promis UniversimeApi.Profile.competences({username}), UniversimeApi.Profile.links({username}), UniversimeApi.Profile.recommendations({username}), - UniversimeApi.Profile.folders({username, assignedOnly: true}), + UniversimeApi.Profile.folders({username}), UniversimeApi.Profile.educations({username}), UniversimeApi.Profile.experiences({username}), isOwnProfile ? UniversimeApi.Capacity.foldersAssignedBy({username}) : Promise.resolve(undefined), diff --git a/src/services/UniversimeApi/Profile.ts b/src/services/UniversimeApi/Profile.ts index e774cdb7..b6c23b35 100644 --- a/src/services/UniversimeApi/Profile.ts +++ b/src/services/UniversimeApi/Profile.ts @@ -25,7 +25,6 @@ export type ProfileIdAndUsername_RequestDTO = { }; export type ProfileFolders_RequestDTO = ProfileIdAndUsername_RequestDTO & { - assignedOnly?: boolean; }; export type ProfileGet_ResponseDTO = ApiResponse<{ profile: Profile }>; @@ -102,6 +101,5 @@ export async function folders(body: ProfileFolders_RequestDTO) { return (await api.post("/profile/folders", { profileId: body.profileId, username: body.username, - assignedOnly: body.assignedOnly, })).data; } diff --git a/src/types/Capacity.ts b/src/types/Capacity.ts index 52bc361b..105441d4 100644 --- a/src/types/Capacity.ts +++ b/src/types/Capacity.ts @@ -53,7 +53,7 @@ export type Folder = { author: Profile; publicFolder: boolean; grantedAccessGroups: Group[]; - assignedBy?: Profile; + assignedBy?: Profile[]; favorite?: true; canEdit: boolean; @@ -61,12 +61,11 @@ export type Folder = { }; export type FolderProfile = { - author: Profile; - profile: Profile; + assignedBy: Profile; + assignedTo: Profile; folder: Folder; id: string; - assigned: boolean; created: string; doneUntilNow: number;