seepur/app/Models/ActivityLog.js

21 lines
429 B
JavaScript
Raw Normal View History

'use strict'
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')
class ActivityLog extends Model {
async call() {
return this.belongsTo('App/Models/Call');
}
async resource() {
switch (this.type) {
case 'BOOK':
return this.belongsTo('App/Models/Book');
default:
throw new Error('Unknown Resource Type');
}
}
}
module.exports = ActivityLog