refactor: implement workaround for id replacement queries #74
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A lot of queries in the API require the project ID, not the name. This is a work around to implement queries that support the name as an input instead of the ID by doing a
veryMinimalProjectByName
request before performing the actual query/mutation.Previously the lagoon-cli would do a
minimalProjectByName
query before some requests to get the project ID without the user having to remember it, but this requests theopenshift
ID which organization owners currently can't see, so rather than break the query in machinery, this implements a new lightweightveryMinimalProjectByName
which is internal to machinery only.Ideally, the API would get updated to have
name
in requests instead ofid
, but this way when the API eventually does support it, these new functions can just be refactored to use the updated API instead of doing theveryMinimalProjectByName
request first. The organization owner/admin role should also be updated to be able to view whichopenshift
a project is configured to use, but again that would take time to implement, where machinery is quicker for now.