db-model-router 1.0.14 → 1.0.15
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.
- package/package.json +1 -1
- package/src/cli/init.js +8 -5
- package/src/postgres/db.js +2 -1
package/package.json
CHANGED
package/src/cli/init.js
CHANGED
|
@@ -239,14 +239,17 @@ function updatePackageJson(answers, outputDir) {
|
|
|
239
239
|
const { dependencies, devDependencies } = collectDependencies(answers);
|
|
240
240
|
const scripts = getScripts(outputDir);
|
|
241
241
|
|
|
242
|
+
const normalizedOutput = outputDir ? outputDir.replace(/\/+$/, "") : "";
|
|
243
|
+
const importPrefix = normalizedOutput ? `./${normalizedOutput}/` : "./";
|
|
244
|
+
|
|
242
245
|
pkg.type = "module";
|
|
243
246
|
pkg.imports = {
|
|
244
247
|
"#root/*.js": "./*.js",
|
|
245
|
-
"#models":
|
|
246
|
-
"#models/*.js":
|
|
247
|
-
"#routes/*.js":
|
|
248
|
-
"#commons/*.js":
|
|
249
|
-
"#middleware/*.js":
|
|
248
|
+
"#models": `${importPrefix}models/index.js`,
|
|
249
|
+
"#models/*.js": `${importPrefix}models/*.js`,
|
|
250
|
+
"#routes/*.js": `${importPrefix}routes/*.js`,
|
|
251
|
+
"#commons/*.js": `${importPrefix}commons/*.js`,
|
|
252
|
+
"#middleware/*.js": `${importPrefix}middleware/*.js`,
|
|
250
253
|
};
|
|
251
254
|
pkg.scripts = Object.assign({}, pkg.scripts || {}, scripts);
|
|
252
255
|
pkg.dependencies = Object.assign({}, pkg.dependencies || {}, dependencies);
|
package/src/postgres/db.js
CHANGED
|
@@ -304,8 +304,9 @@ function where(filter, safeDelete = null) {
|
|
|
304
304
|
),
|
|
305
305
|
);
|
|
306
306
|
} else if (j[1] === "like" || j[1] === "not like") {
|
|
307
|
+
const pgOp = j[1] === "like" ? "ILIKE" : "NOT ILIKE";
|
|
307
308
|
bindIdx++;
|
|
308
|
-
conditionAnd.push(`${escapeId(j[0])} ${
|
|
309
|
+
conditionAnd.push(`${escapeId(j[0])} ${pgOp} $${bindIdx}`);
|
|
309
310
|
value.push("%" + j[2] + "%");
|
|
310
311
|
} else {
|
|
311
312
|
bindIdx++;
|