Skip to content

Commit

Permalink
Merge pull request #458 from icgc-argo/453-ega-api-funcs
Browse files Browse the repository at this point in the history
453 ega api funcs
  • Loading branch information
anncatton authored Sep 30, 2024
2 parents 3570e4a + e866b2b commit ab2e9bc
Show file tree
Hide file tree
Showing 16 changed files with 863 additions and 345 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ EGA_AUTH_REALM_NAME=
EGA_API_URL=
EGA_USERNAME=
EGA_PASSWORD=
DAC_ID=
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Development of the Data Access Control API
| EGA_API_URL | Root URL for EGA API | `string` | true | |
| EGA_USERNAME | Username for account used to gain access token from EGA authentication server | `string` | true | |
| EGA_PASSWORD | Password for account used to gain access token from EGA authentication server | `string` | true | |
| DAC_ID | AccessionId for ICGC DAC | `string` | true | |

## Feature Flags

Expand Down
326 changes: 22 additions & 304 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"sinon": "^10.0.0",
"testcontainers": "^7.8.0",
"ts-node-dev": "^2.0.0",
"typescript": "^4.9.5"
"typescript": "^5.6.2"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.18.0",
Expand Down Expand Up @@ -123,7 +123,8 @@
"uuid": "^8.3.2",
"validate.js": "^0.13.1",
"winston": "^3.3.3",
"yamljs": "^0.3.0"
"yamljs": "^0.3.0",
"zod": "^3.23.8"
},
"husky": {
"hooks": {
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export interface AppConfig {
authHost: string;
authRealmName: string;
apiUrl: string;
dacId: string;
};
}

Expand Down Expand Up @@ -211,6 +212,7 @@ const buildAppContext = (): AppConfig => {
authHost: checkIsDefined(process.env.EGA_AUTH_HOST),
authRealmName: checkIsDefined(process.env.EGA_AUTH_REALM_NAME),
apiUrl: checkIsDefined(process.env.EGA_API_URL),
dacId: checkIsDefined(process.env.DAC_ID),
},
};
return config;
Expand Down
5 changes: 3 additions & 2 deletions src/domain/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,13 @@ export interface IRequest extends Request {
identity: Identity;
}

export interface UserDataFromApprovedApplicationsResult {
export type UserDataFromApprovedApplicationsResult = {
applicant: Sections['applicant'];
collaborators: Sections['collaborators'];
lastUpdatedAtUtc?: Date;
appId: string;
}
expiresAtUtc: Date;
};

export interface ApprovedUserRowData {
userName: string;
Expand Down
2 changes: 2 additions & 0 deletions src/domain/service/applications/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ export const getUsersFromApprovedApps = async (): Promise<
'sections.applicant': 1,
'sections.collaborators': 1,
lastUpdatedAtUtc: 1,
expiresAtUtc: 1,
}).exec();

return results.map((result) => {
Expand All @@ -355,6 +356,7 @@ export const getUsersFromApprovedApps = async (): Promise<
collaborators: result.sections.collaborators,
appId: result.appId,
lastUpdatedAtUtc: result.lastUpdatedAtUtc,
expiresAtUtc: result.expiresAtUtc,
};
return approvedUsersInfo;
});
Expand Down
Loading

0 comments on commit ab2e9bc

Please sign in to comment.