Skip to content
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

get searched orgs #202

Closed
jd2rogers2 opened this issue Aug 31, 2022 · 0 comments · Fixed by #229
Closed

get searched orgs #202

jd2rogers2 opened this issue Aug 31, 2022 · 0 comments · Fixed by #229
Assignees

Comments

@jd2rogers2
Copy link
Contributor

jd2rogers2 commented Aug 31, 2022

follow same pattern as server/src/assets/assets.controller.ts line ~40,41 (get endpoint)

create a new endpoint in organization controller that allows us to get a list of orgs and filters them based on some inputs (query params)
example url localhost:3001/api/organizations?name=my%20org

might need to replace findAll but without the query params (localhost:3001/api/organizations) it should still respond with all orgs
probs build a new DTO filterOrganizationsDto or something

use https://typeorm.io/find-options to decide on correct getter function to get data from organizationsRepository (db accessor)

curl command examples: #92

create some fake data to test with (cd server) npm run seed:drop
(where seed data comes from server/src/database/seeding/seed-data.ts)

Examples to look at:

This is a good example, but instead of having a getTransactionsDTO as a parameter, use something like orgName

@Get()
get(@Query() getTransactionsDto: GetTransactionsDto): Promise<Transaction[]> {
return this.transactionsService.getTransactions(getTransactionsDto);
}

AC:

  1. hits that endpoint with query params and only gets matching orgs
  2. hits that endpoint with no query params and gets all orgs
  3. don't need to worry about filtering on any other properties other than name for now
  4. (bonus) bad query params results in 400 error response
@jd2rogers2 jd2rogers2 assigned jd2rogers2 and unassigned JZenon13 Oct 24, 2022
@jd2rogers2 jd2rogers2 linked a pull request Oct 24, 2022 that will close this issue
@jd2rogers2 jd2rogers2 moved this to Done in 10/18 - 11/1 Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants