AmericaSCORESBayArea / salesforce-data-api

This project is based on Mulesoft Dataweave and Salesforce to provide secure, reliable, API access for all the Scores apps and projects. It is hosted on Anypoint and acts as the transactional hub, in concert with the authentication API
3 stars 1 forks source link

GET `/api/regions/active` #229

Open AleksandrMolchagin opened 3 months ago

AleksandrMolchagin commented 3 months ago

Description

Some regions in the enrollment flows are not active or valid and should not appear in any selector. We need a new endpoint to return only active regions.

Possible strategy

1) Retrieve all TeamSeasons 2) Filter TeamSeasons based on their start date (to determine whether they are active or not) 3) Get regions through the following relation Team_Season__r.Team__r.School_Site__r.Region__c

Endpoint: GET /api/regions/active

Response:


{
  ["Region 1", "Region 2", "Region 3"]
}

~~

AleksandrMolchagin commented 3 months ago

All active regions will be retrieved through the following query:

SELECT Id, Value, Label, DurableId, EntityParticleId, ValidFor, IsActive FROM PicklistValueInfo WHERE EntityParticle.EntityDefinition.QualifiedApiName = 'Account' AND EntityParticle.QualifiedApiName = 'Region__c' AND isActive = TRUE