[ARVADOS-WORKBENCH2] created: 1.2.0-912-g70bf37e
Git user
git at public.curoverse.com
Mon Nov 19 05:13:52 EST 2018
at 70bf37e9881a433b740cc70376d4b6680a582910 (commit)
commit 70bf37e9881a433b740cc70376d4b6680a582910
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date: Mon Nov 19 11:13:34 2018 +0100
change services
Feature #14433_properties_inside_project_services
Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>
diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index bdb5119..d1e2eff 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -59,7 +59,7 @@ export class GroupsService<T extends GroupResource = GroupResource> extends Tras
const { items, ...res } = response;
const mappedItems = items.map((item: GroupContentsResource) => {
const mappedItem = TrashableResourceService.mapKeys(_.camelCase)(item);
- if (item.kind === ResourceKind.COLLECTION) {
+ if (item.kind === ResourceKind.COLLECTION || item.kind === ResourceKind.PROJECT) {
const { properties } = item;
return { ...mappedItem, properties };
} else {
diff --git a/src/services/project-service/project-service.ts b/src/services/project-service/project-service.ts
index 2dc3eeb..d600347 100644
--- a/src/services/project-service/project-service.ts
+++ b/src/services/project-service/project-service.ts
@@ -7,7 +7,8 @@ import { ProjectResource } from "~/models/project";
import { GroupClass } from "~/models/group";
import { ListArguments } from "~/services/common-service/common-resource-service";
import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
-
+import { TrashableResourceService } from '~/services/common-service/trashable-resource-service';
+import { snakeCase } from 'lodash';
export class ProjectService extends GroupsService<ProjectResource> {
create(data: Partial<ProjectResource>) {
@@ -15,6 +16,29 @@ export class ProjectService extends GroupsService<ProjectResource> {
return super.create(projectData);
}
+ update(uuid: string, data: Partial<ProjectResource>) {
+ if (uuid && data && data.properties) {
+ const { properties } = data;
+ const mappedData = {
+ ...TrashableResourceService.mapKeys(snakeCase)(data),
+ properties,
+ };
+ return TrashableResourceService
+ .defaultResponse(
+ this.serverApi
+ .put<ProjectResource>(this.resourceType + uuid, mappedData),
+ this.actions,
+ false
+ );
+ }
+ return TrashableResourceService
+ .defaultResponse(
+ this.serverApi
+ .put<ProjectResource>(this.resourceType + uuid, data && TrashableResourceService.mapKeys(snakeCase)(data)),
+ this.actions
+ );
+ }
+
list(args: ListArguments = {}) {
return super.list({
...args,
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list