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

Practice App: Feature- Search by tag API #107

Closed
7 tasks done
BElifb opened this issue May 15, 2022 · 7 comments
Closed
7 tasks done

Practice App: Feature- Search by tag API #107

BElifb opened this issue May 15, 2022 · 7 comments
Assignees
Labels
Coding The issue is related with coding Effort: High Handling this issue might take longer Practice App related to the practice app Priority: High This issue must be handled immediately Status: Review Needed A review is needed for this issue

Comments

@BElifb
Copy link
Contributor

BElifb commented May 15, 2022

What's up?

As discussed in meeting notes #14 I will create the API for search by tag. Given a tag name this API will return a list of all of the art items tagged with that tag (in json format).

API endpoint API Method API Description
api/searchbytag/<str:tag> GET Return all of the art items with the given tag name

To Do

  • Create new branch feature/search_by_tag off of practice_app.
  • Add the URL for the endpoint.
  • Create the corresponding view.
  • Use api decorators.
  • Write unittests for the API.
  • Test them out.
  • Create Pull request and assign to @KarahanS as reviewer as stated in meeting notes #14

Deadline

Creation: 15.05.2022 @21.00
Testing: 17.05.2022 @21.00
Review: 18.05.2022 @21.00

Additional Information

No response

Reviewers

@KarahanS

@BElifb BElifb added Effort: High Handling this issue might take longer Priority: High This issue must be handled immediately Status: In Progress The issue is being handled. Coding The issue is related with coding Practice App related to the practice app labels May 15, 2022
@BElifb BElifb self-assigned this May 15, 2022
@BElifb
Copy link
Contributor Author

BElifb commented May 15, 2022

  • url works with the name of the tag not the id. If you're having trouble with tag names make sure it is encoded in the url format. Such as # -> %23. For reference https://www.w3schools.com/tags/ref_urlencode.asp
  • Added urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'html']) to urls.py in order to give us the option to choose between default Response template and regular json
  • Extend the url with <?format=json> to get json
  • If you're having any trouble with your views make sure you added format=None to the arguments

@BElifb
Copy link
Contributor Author

BElifb commented May 16, 2022

  • Added tests folder to api.
  • Created unit tests for search_by_tag.
  • Ran the test.
  • Created fake data for the test.
  • Test compares the result status and the data to make sure they are equal as expected.
  • Use py manage.py test api to run the test.

@BElifb
Copy link
Contributor Author

BElifb commented May 16, 2022

  • Implemented a frontend page, to get the requested tag name with user interface. Please refer to #111

@BElifb
Copy link
Contributor Author

BElifb commented May 16, 2022

  • Created pull request #114

@BElifb BElifb added Status: Review Needed A review is needed for this issue and removed Status: In Progress The issue is being handled. labels May 16, 2022
@KarahanS
Copy link
Contributor

With PR #128, another tag related functionality is added: api/v1/searchbytagkeyword/<str:tag>.
It's inspired by the API endpoint given above. It returns all of the art items including the given keyword.

@BElifb
Copy link
Contributor Author

BElifb commented May 19, 2022

  • Changed/added some error messages for the API.
  • In accordance with that added some more tests and ran them.
  • Related commit here.

@KarahanS
Copy link
Contributor

Practice App Implementation is over. No action is taken, closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Coding The issue is related with coding Effort: High Handling this issue might take longer Practice App related to the practice app Priority: High This issue must be handled immediately Status: Review Needed A review is needed for this issue
Projects
None yet
Development

No branches or pull requests

2 participants