Skip to content

Commit

Permalink
linting pt2 and fixing test jobConfig file
Browse files Browse the repository at this point in the history
  • Loading branch information
despadam committed Oct 16, 2024
1 parent 90a8fe4 commit a8bad4e
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 66 deletions.
13 changes: 6 additions & 7 deletions src/jobs/jobs.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export class JobsController {
}

// check that datasetList is of type DatasetListDto[]
const datasetListDtos: DatasetListDto[] = datasetList.map(item => {
return Object.assign(new DatasetListDto(), (item));
const datasetListDtos: DatasetListDto[] = datasetList.map((item) => {
return Object.assign(new DatasetListDto(), item);
});
const allowedKeys = [JobParams.Pid, JobParams.Files] as string[];
for (const datasetListDto of datasetListDtos) {
Expand All @@ -139,7 +139,8 @@ export class JobsController {
throw new HttpException(
{
status: HttpStatus.BAD_REQUEST,
message: "Dataset list is expected to contain sets of pid and files.",
message:
"Dataset list is expected to contain sets of pid and files.",
},
HttpStatus.BAD_REQUEST,
);
Expand Down Expand Up @@ -267,9 +268,7 @@ export class JobsController {
datasetList: DatasetListDto[],
jobType: string,
): Promise<void> {
const datasetsToCheck = datasetList.filter(
(x) => x.files.length > 0,
);
const datasetsToCheck = datasetList.filter((x) => x.files.length > 0);
const ids = datasetsToCheck.map((x) => x.pid);

switch (jobType) {
Expand Down Expand Up @@ -337,7 +336,7 @@ export class JobsController {
checkResults.map(({ pid, nonExistFiles }) => ({
pid,
nonExistFiles,
}))
})),
),
},
HttpStatus.BAD_REQUEST,
Expand Down
145 changes: 86 additions & 59 deletions test/config/jobconfig.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,100 @@
{
"configVersion": "v1.0 2024-03-01 6f3f38",
"jobs": [
{
"jobType": "all_access",
"create": {
"auth": "#all",
"actions": [
{
"actionType": "log"
}
]
},
"statusUpdate": {
"auth": "#all"
}
},
{
"jobType": "all_access",
"create": {
"auth": "#all",
"actions": [
{
"actionType": "log"
}
]
"jobType": "public_access",
"create": {
"auth": "#datasetPublic"
},
"statusUpdate": {
"auth": "#all"
}
},
"statusUpdate": {
"auth": "#all"
}
},
{
"jobType": "public_access",
"create": {
"auth": "#datasetPublic"
{
"jobType": "authenticated_access",
"create": {
"auth": "#authenticated"
},
"statusUpdate": {
"auth": "#all"
}
},
"statusUpdate": {
"auth": "#all"
}
},
{
"jobType": "authenticated_access",
"create": {
"auth": "#authenticated"
{
"jobType": "dataset_access",
"create": {
"auth": "#datasetAccess"
},
"statusUpdate": {
"auth": "#jobOwnerGroup"
}
},
"statusUpdate": {
"auth": "#all"
}
},
{
"jobType": "dataset_access",
"create": {
"auth": "#datasetAccess"
{
"jobType": "owner_access",
"create": {
"auth": "#datasetOwner"
},
"statusUpdate": {
"auth": "#jobOwnerUser"
}
},
"statusUpdate": {
"auth": "#jobOwnerGroup"
}
},
{
"jobType": "owner_access",
"create": {
"auth": "#datasetOwner"
{
"jobType": "user_access",
"create": {
"auth": "user5.1"
},
"statusUpdate": {
"auth": "user5.1"
}
},
"statusUpdate": {
"auth": "#jobOwnerUser"
}
},
{
"jobType": "user_access",
"create": {
"auth": "user5.1"
{
"jobType": "group_access",
"create": {
"auth": "@group5"
},
"statusUpdate": {
"auth": "@group5"
}
},
"statusUpdate": {
"auth": "user5.1"
}
},
{
"jobType": "group_access",
"create": {
"auth": "@group5"
{
"jobType": "archive",
"create": {
"auth": "#all"
},
"statusUpdate": {
"auth": "#all"
}
},
{
"jobType": "retrieve",
"create": {
"auth": "#all"
},
"statusUpdate": {
"auth": "#all"
}
},
"statusUpdate": {
"auth": "@group5"
{
"jobType": "public",
"create": {
"auth": "#all"
},
"statusUpdate": {
"auth": "#all"
}
}
}
]
}

0 comments on commit a8bad4e

Please sign in to comment.