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

receipt form api endpoints #128

Closed
sunb26 opened this issue Mar 21, 2024 · 6 comments · Fixed by #258
Closed

receipt form api endpoints #128

sunb26 opened this issue Mar 21, 2024 · 6 comments · Fixed by #258
Assignees

Comments

@sunb26
Copy link
Owner

sunb26 commented Mar 21, 2024

Receipts (Expenses)

  1. Save image capture
  2. Save inference result
  3. Create new snapshot(s)

@Zack-Ren please add more endpoints if I missed any or new ones come up!

@sunb26 sunb26 self-assigned this Mar 21, 2024
@zackxzr
Copy link
Collaborator

zackxzr commented Mar 25, 2024

[POST] /get-receipts/{userId}?limit=X&offset=Y
(We can also use request body instead of query string)

  • returns list of receipts associated with userId

@Lev1ty
Copy link
Collaborator

Lev1ty commented Mar 25, 2024

what about the following instead?

GET /users/{userId}/receipts?limit=X&offset=Y

@zackxzr
Copy link
Collaborator

zackxzr commented Mar 25, 2024

Yeah that works, I like that.

@sunb26
Copy link
Owner Author

sunb26 commented Apr 8, 2024

@Lev1ty What is the reason for switching to query string params instead of keeping everything in the request body? All of the other endpoints at this point have been part of the request body so I'm thinking we keep it consistent if possible.

@Lev1ty
Copy link
Collaborator

Lev1ty commented Apr 8, 2024

  1. GET requests do not have bodies
  2. GET are more amenable to caching
  3. POST does not make sense semantically as the HTTP verb here, since we are not going with rpc-json
  4. limit and offset are typical query params and this pattern is common, though a more performant alternative is using a pagination token, as offset is always a linear scan on DB whereas can retrieve page token (an id in the db) if it is indexed in log complexity @Zack-Ren

@zackxzr
Copy link
Collaborator

zackxzr commented Apr 8, 2024

If we want to include a searching feature where we can filter by a search parameter and query, we could use POST and pass the search parameters in the body. For now, what @Lev1ty mentioned in 4 above is sufficient imo.

@sunb26 sunb26 linked a pull request May 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants