'use strict';

const Controller = require('egg').Controller;
class JobtypeController extends Controller {
  async list() {
    const { ctx, service } = this;
    
    if (ctx.params.jobtype === 'undefined') { return ctx.throw(422, 'job_style is missing!'); }
    let job_type = ctx.params.jobtype;
    const ret = await service.official.job.type.get_list( { job_type: job_type } );
    ctx.success({ results: ret });
  }

  async school() {
    const { ctx, service } = this;
    let job_type = 1;
    const ret = await service.official.job.type.get_list( { job_type: job_type } );
    ctx.success({ results: ret });
  }

  async social() {
    const { ctx, service } = this;
    let job_type = 2;
    const ret = await service.official.job.type.get_list( { job_type: job_type } );
    ctx.success({ results: ret });
  }

}

module.exports = JobtypeController;
