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

💾 #1098 Add Program Data Center fields #717

Merged
merged 6 commits into from
Feb 21, 2024
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
9 changes: 4 additions & 5 deletions src/schemas/Program/gqlTypeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default gql`
primarySites: [String]!
institutions: [String]!
countries: [String]!
dataCenters: [DataCenter]!
}

type DataCenter {
Expand Down Expand Up @@ -127,12 +128,10 @@ export default gql`
website: String!
institutions: [String!]!
countries: [String!]!

dataCenter: String!
cancerTypes: [String]!
primarySites: [String]!

membershipType: MembershipType!

admins: [ProgramUserInput!]!
}

Expand All @@ -145,6 +144,7 @@ export default gql`
website: String
institutions: [String]
countries: [String]
dataCenter: String
cancerTypes: [String]
primarySites: [String]
membershipType: MembershipType
Expand All @@ -155,7 +155,6 @@ export default gql`
userFirstName: String!
userLastName: String!
userEmail: String!

userRole: UserRole!
}

Expand Down Expand Up @@ -203,7 +202,7 @@ export default gql`
Update Program
Returns shortName of the program if succesfully updated
"""
updateProgram(shortName: String!, dataCenterShortName: String, updates: UpdateProgramInput!): String
updateProgram(shortName: String!, updates: UpdateProgramInput!): String

"""
Invite a user to join a program
Expand Down
7 changes: 5 additions & 2 deletions src/schemas/Program/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ const resolvers = {
const response = await programService.listCountries(egoToken);
return response || null;
},
dataCenters: async (obj, args, context, info) => {
return resolvers.Query.dataCenters(obj, args, context, info) || null;
},
},
Program: {
users: async (program, args, context, info) => {
Expand Down Expand Up @@ -147,8 +150,8 @@ const resolvers = {
const updates = args.updates;

//make a request to get dataCenter data using dataCenterShortName (from query paramenter, updates) and format response
const dataCenterResponse = dataCenterShortName
? await programService.listDataCenters(dataCenterShortName, egoToken)
const dataCenterResponse = updates.dataCenter
? await programService.listDataCenters(updates.dataCenter, egoToken)
: undefined;

const dataCenter =
Expand Down
1 change: 1 addition & 0 deletions src/services/programService/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const formatCreateProgramInput = (programInput) => ({
institutions: programInput.institutions,
countries: programInput.countries,
},
dataCenterId: programInput.dataCenter,
admins: programInput.admins.map((admin) => ({
email: admin.email,
first_name: admin.firstName,
Expand Down