Skip to content

[Discussion] CRUD system vs Model #187

@sheoak

Description

@sheoak

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions