-
Notifications
You must be signed in to change notification settings - Fork 81
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
LF-4690 Create POST endpoint to create an Ensemble addon #3655
base: LF-4625-readability-refactors
Are you sure you want to change the base?
LF-4690 Create POST endpoint to create an Ensemble addon #3655
Conversation
… for readability Remove reduce in favour of more readable array methods; encapsulate all three Ensemble methods into one function; define a constant for 'Ensemble Scientific'
…adability Remove unused returned values from registerOrganizationWebhook; un-nest code run when function does not return early; add comments to make more explicit how bulkSensorClaim response is defined from Ensemble API response
…n via organization_uuid
const allRegisteredOrganizations = await getEnsembleOrganizations(access_token); | ||
|
||
const organization = allRegisteredOrganizations.find( | ||
({ uuid }) => uuid === organization_uuid, |
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.
This is where I would very much like to see a secondary check, maybe on email or farm name? But we would have to coordinate with Ensemble to make sure their organization registration included it.
import syncAsyncResponse from '../util/syncAsyncResponse.js'; | ||
import knex from '../util/knex.js'; | ||
|
||
const getSensorTranslations = async (language) => { |
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.
For some reason I am hesitant to just partially remove the CSV option haha. It mostly works but just doesn't meet ideal design and needs to be adapted for new fields maybe. I can't deny I am partial to leaving it in place for custom sensors 🥲
And maybe editing sensor controller right now won't be necessary if you agree that it is rest-ful to work on the /farm_external_integration
resource instead.
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.
I'll defer to @antsgar on the CSV upload; there will be no way to access it anymore from app is why I think it's okay to remove now, but you're right it's a partial removal as I only adjusted in this particular controller. That was just my understanding of the ticket requirements, but really there is a lot more code that can be deleted (from shared and webapp) if we are wiping CSV upload entirely. That deletion might be best in its own PR so even if we rebuild CSV addition from the ground up when we re-introduce it (which is what I believe we're going to do), we'll have just one place to look for all of the original code.
…rom Loic's screens
With the move towards the farm-wide "add-on" concept (and confirmation we're sticking with sending only organization_uuid), I'm now more inclined to let this be a POST to something like Otherwise I think "linking" and "unlinking" should l be the wording used now (to match the views) so I have made that change in the meantime. |
For now it will 400 if not Ensemble so we don't fill this table with records we can't use
This reverts commit 8503f81.
This controller was written to work on the current table. I'll draft it until the migration + models are merged and then update.
Description
This is the controller to link an Ensemble organization to a LiteFarm farm. You can send a different
integrating_partner_id
if you like but you'll get back a 400.I'll point the base branch to my refactor branch as I used the cleaned up controller code a bit.
Jira link: https://lite-farm.atlassian.net/browse/LF-4690
Type of change
How Has This Been Tested?
Link or update organization with a simple POST to
/sensor/associate_esci_org/
Request should be (you can use any org UUID registered to our Ensemble user, and the one below does work)
Checklist: