Skip to content

Colum filter & db pre-processor functions #242

@Slluxx

Description

@Slluxx

Is your feature request related to a problem? Please describe.
I enjoy using FastCRUD. It works beautifully for my admin-apis but it seemingly falls short when trying to use with restricted user apis.

For example: I have a table for "items" and and item is linked to a user by their id. Now, i dont want anyone to be able to submit a userid from the frontend (as to prevent creating items on other users behalf). So my thought was to use dependencies to check the http-only cookie, get the database user from it and modify the "item" to have (or set) the correct userid. It appears that dependencies can not modify what has been send though. (some sort of database-pre-processing)

Another thing would be to only grab items that belong to the currenctly logged in user. (some sort of column filter)

I saw that i can implement something like that (with FastCRUD) but its so much extra code that i feel like its not worth to use it and simply go the traditional route, which also cant be the solution.

Describe the solution you'd like
A way to modify data directly before its written to the database (as to not mess wth schemas) & a way to simplify user-tailored apis with column filters. Both could be smilar to the "dependencies". A MITM function basically.

Describe alternatives you've considered
I dont know of any alternatives.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions