-
Notifications
You must be signed in to change notification settings - Fork 0
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
#1031 Submission GQL Small Data Fetch #1060
Changes from all commits
7a7ea64
037bd55
3e20883
bbed438
0e6ce8a
07024f5
1dd4f7c
67ceec9
a603f09
7b08b56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,26 +22,24 @@ import { loggerFor } from '../../logger'; | |
|
||
const L = loggerFor(__filename); | ||
|
||
const clearClinicalRegistrationMutation = { | ||
clearClinicalRegistration: async ( | ||
obj: unknown, | ||
args: { | ||
shortName: string; | ||
registrationId: string; | ||
}, | ||
) => { | ||
const { shortName, registrationId } = args; | ||
return await operations | ||
.deleteRegistration(registrationId, shortName) | ||
.then(() => { | ||
L.info(`Deleted registrationId ${registrationId}`); | ||
return true; | ||
}) | ||
.catch(err => { | ||
L.error(`Failed to delete registration`, err); | ||
return false; | ||
}); | ||
const clearClinicalRegistration = async ( | ||
obj: unknown, | ||
args: { | ||
shortName: string; | ||
registrationId: string; | ||
}, | ||
) => { | ||
const { shortName, registrationId } = args; | ||
return await operations | ||
.deleteRegistration(registrationId, shortName) | ||
.then(() => { | ||
L.info(`Deleted registrationId ${registrationId}`); | ||
return true; | ||
}) | ||
.catch(err => { | ||
L.error(`Failed to delete registration`, err); | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice logging thumbs up emoticon |
||
}); | ||
}; | ||
|
||
export default clearClinicalRegistrationMutation; | ||
export default clearClinicalRegistration; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,23 +21,21 @@ import { GlobalGqlContext } from '../../app'; | |
import submissionAPI from '../../submission/submission-api'; | ||
import { convertClinicalSubmissionDataToGql } from '../utils'; | ||
|
||
const clearClinicalSubmissionResolver = { | ||
clearClinicalSubmission: async ( | ||
obj: unknown, | ||
args: { programShortName: string; fileType: string; version: string }, | ||
contextValue: any, | ||
) => { | ||
const { programShortName, fileType, version } = args; | ||
const response = await submissionAPI.clearFileDataFromActiveSubmission( | ||
programShortName, | ||
fileType || 'all', | ||
version, | ||
(<GlobalGqlContext>contextValue).egoToken, | ||
); | ||
return convertClinicalSubmissionDataToGql(programShortName, { | ||
submission: response, | ||
}); | ||
}, | ||
const clearClinicalSubmission = async ( | ||
obj: unknown, | ||
args: { programShortName: string; fileType: string; version: string }, | ||
contextValue: any, | ||
) => { | ||
const { programShortName, fileType, version } = args; | ||
const response = await submissionAPI.clearFileDataFromActiveSubmission( | ||
programShortName, | ||
fileType || 'all', | ||
version, | ||
(<GlobalGqlContext>contextValue).egoToken, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unclear why this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
); | ||
return convertClinicalSubmissionDataToGql(programShortName, { | ||
submission: response, | ||
}); | ||
}; | ||
|
||
export default clearClinicalSubmissionResolver; | ||
export default clearClinicalSubmission; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,21 @@ const typeDefs = gql` | |
Retrieve current stored Clinical Submission data for a program | ||
""" | ||
clinicalSubmissions(programShortName: String!): ClinicalSubmissionData! | ||
|
||
""" | ||
Retrieve current stored Clinical Submission Data Dictionary Schema version | ||
""" | ||
clinicalSubmissionSchemaVersion: String! | ||
|
||
""" | ||
Retrieve current Clinical Submission disabled state for both sample_registration and clinical entity files | ||
""" | ||
clinicalSubmissionSystemDisabled: Boolean! | ||
|
||
""" | ||
Retrieve current stored Clinical Submission Types list | ||
""" | ||
clinicalSubmissionTypesList(includeFields: String): [SchemaList]! | ||
} | ||
|
||
type Mutation { | ||
|
@@ -339,6 +354,8 @@ const typeDefs = gql` | |
oldValue: String! | ||
donorId: String! | ||
} | ||
|
||
scalar SchemaList | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This scalar is a workaround for the issue in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you link me to more on this please? I don't understand and my gut is telling me that unions should be ok with primitives. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They aren't: https://www.apollographql.com/docs/apollo-server/schema/unions-interfaces/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to sleep on it and review in the morning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good - let me know where the union is happening tomorrow please - I read the docs + github - very interesting - looks like unions don't work on scalars either
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh so this Union is related to getSchemasWithFields: #1060 (comment) |
||
`; | ||
|
||
export default typeDefs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this logic the same apart from the instance method call?
could be little more DRY. not sure which is the async call so not sure where to put await..something roughly likee..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I had a feeling this could be improved. But, we don't want to map
getSchemasWithFields()
, we need to return the objects with both names + fields, soschemaNameFilter
needs to be called differently depending on value of withFields: 67ceec9