Skip to content

Commit e785e51

Browse files
committed
return mapped model
1 parent 4187bc7 commit e785e51

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/packages/user/user/repository/detail/user-detail.server.data-source.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { UmbUserDetailModel } from '../../types.js';
1+
import type { UmbUserDetailModel, UmbUserStartNodesModel } from '../../types.js';
22
import { UMB_USER_ENTITY_TYPE } from '../../entity.js';
33
import { UmbId } from '@umbraco-cms/backoffice/id';
44
import type { UmbDetailDataSource } from '@umbraco-cms/backoffice/repository';
@@ -219,14 +219,35 @@ export class UmbUserServerDataSource implements UmbDetailDataSource<UmbUserDetai
219219
* @return {*}
220220
* @memberof UmbUserServerDataSource
221221
*/
222-
calculateStartNodes(unique: string) {
222+
async calculateStartNodes(unique: string) {
223223
if (!unique) throw new Error('Unique is missing');
224224

225-
return tryExecuteAndNotify(
225+
const { data, error } = await tryExecuteAndNotify(
226226
this.#host,
227227
UserService.getUserByIdCalculateStartNodes({
228228
id: unique,
229229
}),
230230
);
231+
232+
if (data) {
233+
const calculatedStartNodes: UmbUserStartNodesModel = {
234+
hasDocumentRootAccess: data.hasDocumentRootAccess,
235+
documentStartNodeUniques: data.documentStartNodeIds.map((node) => {
236+
return {
237+
unique: node.id,
238+
};
239+
}),
240+
hasMediaRootAccess: data.hasMediaRootAccess,
241+
mediaStartNodeUniques: data.mediaStartNodeIds.map((node) => {
242+
return {
243+
unique: node.id,
244+
};
245+
}),
246+
};
247+
248+
return calculatedStartNodes;
249+
}
250+
251+
return { error };
231252
}
232253
}

0 commit comments

Comments
 (0)