I am currently working on a backend based on this repository.
I was wondering why the design choice of the "CRUD" classes as independant entities.
I was thinking about creating a base model for User model (and others, later) and put all the CRUD logic in it, without the need to pass the db every time. It would also remove the need for all the crud-related files.
For example:
from app.model.user import User
new_user = User.create(obj_in)
u = User.get_by_email("joe@domain.com")
compare to :
from app import crud
new_user = crud.user.create(db, obj_in=user_in)
u = crud.user.get_by_email(db, email=email)
Any thought on that?
I am currently working on a backend based on this repository.
I was wondering why the design choice of the "CRUD" classes as independant entities.
I was thinking about creating a base model for User model (and others, later) and put all the CRUD logic in it, without the need to pass the db every time. It would also remove the need for all the crud-related files.
For example:
compare to :
Any thought on that?