-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
backendbackend featurebackend featurestagingThis issues is in the staging branchThis issues is in the staging branch
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
backendbackend featurebackend featurestagingThis issues is in the staging branchThis issues is in the staging branch