From 87661fafeb6d6b581572bbcd49381093e1390d14 Mon Sep 17 00:00:00 2001 From: Jonathan Treffler Date: Tue, 26 Nov 2024 23:56:57 +0100 Subject: [PATCH] added createResource and deleteResource to frontend api controller --- src/api.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/api.js b/src/api.js index 89f969f..3bd69ff 100644 --- a/src/api.js +++ b/src/api.js @@ -40,7 +40,7 @@ var ResourceMemberPermissionLevels = { /** * @typedef {{ * id: number - * type: string + * type: ResourceType * organizationFolderId: number * name: string * parentResource: number @@ -58,6 +58,8 @@ var ResourceMemberPermissionLevels = { * @typedef {{ * type: PrincipalType, * id: string, + * friendlyName: string + * fullHierarchyNames: string[] * }} Principal * * @typedef {{ @@ -104,12 +106,42 @@ export default { * managersAclPermission: number|undefined * inheritedAclPermission: number|undefined * }} updateResourceDto UpdateResourceDto + * @param string include * @return {Promise} */ updateResource(resourceId, updateGroupDto, include = "model") { return axios.put(`/resources/${resourceId}`, { ...updateGroupDto, include }).then((res) => res.data); }, + /** + * @param {{ + * type: ResourceType + * organizationFolderId: number + * name: string + * parentResourceId: number|undefined + * active: bool + * inheritManagers: bool + * + * membersAclPermission: number|undefined + * managersAclPermission: number|undefined + * inheritedAclPermission: number|undefined + * }} createResourceDto CreateResourceDto + * @param string include + * @return {Promise} + */ + createResource(createGroupDto, include = "model") { + return axios.post(`/resources`, { ...createGroupDto, include }).then((res) => res.data); + }, + + /** + * + * @param {number|string} resourceId Resource id + * @return {Promise} + */ + deleteResource(resourceId) { + return axios.delete(`/resources/${resourceId}`).then((res) => res.data); + }, + /** * @param {number|string} resourceId Resource id * @return {Promise>}