backend/lib/seed/__loaders.ts
2025-05-14 21:45:16 +02:00

47 lines
1.6 KiB
TypeScript

import CategoryModel from '@services/module-cms/functions/categories/category.model';
import ListModel from '@services/module-cms/functions/lists/list.model';
import PageModel from '@services/module-cms/functions/pages/pages.model';
import AccountModel from '@src/accounts/account.model';
import DataLoader from 'dataloader';
import StreamEngineModel from './engine/utils/streams/stream.model';
import { buildEngineLoader, buildLoader } from './services/database/LoaderService';
import NotificationModel from './services/notifications/notifications.model';
/*
!!! Do not use, copy on parent only !
*/
const seedModelLoaders = {
'stream.changes': new StreamEngineModel(),
streams: new StreamEngineModel(),
notifications: new NotificationModel(),
accounts: new AccountModel(),
pages: new PageModel(),
};
class SeedLoaders {
/* CMS */
listLoader: DataLoader<string, ListModel, string>;
categoryLoader: DataLoader<string, CategoryModel, string>;
// tagsLoader: DataLoader<string, TagSchema, string>;
// answerLoader: DataLoader<string, AnswerEngineSchema, string>;
/* ACCOUNT */
accountLoader: DataLoader<string, AccountModel, string>;
public constructor() {
this.listLoader = buildLoader<ListModel>(new ListModel());
this.categoryLoader = buildLoader<CategoryModel>(new CategoryModel());
// this.tagsLoader = buildEngineLoader<TagModel, TagSchema>(new TagModel());
// this.answerLoader = buildEngineLoader<AnswerEngineModel, AnswerEngineSchema>(new AnswerEngineModel());
this.accountLoader = buildLoader<AccountModel>(new AccountModel());
}
}