TModel

import { TModel } from '@appt/mongoose';

This Special-Type Extender add the Mongoose Model behaviour to our component. That means once imported by another component (or even inside the model), any mongoose/mongo query method can be accessed into the class context. After define the type as a TModel component, the mongoose model expect to has a mongoose schema as first param. You also can add any configuration allowed for a mongoose models by passing them as second param.

import { Component } from '@appt/core';
import { TModel } from '@appt/mongoose';
@Component({
extend: TModel('AppShema')
})
export class MyModel {
constructor()
{
}
static getById(_id){
return this.findOne({ _id: _id });
}
}