21 lines
429 B
JavaScript
21 lines
429 B
JavaScript
|
'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
|