'use strict';
const Service = require('egg').Service;

class ApplyService extends Service {
    async apply(condition = {}) {
      const { ctx } = this;
      const moment = require('moment');
  
      const now = moment().format('YYYY-MM-DD HH:mm:ss');
      const data = {
        job_id:    condition.job_id,
        name:      condition.name,
        telephone: condition.telephone,
        email:     condition.email,
        school:    condition.school,
        major:     condition.major,
        resume:    condition.resume,
        code:      condition.code,
        created_time: now,
      };
      let ret = ctx.blockModel.OfficialJobApply.add(data);
      return ret;
    }
}

module.exports = ApplyService;