Modules API

Study modules are top-level containers (e.g. “Linear Algebra”) that hold documents.

Endpoints

GET /api/modules/

Returns all study modules.

POST /api/modules/

Create a new module.

Request body:

{
  "name": "Linear Algebra",
  "description": "Math semester 2",
  "color": "#4a90d9"
}

GET /api/modules/{id}

Returns a single module by ID.

PUT /api/modules/{id}

Update a module.

DELETE /api/modules/{id}

Delete a module and all associated documents (cascade).

Source Code

class backend.api.modules.ModuleCreate(*, name: str, description: str | None = '', color: str | None = '#4a90d9')[source]
model_computed_fields = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields = {'color': FieldInfo(annotation=Union[str, NoneType], required=False, default='#4a90d9'), 'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=''), 'name': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class backend.api.modules.ModuleUpdate(*, name: str | None = None, description: str | None = None, color: str | None = None)[source]
model_computed_fields = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields = {'color': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'name': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

backend.api.modules.toggle_pin_module(module_id: int, db: Session = Depends(get_db))[source]

Pin-Status eines Moduls umschalten.