@apex-pub/convector-core-model
TypeScript icon, indicating that this package has built-in type declarations

1.4.1-2.0 • Public • Published

Convector Model

This module contains the base model to be used as a base for any other model.

Usage

The children classes can be used in 1 of 3 ways:

As an model query

class MyModel extends ConvectorModel<MyModel> { ... }

const model = new MyModel(id);
model.fetch()
  .then(onModelFound)
  .catch(onModelNotFound);

As a param constructor and validator

class MyModel extends ConvectorModel<MyModel> { /* ... */ }

@Controller('my-controller')
class MyController {
  @Invokable()
  public async myMethod(
    @Param(MyModel)
    myModel: MyModel
  ) {
    myModel.save();
  }
}

As a container to start filling the model

class MyModel extends ConvectorModel<MyModel> { /* ... */ }

const myModel = new MyModel();
myModel.name = 'name';
myModel.info = 'info';
/* ... */
myModel.save();

/@apex-pub/convector-core-model/

    Package Sidebar

    Install

    npm i @apex-pub/convector-core-model

    Weekly Downloads

    66

    Version

    1.4.1-2.0

    License

    Apache-2.0

    Unpacked Size

    40 kB

    Total Files

    21

    Last publish

    Collaborators

    • akshaysood112
    • rodolfoleal