adminizer 4.4.0-build.147 → 4.4.0-build.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,7 @@ import { AbstractAdapter, AbstractModel } from "../AbstractModel.js";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import { pathToFileURL } from "url";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
6
7
|
function generateAssociationsFromSchema(models, schemas) {
|
|
7
8
|
for (const modelName in schemas) {
|
|
8
9
|
const schema = schemas[modelName];
|
|
@@ -556,12 +557,14 @@ export class SequelizeAdapter extends AbstractAdapter {
|
|
|
556
557
|
}
|
|
557
558
|
/** Registration of system models */
|
|
558
559
|
static async registerSystemModels(sequelize, alter = true) {
|
|
560
|
+
// Get current file directory from import.meta.url
|
|
561
|
+
const currentDir = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : process.cwd();
|
|
559
562
|
// Try multiple possible model locations
|
|
560
563
|
const possiblePaths = [
|
|
561
|
-
path.resolve(
|
|
562
|
-
path.resolve(
|
|
563
|
-
path.resolve(
|
|
564
|
-
path.resolve(
|
|
564
|
+
path.resolve(currentDir, "../../../../models"),
|
|
565
|
+
path.resolve(currentDir, "../../../../src/models"),
|
|
566
|
+
path.resolve(currentDir, "../../../models"),
|
|
567
|
+
path.resolve(currentDir, "../../../src/models"),
|
|
565
568
|
path.resolve(process.cwd(), "node_modules/adminizer/src/models"),
|
|
566
569
|
path.resolve(process.cwd(), "node_modules/adminizer/models")
|
|
567
570
|
];
|