Replies: 1 comment
-
Hey @Harry-Tom! There are a few ways you could approach this, depending on whether you want to modify the endpoint generation or just extend the database interactions: 1. Use a Custom
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I'm using this template for my project - for context, I'm an experienced C# dev, but relatively new to Python.
I'm trying to add more complex functionality to my app than basic CRUD operations - for example, with the standard boilerplate, imagine if you wanted to make it so that when the POST /{username}/post endpoint is called (calling the write_post function) that the post is written to the database as per the boilerplate, but that the system then calls an external API to ask the external API to check whether there's any posts in their data which have similar text.
Currently, I know that I could put this in the write_post function in posts.py, but my C# background is telling me that this should really be in a separate class (single responsibility principle!) - for example a post_service class. However, crud_posts would seem to currently fill the niche that post_service would set in the project, so I was wondering if there's an elegant way to extend the FastCRUD operations?
Beta Was this translation helpful? Give feedback.
All reactions