All files / platform/modules/staff/src/Services StaffConnectionService.js

100% Statements 12/12
100% Branches 2/2
100% Functions 7/7
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44    1x       35x       35x       9x 9x 4x     5x       5x             8x       7x       9x       1x  
'use strict';
 
const CE = use('C2C/Exceptions');
 
class StaffConnectionService {
  static get inject() {
    return [`C2C/Repositories/StaffConnectionRepo`];
  }
 
  constructor(StaffConnectionRepo) {
    this.staffConnectionRepo = StaffConnectionRepo;
  }
 
  async findByOrFail(conditions) {
    const connection = await this.staffConnectionRepo.findOne(conditions);
    if (!connection) {
      throw CE.NotFoundException.raise('errors.notFound');
    }
 
    return connection;
  }
 
  update(conditions, payload) {
    return this.staffConnectionRepo.update({
      conditions,
      payload,
    });
  }
 
  getOneInBusy(conditions) {
    return this.staffConnectionRepo.getOneInBusy(conditions);
  }
 
  delete(conditions, trx) {
    return this.staffConnectionRepo.delete(conditions, trx);
  }
 
  create(payload, trx) {
    return this.staffConnectionRepo.create(payload, trx);
  }
}
 
module.exports = StaffConnectionService;