adonis-odm
Version:
A comprehensive MongoDB ODM for AdonisJS with Lucid-style API, type-safe relationships, embedded documents, and transaction support
22 lines (21 loc) • 489 B
JavaScript
/**
* Global model registry for relationship loading
*/
export class ModelRegistry {
static models = new Map();
static register(modelClass) {
this.models.set(modelClass.name, modelClass);
}
static get(modelName) {
return this.models.get(modelName);
}
static has(modelName) {
return this.models.has(modelName);
}
static clear() {
this.models.clear();
}
static getAll() {
return new Map(this.models);
}
}