@smallprod/models
Version:
44 lines (36 loc) • 717 B
text/typescript
import {
AutoCreateNUpdate,
AutoIncrement,
BigInt,
Entity,
EntityManager,
Id,
OneToMany,
PrimaryKey,
Table,
Unique,
Varchar,
} from '@smallprod/models';
import ArticleEntity from './article.entity';
export default class CategoryEntity extends Entity {
private id = 0;
private label: string;
private articles: ArticleEntity[] = [];
constructor(label: string) {
super();
this.label = label;
}
public fetchArticles = async () => {
return await this.fetch('articles');
};
}
EntityManager.registerEntity(CategoryEntity);