Improved reducer state size
[arvados-workbench2.git] / src / services / project-service / project-service.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { GroupsService } from "../groups-service/groups-service";
6 import { ProjectResource } from "~/models/project";
7 import { GroupClass } from "~/models/group";
8 import { ListArguments } from "~/services/common-service/common-resource-service";
9 import { FilterBuilder, joinFilters } from "~/services/api/filter-builder";
10
11 export class ProjectService extends GroupsService<ProjectResource> {
12
13     create(data: Partial<ProjectResource>) {
14         const projectData = { ...data, groupClass: GroupClass.PROJECT };
15         return super.create(projectData);
16     }
17
18     list(args: ListArguments = {}) {
19         return super.list({
20             ...args,
21             filters: joinFilters(
22                 args.filters,
23                 new FilterBuilder()
24                     .addEqual("groupClass", GroupClass.PROJECT)
25                     .getFilters()
26             )
27         });
28     }
29 }