|
|
@ -310,6 +310,28 @@ class BaseModelSqlv2 { |
|
|
|
return data; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async readOnlyPrimariesByPkFromModel( |
|
|
|
|
|
|
|
props: { model: Model; id: any; extractDisplayValueData?: boolean }[], |
|
|
|
|
|
|
|
): Promise<any[]> { |
|
|
|
|
|
|
|
return await Promise.all( |
|
|
|
|
|
|
|
props.map(({ model, id, extractDisplayValueData = true }) => |
|
|
|
|
|
|
|
this.readByPkFromModel( |
|
|
|
|
|
|
|
model, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
extractDisplayValueData, |
|
|
|
|
|
|
|
id, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async exist(id?: any): Promise<any> { |
|
|
|
public async exist(id?: any): Promise<any> { |
|
|
|
const qb = this.dbDriver(this.tnPath); |
|
|
|
const qb = this.dbDriver(this.tnPath); |
|
|
|
await this.model.getColumns(this.context); |
|
|
|
await this.model.getColumns(this.context); |
|
|
@ -5631,33 +5653,9 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (oldRowId) { |
|
|
|
if (oldRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: childTable, id: childId }, |
|
|
|
childTable, |
|
|
|
{ model: parentTable, id: oldRowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
childId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
parentTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -5733,19 +5731,10 @@ class BaseModelSqlv2 { |
|
|
|
null, |
|
|
|
null, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const childRelatedPkValue = await this.readByPkFromModel( |
|
|
|
const [childRelatedPkValue] = |
|
|
|
childTable, |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
undefined, |
|
|
|
{ model: childTable, id: rowId }, |
|
|
|
true, |
|
|
|
]); |
|
|
|
rowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parentTable.id !== childTable.id) { |
|
|
|
if (parentTable.id !== childTable.id) { |
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -5775,33 +5764,9 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (oldChildRowId) { |
|
|
|
if (oldChildRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: parentTable, id: oldChildRowId }, |
|
|
|
parentTable, |
|
|
|
{ model: childTable, id: rowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldChildRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
childTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
rowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -5877,33 +5842,9 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (oldChildRowId) { |
|
|
|
if (oldChildRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: parentTable, id: oldChildRowId }, |
|
|
|
parentTable, |
|
|
|
{ model: childTable, id: rowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldChildRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
childTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
rowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -5954,33 +5895,9 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (oldRowId) { |
|
|
|
if (oldRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: parentTable, id: childId }, |
|
|
|
parentTable, |
|
|
|
{ model: childTable, id: oldRowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
childId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
childTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -6030,33 +5947,9 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
if (oldChildRowId) { |
|
|
|
if (oldChildRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: childTable, id: oldChildRowId }, |
|
|
|
childTable, |
|
|
|
{ model: parentTable, id: rowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldChildRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
parentTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
rowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
@ -6097,33 +5990,9 @@ class BaseModelSqlv2 { |
|
|
|
: null; |
|
|
|
: null; |
|
|
|
if (oldRowId) { |
|
|
|
if (oldRowId) { |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
const [parentRelatedPkValue, childRelatedPkValue] = |
|
|
|
await Promise.all([ |
|
|
|
await this.readOnlyPrimariesByPkFromModel([ |
|
|
|
await this.readByPkFromModel( |
|
|
|
{ model: childTable, id: childId }, |
|
|
|
childTable, |
|
|
|
{ model: parentTable, id: oldRowId }, |
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
childId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
await this.readByPkFromModel( |
|
|
|
|
|
|
|
parentTable, |
|
|
|
|
|
|
|
undefined, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
oldRowId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ignoreView: true, |
|
|
|
|
|
|
|
getHiddenColumn: true, |
|
|
|
|
|
|
|
extractOnlyPrimaries: true, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
auditUpdateObj.push({ |
|
|
|
auditUpdateObj.push({ |
|
|
|