icgc-argo / platform-api

https://api.platform.icgc-argo.org/graphql
GNU Affero General Public License v3.0
0 stars 0 forks source link

Update `Platform API -> Program Service` integration to REST API #674

Open joneubank opened 1 year ago

joneubank commented 1 year ago

Overview

The Program Service was originally written to use GRPC for all requests, but this has been re-implemented as a RESTful API.

The Platform Gateway API has integrations with the program service that connect to the original GRPC. We want to update this connection to use the new RESTful services.

Program Service Swagger: https://program-service.dev.argo.cancercollaboratory.org/swagger-ui/index.html

Platform API - ProgramService GRPC client: https://github.com/icgc-argo/platform-api/blob/develop/src/services/programService/grpcClient.js Platform API - ProgramService httpClient: https://github.com/icgc-argo/platform-api/blob/develop/src/services/programService/httpClient.js

The Platform UI uses the Gateway's GQL server to fetch program data. This interface can remain unchanged. What needs to be updated are the GQL resolvers. We need to update them to use the RESTful endpoints to retrieve the program data.

Platform API - ProgramService GQL resolvers: https://github.com/icgc-argo/platform-api/blob/develop/src/schemas/Program/index.js

Details

Each ticket in this epic will address a single query or resolver from the gql schema. In that ticket two steps will be necessary

  1. Create a function in the httpClient to interact with the ProgramService for the given action.
  2. Update the gql resolver to use the httpClient function from step 1 instead of the GRPC client.

One additional change will be the removal of the region property. There will be one ticket to remove this property from the GQL schema and remove the dedicated resolvers. A new epic will be opened following this one to replace the regions with a new DataCenter concept.

One final ticket will be added to remove the GRPC client code.

Query Resolvers

There are 3 which have a dedicated resolver. The ProgramOptions query has separate resolvers for each property of in the ProgramOptions type. Finally, the Program property users has a dedicated resolver.

  1. program(shortName: String!) Get Program by Short Name
  2. programs List all Programs
  3. getJoinProgramInvite(id: ID!) Get details about a program invite by invite ID

ProgramOptions Resolvers:

  1. ProgramOptions.cancerTypes List all cancer type options
  2. ProgramOptions.primarySites List all primary site options
  3. ProgramOptions.institutions List all institutions options
  4. ProgramOptions.countries List all country options

Promam.users resolver:

  1. Program.users(shortName: string) Get all users for a given program.

Mutation Resolvers

There are 6 mutations that each have dedicated resolvers and associated REST endpoints:

  1. createProgram(program: ProgramInput!) Given all the required inputs for a program, request the creation of a new program.
  2. updateProgram(shortName: String!, updates: UpdateProgramInput!) Update a program identified by shortName
  3. inviteUser(invite: InviteUserInput!) Create an invite to work as a contributor to a program
  4. joinProgram(join: JoinProgramInput!) Accept an invite to join a program
  5. updateUser(userEmail: String!, programShortName: String!, userRole: UserRole!) Make changes to an existing user invite
  6. removeUser(userEmail: String!, programShortName: String!) Remove user as a contributor to a program.