example.controllers.list

Classes

ListController()

class example.controllers.list.ListController
static create(body)

Controller for POST endpoints. This method assigns a new object ID, sets the _created_ timestamp, evaluates user’s permissions, adds a default category_id if the model has this attribute, and inserts a row to the back-end database.

Parameters
  • body (dict) – resource fields as defined by openapi.yaml schema

  • id_prefix (str) – generated objects will be assigned a random 10- to 16-character ID; you can set a unique prefix if desired

  • limit_related (dict) – limits on number of related records, keyed by relationship name

Returns

first element is a dict with the id, second element is response code (201 on success)

Return type

tuple

static update(id, body)

Controller for PUT endpoints. This method looks for an existing record, evaluates user’s permissions, and updates the row in the back-end database.

Parameters
  • body (dict) – fields to be updated

  • access (str) – access-level required for RBAC evaluation

  • limit_related (dict) – limits on number of related records, indexed by relationship name

Returns

first element is a dict with the id, second element is response code (200 on success)

Return type

dict