This is such a cool package, but I ended up not using it because I wanted my API to look like this. I thought I would just leave it as a suggestion.
Suppose I have this in sqlalchemy:
import sqlalchemy as sa
class Account(Base):
__tablename__ = "account"
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
class BlogPost(Base):
__tablename__ = "blog_post"
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
account_id = sa.Column(sa.Integer, sa.ForeignKey("account.id"), nullable=False)
class BlogComment(Base)
__tablename__ = "blog_comment"
id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
blog_id = sa.Column(sa.Integer, sa.ForeignKey("blog_post.id"), nullable=False)
I might want routes like this:
GET /account/<account_id>/post/
{ list of blog posts by the author }
POST /account/<account_id>/post/
# creates a new blog post for the author
GET /post/<post_id>/comment
{ list of comments on the blog post }
GET /account<account_id>/post/<post_id>/comment
{ list of comments on the blog post - not sure how this is compared to the one above }
Hi aebrahim, Thanks so much for your contribution and suggestion, the suggestion is great. I will plan to enhance the package with your suggestion. And will update here
This is such a cool package, but I ended up not using it because I wanted my API to look like this. I thought I would just leave it as a suggestion.
Suppose I have this in sqlalchemy:
I might want routes like this:
Anyways, just a thought!