igorbenav / fastcrud

FastCRUD is a Python package for FastAPI, offering robust async CRUD operations and flexible endpoint creation utilities.
MIT License
693 stars 59 forks source link

Queries regarding `UpdateSchemaInternalType` & `DeleteSchemaType` #146

Open jd-solanki opened 3 months ago

jd-solanki commented 3 months ago

Describe the bug or question Hi πŸ‘‹πŸ»

First of all great library. I wanted to create something like this and it already exist πŸ˜…

I already have similar approach in my previous project but as you also provide great filtering & sorting out of the box I would like to give it a try.

Question: I was migrating from my own CRUD to FastCRUD and realized there's two new schemas UpdateSchemaInternalType & DeleteSchemaType. I wanted to know why those two exist?

To Reproduce n/a

Description above

Screenshots n/a

Additional context How's your plan for improving types for filtering because after reading docs it looks like FilterConfig is not type safe πŸ€”

igorbenav commented 3 months ago

Hey, @jd-solanki, nice to know you like it!

Some of it is because of how FastCRUD evolved, it started inside of fastapi boilerplate, back when it was still a CRUDBase, and the idea of an internal update schema came from this:

class UserUpdateInternal(UserUpdate):
    updated_at: datetime

Theoretically, if you passed an UpdateInternalType, the updated_at column should be modified.

The point of the DeleteSchema is the same, but it kind of evolved from if passing a DeleteSchema to if has an is_deleted attribute.

So basically, you may open a PR or discussion about removing this things and we can discuss it.

igorbenav commented 3 months ago

How's your plan for improving types for filtering because after reading docs it looks like FilterConfig is not type safe πŸ€”

About this, we are basically fixing things as they come (specially if they are more urgent). Since at the moment more is coming up than we can fix, not a lot of future planning going on.

You can always open PRs fixing stuff though, we'll be really happy