Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗺️ 662 Filter Programs by Region #704

Merged
merged 16 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/schemas/Clinical/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ const resolvers = {
) => {
const { Authorization } = context;

console.log('clinical errors');

const errorResponse: ClinicalErrors = await clinicalService.getClinicalErrors(
args.programShortName,
args.donorIds,
Expand Down
16 changes: 12 additions & 4 deletions src/schemas/Program/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { get, merge, pickBy } from 'lodash';

import customScalars from 'schemas/customScalars';
import programService from 'services/programService';
import { grpcToGql } from 'utils/grpcUtils';

const typeDefs = gql`
scalar DateTime
Expand Down Expand Up @@ -178,7 +177,7 @@ const typeDefs = gql`
"""
retrieve all Programs
"""
programs: [Program]
programs(dataCenter: String): [Program]

"""
retrieve join program invitation by id
Expand Down Expand Up @@ -352,10 +351,19 @@ const resolvers = {
: resolvePublicSingleProgram(shortName);
},

programs: async (obj, args, context, info) => {
programs: async (obj, args, context) => {
const { egoToken } = context;
return resolvePrivateProgramList(egoToken);
const { dataCenter } = args;

const programs = await resolvePrivateProgramList(egoToken);

const filteredPrograms = dataCenter
? programs.filter((program) => program.dataCenter?.shortName === dataCenter)
: programs;

return filteredPrograms;
},

joinProgramInvite: async (obj, args, context, info) => {
const { egoToken } = context;
const response = await programService.getJoinProgramInvite(egoToken, args.id);
Expand Down