-
Notifications
You must be signed in to change notification settings - Fork 300
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
Endpoint para cruzar excedente e doações necessárias entre abrigos #74
Open
cesarpastorini
wants to merge
2
commits into
SOS-RS:develop
Choose a base branch
from
cesarpastorini:feat/match-oferta-demanda
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Endpoint para cruzar excedente e doações necessárias entre abrigos #74
cesarpastorini
wants to merge
2
commits into
SOS-RS:develop
from
cesarpastorini:feat/match-oferta-demanda
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: "Felipe Izaguirre" <[email protected]>
cesarpastorini
changed the title
Endpoint para cruzar excedente de doações entre abrigos que têm sobrando e faltando
Endpoint para cruzar excedente e doações necessárias entre abrigos
May 12, 2024
Co-authored-by: "Felipe Izaguirre" <[email protected]>
O endpoint suporta os parâmetros Exemplos usando último commit: Filtrando por matches de um determinado abrigo com excedentescurl -s 'http://localhost:4000/supplies/surplus-demand-matches?shelterIdSurplus=0cbf3209-453d-40c6-85ee-060b8a8ae9cb' | jq | head -n 28
{
"statusCode": 200,
"message": "Successfully got matches between surplus and demand",
"data": [
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "0cbf3209-453d-40c6-85ee-060b8a8ae9cb",
"shelter_from_name": "Ipa - Centro Universitário Metodista",
"shelter_to_id": "bef1fe53-bf7e-4f4f-89f7-d515074e028c",
"shelter_to_name": "Usina do Gasômetro"
},
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "0cbf3209-453d-40c6-85ee-060b8a8ae9cb",
"shelter_from_name": "Ipa - Centro Universitário Metodista",
"shelter_to_id": "c0ee062d-9de5-49b5-bc22-f274a52b039e",
"shelter_to_name": "RUs UFRGS"
},
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "0cbf3209-453d-40c6-85ee-060b8a8ae9cb",
"shelter_from_name": "Ipa - Centro Universitário Metodista",
"shelter_to_id": "38050655-12ed-4698-bce2-59089feb4d61",
"shelter_to_name": "Recomeçar"
}, Filtrando por matches de um determinado abrigo com itens em faltacurl -s 'http://localhost:4000/supplies/surplus-demand-matches?shelterIdNeeded=685d0226-062b-4b77-a2df-c7c05a637856' | jq | head -n 28
{
"statusCode": 200,
"message": "Successfully got matches between surplus and demand",
"data": [
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "97ef5b90-6f9b-4adb-bd07-086e7330b745",
"shelter_from_name": "Nexos Ibn Church",
"shelter_to_id": "685d0226-062b-4b77-a2df-c7c05a637856",
"shelter_to_name": "Ctg Estância Do Rubem Berta"
},
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "0cbf3209-453d-40c6-85ee-060b8a8ae9cb",
"shelter_from_name": "Ipa - Centro Universitário Metodista",
"shelter_to_id": "685d0226-062b-4b77-a2df-c7c05a637856",
"shelter_to_name": "Ctg Estância Do Rubem Berta"
},
{
"supply_id": "524ad35e-7967-4ebf-96d8-cdf0f56d1e81",
"supply_name": "Sabonetes",
"shelter_from_id": "5577f295-484a-41bf-8b11-5848f060ee9e",
"shelter_from_name": "Igreja Deus É Amor",
"shelter_to_id": "685d0226-062b-4b77-a2df-c7c05a637856",
"shelter_to_name": "Ctg Estância Do Rubem Berta"
}, Matches especificando o abrigo com excedentes e o abrigo com necessidades$ curl -s 'http://localhost:4000/supplies/surplus-demand-matches?shelterIdSurplus=c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d&shelterIdNeeded=5daec969-8869-4121-bafc-1425731e6487' | jq
{
"statusCode": 200,
"message": "Successfully got matches between surplus and demand",
"data": [
{
"supply_id": "e87c2f41-f417-4ee0-b818-9adfe7c790e9",
"supply_name": "Colchões",
"shelter_from_id": "c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d",
"shelter_from_name": "Estádio Olímpico Monumental",
"shelter_to_id": "5daec969-8869-4121-bafc-1425731e6487",
"shelter_to_name": "Cremers"
},
{
"supply_id": "b9368d94-0425-4b23-ada4-66f8986f7368",
"supply_name": "Água",
"shelter_from_id": "c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d",
"shelter_from_name": "Estádio Olímpico Monumental",
"shelter_to_id": "5daec969-8869-4121-bafc-1425731e6487",
"shelter_to_name": "Cremers"
}
]
} Filtrando por item# NOTE: Há outros supply_id para o item "água"
curl -s 'http://localhost:4000/supplies/surplus-demand-matches?supplyId=b9368d94-0425-4b23-ada4-66f8986f7368' | jq | head -n 28
{
"statusCode": 200,
"message": "Successfully got matches between surplus and demand",
"data": [
{
"supply_id": "b9368d94-0425-4b23-ada4-66f8986f7368",
"supply_name": "Água",
"shelter_from_id": "c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d",
"shelter_from_name": "Estádio Olímpico Monumental",
"shelter_to_id": "911c231d-a09d-4b3e-b199-78854be2cb58",
"shelter_to_name": "Templo Das Nações - Santa Maria"
},
{
"supply_id": "b9368d94-0425-4b23-ada4-66f8986f7368",
"supply_name": "Água",
"shelter_from_id": "c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d",
"shelter_from_name": "Estádio Olímpico Monumental",
"shelter_to_id": "64c872b6-3e46-43a8-a705-6db3289b3fae",
"shelter_to_name": "Projeto Surfar"
},
{
"supply_id": "b9368d94-0425-4b23-ada4-66f8986f7368",
"supply_name": "Água",
"shelter_from_id": "c07ad79d-51ec-4b06-aeeb-2bc5492e5b7d",
"shelter_from_name": "Estádio Olímpico Monumental",
"shelter_to_id": "573f4bb7-cf57-484b-a95a-d8829c1f406a",
"shelter_to_name": "PetMedic Poa"
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 base de dados do sistema possui as informações de excedente e demanda de doações por abrigo. Tendo isso, podemos utilizar essas informações para combinar os abrigos que possuem itens em excedente com os que demandam os mesmos, auxiliando assim no esforço de troca de itens entre abrigos.
Esta PR introduz um novo endpoint no backend,
GET supplies/surplus-demand-matches
, que retorna a combinação dos abrigos com itens em excedente com os que demandam. Internamente, a combinação é feita através de uma consulta na base de dados.Exemplo de uso:
Exemplo usando um
supplyId
: