Skip to content

Conversation

@hnchuong
Copy link

@hnchuong hnchuong commented Oct 31, 2022

Overview

Please write the overview about this PR.

What's in this PR:

0. Authentication

  • Even though authentication, I've configured DoorKeeper to enable sign-in/sign-out at:
    • /oauth/token
    • /oauth/revoke

The authentication will be needed in some actions, like Rating, List Recipes...

  • I've also added seed data with 1 web application in oauth_applications and 2 users;
  • Parameters to used for signing in: beside email and password, one would also need:
    • client_id, client_secrete, which are uid, secrete in oauth_applications
    • grant_type = 'password'

1. Search recipes: /api/recipes has been updated to have filter/search feature

Note about filter by time range:

  • To efficiently query by time range, I assumed the data saved into recipes#time field is in format: hh:mm:ss
  • A rough implementation of Recipe#time_string=(st) and Recipe#time_string to set/get string format of time field
  • time param can be a little flexible in format, e.g.:
    • 1 hour 30 mins
    • 1hour 30mins
    • 2 hours
    • 45mins
    • ...

2. Weight converter: GET /api/converters/convert

  • I'm not sure I understand the requirement correctly, but this converter is implemented as fixed, regardless ingredient.

  • It requires 3 parameters:

    • from_unit
    • from_amount
    • to_unit
      e.g /api/converters/convert?from_unit=cup&to_unit=gram&from_amount=5
  • In my opinion, converter should be dependent on ingredient. (A cup of water and a cup of sugar will be corresponding to different number of grams

BTW, I also think an ingredient should have a name

3. Rating: APIs for this feature require authentication (Bear)

  • APIs are provided to allow a user to
    • rate/update rating (from 1-5) on a recipe
    • view rating list of a particular recipe

@hnchuong hnchuong marked this pull request as ready for review October 31, 2022 05:41
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 this pull request may close these issues.

1 participant