|
|
|
@ -321,7 +321,7 @@ abstract class BaseModel {
|
|
|
|
|
* @returns {Object} Table row data |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
async readByPk(id, { conditionGraph }) { |
|
|
|
|
async readByPk(id) { |
|
|
|
|
try { |
|
|
|
|
return await this._run( |
|
|
|
|
this.$db.select().where(this._wherePk(id)).first(), |
|
|
|
@ -704,10 +704,7 @@ abstract class BaseModel {
|
|
|
|
|
*/ |
|
|
|
|
async exists(id, _) { |
|
|
|
|
try { |
|
|
|
|
return ( |
|
|
|
|
Object.keys(await this.readByPk(id, { conditionGraph: null })) |
|
|
|
|
.length !== 0 |
|
|
|
|
); |
|
|
|
|
return Object.keys(await this.readByPk(id)).length !== 0; |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e); |
|
|
|
|
throw e; |
|
|
|
@ -1341,7 +1338,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - insert data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeInsert(data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1350,7 +1347,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} response - inserted data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterInsert(response, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1360,7 +1357,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - insert data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorInsert(err, data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1369,7 +1366,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - update data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeUpdate(data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1378,7 +1375,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} response - updated data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterUpdate(response, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1388,7 +1385,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - update data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorUpdate(err, data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1397,7 +1394,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - delete data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeDelete(data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1406,7 +1403,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} response - Deleted data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterDelete(response, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1416,7 +1413,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - delete data |
|
|
|
|
* @param {Object} trx? - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorDelete(err, data, trx?: any, cookie?: {}) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1425,7 +1422,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} data - insert data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeInsertb(data, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1434,7 +1431,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} response - inserted data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterInsertb(response, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1444,7 +1441,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object} data - delete data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorInsertb(err, data, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1453,7 +1450,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} data - update data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeUpdateb(data, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1462,7 +1459,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} response - updated data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterUpdateb(response, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1472,7 +1469,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} data - delete data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorUpdateb(err, data, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1481,7 +1478,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} data - delete data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async beforeDeleteb(data, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1490,7 +1487,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} response - deleted data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async afterDeleteb(response, trx?: any) {} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1500,7 +1497,7 @@ abstract class BaseModel {
|
|
|
|
|
* @param {Object[]} data - delete data |
|
|
|
|
* @param {Object} trx - knex transaction reference |
|
|
|
|
*/ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
|
async errorDeleteb(err, data, trx?: any) {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|