const Controller = require('./base')
const Response = require('../util/response')
const { DepartmentService } = require('../service/index')

class DepartmentController extends Controller {
  async findAll (ctx) {
    let response = new Response(ctx)

    try {
      let data = await DepartmentService.findAll()
      response.success(data)
    } catch (e) {
      response.error({
        msg: e.message,
        code: CODE_NORMAL_ERROR
      })
    }
  }
}

module.exports = DepartmentController
