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

Create tags route #197

Merged
merged 5 commits into from
Nov 17, 2023
Merged

Create tags route #197

merged 5 commits into from
Nov 17, 2023

Conversation

carolynzhang18
Copy link
Contributor

@carolynzhang18 carolynzhang18 commented Nov 9, 2023

Notion task link

Create tags route

Implementation description

  • Updated tags model to add a unique constraint to name
  • Added create route
  • Modified update route to catch non-unique name error

Steps to test

  1. Upgrade database with latest migration: bash ./scripts/flask-db-upgrade.sh
  2. In order to test these routes with Postman, first comment out @require_authorization_by_role({"Admin"})
on lines 47 and 71 of backend/app/rest/tags_routes.py.
  3. Create: Create a tag by POSTing to /tags/ (e.g. {"name": “Cool Tag”, "status": "Active”}). This should show up in your database. Try creating another tag with the same name - you should get an error telling you that name already exists.
  4. Update: Update tag by id by PUTing to /tags/[id] an updated tag (e.g. {"name": “Epic Tag”, "status": "Active”}). Database should show modified tag. Try updating a different tag to have the same name - you should get an error telling you that name already exists. Also try updating a non-existent id - you should get an error telling you that id was not found.

What should reviewers focus on?

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR
  • If I have made API changes, I have updated the REST API Docs
  • IF I have made changes to the db/models, I have updated the Data Models Page
  • I have documented this PR in the Production Release Page
  • I have updated other Docs as needed

Copy link

github-actions bot commented Nov 9, 2023

Visit the preview URL for this PR (updated for commit dc577f7):

https://blueprintsupportivehousing--pr197-carolyn-create-tags-vahgersg.web.app

(expires Fri, 24 Nov 2023 21:53:44 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f6bcdba7452bf82a6ec1a299c37d1bdff7870d09

Copy link
Collaborator

@connor-bechthold connor-bechthold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMMMMM, using the DB to handle the duplication logic is so much nicer, great work on getting that to work!! 👨‍🍳

Copy link
Contributor

@braydonwang braydonwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested creating and updating duplicate tags on postman and they both returned errors as expected

@carolynzhang18 carolynzhang18 merged commit f912d50 into main Nov 17, 2023
@carolynzhang18 carolynzhang18 deleted the carolyn/create-tags-route branch November 17, 2023 21:52
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.

3 participants