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

Implement Article Model, Schemas, and Decorators #5

Open
5 tasks done
Tracked by #7
bryanwong8 opened this issue May 9, 2020 · 0 comments
Open
5 tasks done
Tracked by #7

Implement Article Model, Schemas, and Decorators #5

bryanwong8 opened this issue May 9, 2020 · 0 comments
Assignees
Labels
backend backend feature staging This issues is in the staging branch
Milestone

Comments

@bryanwong8
Copy link
Contributor

bryanwong8 commented May 9, 2020

Is your feature request related to a problem? Please describe.
Need to create Article Schemas for serialization and validation. Also need to create decorators to not allow users to access a non-existing Article.

Describe the solution you'd like
Create Decorators and Schemas for Article.

Routes/functions to implement/change

  • Create the article_exists decorator
  • Create the ArticleFormSchema, ArticleSchema and ArticlesSchema.

Additional context

  • Create the Article model in models.py with the following fields:
  • title: text (nullable=False)
  • cover_image: text (nullable=True)
  • content: text (nullable=False)
  • date_published: Date (nullable=False)
  • likes: int (nullable=False, default=0)
  • is_published (nullable=False)
  • The article_exists decorator should take the query id from the route and query for the Article. If the Article exists return the args and kwargs. If not return a 404 message saying that "Article does not exist".
  • Create the ArticleFormSchema class to contain the following fields:
  • title (required)
  • cover_image (not required)
  • content (not required)
  • Create the ArticleSchema that has the following fields:
    • id
  • You can create the ArticlesSchema by using the ArticleSchema, but set it to return many models instead.
@bryanwong8 bryanwong8 added this to the Week 1 milestone May 9, 2020
@bryanwong8 bryanwong8 added the backend backend feature label May 11, 2020
@anuragunni anuragunni mentioned this issue May 16, 2020
2 tasks
@anuragunni anuragunni linked a pull request May 16, 2020 that will close this issue
2 tasks
@bryanwong8 bryanwong8 reopened this May 17, 2020
@bryanwong8 bryanwong8 added the staging This issues is in the staging branch label May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend backend feature staging This issues is in the staging branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants