pg-mvc-service 1.0.5 → 1.0.6
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.
|
@@ -425,6 +425,8 @@ class TableModel {
|
|
|
425
425
|
let refIndex = 1;
|
|
426
426
|
const sql = `SELECT COUNT(*) as count FROM ${ref.table} WHERE ${ref.columns.map(col => `${col.ref} = $${refIndex++}`).join(" AND ")}`;
|
|
427
427
|
const datas = yield this.clientQuery(sql, refValues);
|
|
428
|
+
console.log(datas);
|
|
429
|
+
console.log(datas.rows[0].count == "0");
|
|
428
430
|
if (datas.rows[0].count == "0") {
|
|
429
431
|
const name = ref.columns.map(col => { var _a; return (_a = this.getColumn(col.target).alias) !== null && _a !== void 0 ? _a : this.getColumn(col.target).columnName; }).join(',');
|
|
430
432
|
this.throwValidationError("004", this.errorMessages.fk.replace('{name}', name));
|
package/package.json
CHANGED
package/src/models/TableModel.ts
CHANGED
|
@@ -489,6 +489,8 @@ export class TableModel {
|
|
|
489
489
|
let refIndex = 1;
|
|
490
490
|
const sql = `SELECT COUNT(*) as count FROM ${ref.table} WHERE ${ref.columns.map(col => `${col.ref} = $${refIndex++}`).join(" AND ")}`;
|
|
491
491
|
const datas = await this.clientQuery(sql, refValues);
|
|
492
|
+
console.log(datas);
|
|
493
|
+
console.log(datas.rows[0].count == "0");
|
|
492
494
|
if (datas.rows[0].count == "0") {
|
|
493
495
|
const name = ref.columns.map(col => this.getColumn(col.target).alias ?? this.getColumn(col.target).columnName).join(',');
|
|
494
496
|
this.throwValidationError("004", this.errorMessages.fk.replace('{name}', name));
|