Interface Transformable<MyModel, MyView, MyBody>

transform model to view, or body to model.

  • required the sub-class model of CoreModel

See

CoreModel

Type Parameters

  • MyModel extends Model

  • MyView extends View

  • MyBody extends Body

Hierarchy

  • Transformable

Implemented by

Properties

bodyToModel: ((body: MyBody, isCreate?: boolean) => MyModel)

Type declaration

    • (body: MyBody, isCreate?: boolean): MyModel
    • transform request-body to model.

      • must check data types

      Parameters

      • body: MyBody

        the body posted

      • Optional isCreate: boolean

        (optional) if body is for creation.

      Returns MyModel

modelAsView: ((model: MyModel, hasCores?: boolean) => MyView)

Type declaration

    • (model: MyModel, hasCores?: boolean): MyView
    • transform model to view

      • result will be response json.

      Parameters

      • model: MyModel

        the data model.

      • Optional hasCores: boolean

        (optional) include the properties in CoreModel as $

      Returns MyView

Generated using TypeDoc