Skip to content

Mixins #278

@mnboos

Description

@mnboos

Hi @eadwinCode

In order to create a company-internal solution for #271, I created API mixins (similar to those from DRF), that can be used to quickly create standard CRUD APIs like this:

# retrieve only
@api_controller("klienten", tags=["Klient"])
class KlientController(MixinModelControllerBase, RetrieveModelMixin, ListModelMixin):
    model_class = Klient

# all CRUD operations, manual schemas
@api_controller("eingliederungsfachpersonen", tags=["Eingliederungsfachperson"])
class EingliederungsfachpersonController(MixinModelControllerBase, CRUDModelMixin):
    model_class = Eingliederungsfachperson
    output_schema = EingliederungsfachpersonSchemaOutput
    input_schema = EingliederungsfachpersonSchemaInput

It also supports choice-models.

Would you be interested in a PR? If not, no problem and no bad feelings. 😁

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions