Przeglądaj źródła

科技人才服务端更新

reloaded 5 lat temu
rodzic
commit
365b1abe5e

+ 12 - 0
.travis.yml

@@ -0,0 +1,12 @@
+sudo: false
+language: node_js
+node_js:
+  - '10'
+before_install:
+  - npm i npminstall -g
+install:
+  - npminstall
+script:
+  - npm run ci
+after_script:
+  - npminstall codecov && codecov

+ 37 - 0
app/controller/.column.js

@@ -0,0 +1,37 @@
+module.exports = {
+  create: {
+    requestBody: [
+      '!name'
+    ]
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete'
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [
+      '!name'
+    ]
+  },
+  show: {
+    parameters: {
+      params: ['!id']
+    },
+    service: 'fetch'
+  },
+  index: {
+    parameters: {
+      query: {
+        name: 'name'
+      }
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true
+    }
+  },
+};

+ 112 - 0
app/controller/.experts.js

@@ -0,0 +1,112 @@
+module.exports = {
+  create: {
+    requestBody: [
+      '!name',
+      'imgpath',
+      'gender',
+      'nation',
+      'birth',
+      'cardtype',
+      'cardnumber',
+      'technical',
+      'technical_actual',
+      'position',
+      'school',
+      'eduback',
+      'degree',
+      'major_studied',
+      'professional',
+      'email',
+      'tel',
+      'phone',
+      'job_profile',
+      'project_profile',
+      'achievement',
+      'paper',
+      'remark',
+      'field',
+      'field_py',
+      'is_del'
+    ]
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete'
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [
+      '!name',
+      'imgpath',
+      'gender',
+      'nation',
+      'birth',
+      'cardtype',
+      'cardnumber',
+      'technical',
+      'technical_actual',
+      'position',
+      'school',
+      'eduback',
+      'degree',
+      'major_studied',
+      'professional',
+      'email',
+      'tel',
+      'phone',
+      'job_profile',
+      'project_profile',
+      'achievement',
+      'paper',
+      'remark',
+      'field',
+      'field_py',
+      'is_del'
+    ]
+  },
+  show: {
+    parameters: {
+      params: ['!id']
+    },
+    service: 'fetch'
+  },
+  index: {
+    parameters: {
+      query: {
+        name : '!name',
+        imgpath : 'imgpath',
+        gender : 'gender',
+        nation : 'nation',
+        birth : 'birth',
+        cardtype : 'cardtype',
+        cardnumber : 'cardnumber',
+        technical : 'technical',
+        technical_actual : 'technical_actual',
+        position : 'position',
+        school : 'school',
+        eduback : 'eduback',
+        degree : 'degree',
+        major_studied : 'major_studied',
+        professional : 'professional',
+        email : 'email',
+        tel : 'tel',
+        phone : 'phone',
+        job_profile : 'job_profile',
+        project_profile: 'project_profile',
+        achievement : 'achievement',
+        paper : 'paper',
+        remark : 'remark',
+        field : 'field',
+        field_py : 'field_py',
+        is_del : 'is_del'
+      }
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true
+    }
+  },
+};

+ 52 - 0
app/controller/.information.js

@@ -0,0 +1,52 @@
+module.exports = {
+  create: {
+    requestBody: [
+      'infotype',
+      '!name',
+      'content',
+      'user_id',
+      'user_name',
+      'state'
+    ]
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete'
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [
+      'infotype',
+      '!name',
+      'content',
+      'user_id',
+      'user_name',
+      'state'
+    ]
+  },
+  show: {
+    parameters: {
+      params: ['!id']
+    },
+    service: 'fetch'
+  },
+  index: {
+    parameters: {
+      query: {
+        infotype :'infotype',
+        name :'!name',
+        content :'content',
+        user_id :'user_id',
+        user_name :'user_name',
+        state :'state'
+      }
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true
+    }
+  },
+};

+ 67 - 0
app/controller/.recruitment.js

@@ -0,0 +1,67 @@
+module.exports = {
+  create: {
+    requestBody: [
+      '!license',
+      '!name',
+      'salary',
+      'job_nature',
+      'profession',
+      'workplace',
+      'workexp',
+      'education',
+      'people_number',
+      'explains',
+      'state'
+    ]
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete'
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [
+      'license',
+      'name',
+      'salary',
+      'job_nature',
+      'profession',
+      'workplace',
+      'workexp',
+      'education',
+      'people_number',
+      'explains',
+      'state'
+    ]
+  },
+  show: {
+    parameters: {
+      params: ['!id']
+    },
+    service: 'fetch'
+  },
+  index: {
+    parameters: {
+      query: {
+        license :'!license',
+        name :'!name',
+        salary :'salary',
+        job_nature :'job_nature',
+        profession :'profession',
+        workplace :'workplace',
+        workexp :'workexp',
+        education :'education',
+        people_number:'people_number',
+        explains:'explains',
+        state:'state'
+      }
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true
+    }
+  },
+};

+ 115 - 0
app/controller/.resume.js

@@ -0,0 +1,115 @@
+module.exports = {
+  create: {
+    requestBody: [
+      '!talents_userId',
+      '!title',
+      '!name',
+      'imgpath',
+      'gender',
+      'nation',
+      'birth',
+      'marital',
+      'hukou',
+      'cardnumber',
+      'addr',
+      'education',
+      'phone',
+      'email',
+      'job_nature',
+      'profession',
+      'workplace',
+      'salary',
+      'current',
+      'introduction',
+      'work_exp',
+      'project_exp',
+      'education_exp',
+      'language',
+      'skills',
+      'hobbies',
+      'state'
+    ]
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete'
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [
+      '!talents_userId',
+      '!title',
+      '!name',
+      'imgpath',
+      'gender',
+      'nation',
+      'birth',
+      'marital',
+      'hukou',
+      'cardnumber',
+      'addr',
+      'education',
+      'phone',
+      'email',
+      'job_nature',
+      'profession',
+      'workplace',
+      'salary',
+      'current',
+      'introduction',
+      'work_exp',
+      'project_exp',
+      'education_exp',
+      'language',
+      'skills',
+      'hobbies',
+      'state'
+    ]
+  },
+  show: {
+    parameters: {
+      params: ['!id']
+    },
+    service: 'fetch'
+  },
+  index: {
+    parameters: {
+      query: {
+        talents_userId : '!talents_userId',
+        title : '!title',
+        name : '!name',
+        imgpath : 'imgpath',
+        gender : 'gender',
+        nation : 'nation',
+        birth : 'birth',
+        marital : 'marital',
+        hukou : 'hukou',
+        cardnumber : 'cardnumber',
+        addr : 'addr',
+        education : 'education',
+        phone : 'phone',
+        email : 'email',
+        job_nature : 'job_nature',
+        profession : 'profession',
+        workplace : 'workplace',
+        salary : 'salary',
+        current : 'current',
+        introduction : 'introduction',
+        work_exp : 'work_exp',
+        project_exp : 'project_exp',
+        education_exp : 'education_exp',
+        language : 'language',
+        skills : 'skills',
+        hobbies : 'hobbies',
+        state : 'state'
+      }
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true
+    }
+  },
+};

+ 19 - 0
app/controller/column.js

@@ -0,0 +1,19 @@
+'use strict';
+
+const _ = require('lodash');
+const meta = require('./.column.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科目管理
+class ColumnController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.column;
+  }
+
+
+}
+
+module.exports = CrudController(ColumnController, meta);

+ 19 - 0
app/controller/experts.js

@@ -0,0 +1,19 @@
+'use strict';
+
+const _ = require('lodash');
+const meta = require('./.experts.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 栏目管理
+class ExpertsController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.experts;
+  }
+
+
+}
+
+module.exports = CrudController(ExpertsController, meta);

+ 19 - 0
app/controller/information.js

@@ -0,0 +1,19 @@
+'use strict';
+
+const _ = require('lodash');
+const meta = require('./.information.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科目管理
+class InformationController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.information;
+  }
+
+
+}
+
+module.exports = CrudController(InformationController, meta);

+ 19 - 0
app/controller/recruitment.js

@@ -0,0 +1,19 @@
+'use strict';
+
+const _ = require('lodash');
+const meta = require('./.recruitment.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 招聘信息管理
+class RecruitmentController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.recruitment;
+  }
+
+
+}
+
+module.exports = CrudController(RecruitmentController, meta);

+ 19 - 0
app/controller/resume.js

@@ -0,0 +1,19 @@
+'use strict';
+
+const _ = require('lodash');
+const meta = require('./.resume.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 简历管理
+class ResumeController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.resume;
+  }
+
+
+}
+
+module.exports = CrudController(ResumeController, meta);

+ 19 - 0
app/model/column.js

@@ -0,0 +1,19 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 栏目表
+const ColumnSchema = {
+  name: { type: String, required: true, maxLength: 500 }, // 栏目名称
+};
+
+
+const schema = new Schema(ColumnSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Column', schema, 'column');
+};

+ 45 - 0
app/model/experts.js

@@ -0,0 +1,45 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 专家表
+const ExpertsSchema = {
+  name: { type: String, required: true, maxLength: 200 }, // 姓名
+  imgpath: { type: String, required: false, maxLength: 500 }, // 头像图片路径
+  gender: { type: String, required: false, maxLength: 200 }, // 性别
+  nation: { type: String, required: false, maxLength: 200 }, // 民族
+  birth: { type: String, required: false, maxLength: 200 }, // 出生年月
+  cardtype: { type: String, required: false, maxLength: 500 }, // 证件类型
+  cardnumber: { type: String, required: false, maxLength: 500 }, // 身份证号
+  technical: { type: String, required: false, maxLength: 500 }, // 初级职称
+  technical_actual: { type: String, required: false, maxLength: 500 }, // 具体职称
+  position: { type: String, required: false, maxLength: 200 }, // 职务
+  school: { type: String, required: false, maxLength: 200 }, // 毕业院校
+  eduback: { type: String, required: false, maxLength: 200 }, // 学历
+  degree: { type: String, required: false, maxLength: 200 }, // 学位
+  major_studied: { type: String, required: false, maxLength: 500 }, // 所学专业
+  professional: { type: String, required: false, maxLength: 500 }, // 从事专业
+  email: { type: String, required: false, maxLength: 500 }, // 邮箱
+  tel: { type: String, required: false, maxLength: 200 }, // 办公电话
+  phone: { type: String, required: false, maxLength: 200 }, // 手机号
+  job_profile: { type: String, required: false }, // 业务工作简介
+  project_profile: { type: String, required: false }, // 主持或参与项目情况
+  achievement: { type: String, required: false }, // 主要学术成就及获奖情况
+  paper: { type: String, required: false }, // 论文论著
+  remark: { type: String, required: false }, // 备注
+  field: { type: String, required: false, maxLength: 200 }, // 可供咨询领域
+  field_py: { type: String, required: false, maxLength: 200 }, // 领域拼音
+  is_del: { type: String, required: false, maxLength: 200 }, // 是否删除,0-否,1-是
+};
+
+
+const schema = new Schema(ExpertsSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Experts', schema, 'experts');
+}
+;

+ 24 - 0
app/model/information.js

@@ -0,0 +1,24 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 参谋表
+const InformationSchema = {
+  infotype: { type: String, required: true, maxLength: 200 }, // 信息类型
+  name: { type: String, required: true, maxLength: 500 }, // 名称
+  content: { type: String, required: true }, // 正文
+  user_id: { type: String, required: true, maxLength: 200 }, // 发布人id
+  user_name: { type: String, required: true, maxLength: 200 }, // 发布人名称
+  state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
+};
+
+
+const schema = new Schema(InformationSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Information', schema, 'information');
+};

+ 30 - 0
app/model/recruitment.js

@@ -0,0 +1,30 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 招聘信息表
+const RecruitmentSchema = {
+  license: { type: String, required: true, maxLength: 200 }, // 信用代码
+  name: { type: String, required: true, maxLength: 500 }, // 招聘信息名称
+  salary: { type: String, required: false, maxLength: 200 }, // 职位月薪
+  job_nature: { type: String, required: false, maxLength: 200 }, // 工作性质,0-兼职,1-全职
+  profession: { type: String, required: false, maxLength: 500 }, // 公司名称
+  workplace: { type: String, required: false, maxLength: 200 }, // 工作地点
+  workexp: { type: String, required: false }, // 工作经验
+  education: { type: String, required: false, maxLength: 200 }, // 学历
+  people_number: { type: String, required: false, maxLength: 200 }, // 招聘人数
+  explains: { type: String, required: false }, // 职位说明
+  state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
+};
+
+
+const schema = new Schema(RecruitmentSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Recruitment', schema, 'recruitment');
+}
+;

+ 46 - 0
app/model/resume.js

@@ -0,0 +1,46 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
+
+// 简历表
+const ResumeSchema = {
+  talents_userId: { type: String, required: true, maxLength: 500 }, // 用户id
+  title: { type: String, required: true, maxLength: 500 }, // 简历名称
+  name: { type: String, required: true, maxLength: 200 }, // 姓名
+  imgpath: { type: String, required: false, maxLength: 500 }, // 头像图片路径
+  gender: { type: String, required: false, maxLength: 200 }, // 性别
+  nation: { type: String, required: false, maxLength: 200 }, // 民族
+  birth: { type: String, required: false, maxLength: 500 }, // 出生年月
+  marital: { type: String, required: false, maxLength: 200 }, // 婚姻状况,0-未婚,1-已婚
+  hukou: { type: String, required: false, maxLength: 500 }, // 户口所在地
+  cardnumber: { type: String, required: false, maxLength: 500 }, // 身份证号
+  addr: { type: String, required: false, maxLength: 500 }, // 当前住址
+  education: { type: String, required: false, maxLength: 500 }, // 学历
+  phone: { type: String, required: false, maxLength: 200 }, // 手机号
+  email: { type: String, required: false, maxLength: 200 }, // 邮箱
+  job_nature: { type: String, required: false, maxLength: 200 }, // 工作性质,0-兼职,1-全职
+  profession: { type: String, required: false }, // 求职意向
+  workplace: { type: String, required: false }, // 期望工作地点
+  salary: { type: String, required: false, maxLength: 500 }, // 薪资要求
+  current: { type: String, required: false, maxLength: 500 }, // 目前状况
+  introduction: { type: String, required: false }, // 自我简介
+  work_exp: { type: String, required: false }, // 工作经验
+  project_exp: { type: String, required: false }, // 项目经验
+  education_exp: { type: String, required: false }, // 教育经历
+  language: { type: String, required: false }, // 语言能力
+  skills: { type: String, required: false }, // 专业技能
+  hobbies: { type: String, required: false }, // 兴趣爱好
+  state: { type: String, required: false, maxLength: 200 }, // 状态,0-草稿,1-发布,2-删除
+};
+
+
+const schema = new Schema(ResumeSchema, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.plugin(metaPlugin);
+
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Resume', schema, 'resume');
+}
+;

+ 20 - 0
app/router.js

@@ -6,4 +6,24 @@
 module.exports = app => {
   const { router, controller } = app;
   router.get('/', controller.home.index);
+
+  // 栏目表设置路由
+  router.resources('column', '/api/column', controller.column); // index、create、show、destroy
+  router.post('column', '/api/column/update/:id', controller.column.update);
+
+  // 简历表设置路由
+  router.resources('resume', '/api/resume', controller.resume); // index、create、show、destroy
+  router.post('resume', '/api/resume/update/:id', controller.resume.update);
+
+  // 招聘信息表设置路由
+  router.resources('recruitment', '/api/recruitment', controller.recruitment); // index、create、show、destroy
+  router.post('recruitment', '/api/recruitment/update/:id', controller.recruitment.update);
+
+  // 专家表设置路由
+  router.resources('experts', '/api/experts', controller.experts); // index、create、show、destroy
+  router.post('experts', '/api/experts/update/:id', controller.experts.update);
+
+  // 参谋表设置路由
+  router.resources('information', '/api/information', controller.information); // index、create、show、destroy
+  router.post('information', '/api/information/update/:id', controller.information.update);
 };

+ 18 - 0
app/service/column.js

@@ -0,0 +1,18 @@
+'use strict';
+
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+class ColumnService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'column');
+    this.model = this.ctx.model.Column;
+  }
+
+}
+
+module.exports = ColumnService;

+ 18 - 0
app/service/experts.js

@@ -0,0 +1,18 @@
+'use strict';
+
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+class ExpertsService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'experts');
+    this.model = this.ctx.model.Experts;
+  }
+
+}
+
+module.exports = ExpertsService;

+ 18 - 0
app/service/information.js

@@ -0,0 +1,18 @@
+'use strict';
+
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+class InformationService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'information');
+    this.model = this.ctx.model.Information;
+  }
+
+}
+
+module.exports = InformationService;

+ 18 - 0
app/service/recruitment.js

@@ -0,0 +1,18 @@
+'use strict';
+
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+class RecruitmentService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'recruitment');
+    this.model = this.ctx.model.Recruitment;
+  }
+
+}
+
+module.exports = RecruitmentService;

+ 18 - 0
app/service/resume.js

@@ -0,0 +1,18 @@
+'use strict';
+
+
+const assert = require('assert');
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+class ResumeService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'resume');
+    this.model = this.ctx.model.Resume;
+  }
+
+}
+
+module.exports = ResumeService;

+ 14 - 0
appveyor.yml

@@ -0,0 +1,14 @@
+environment:
+  matrix:
+    - nodejs_version: '10'
+
+install:
+  - ps: Install-Product node $env:nodejs_version
+  - npm i npminstall && node_modules\.bin\npminstall
+
+test_script:
+  - node --version
+  - npm --version
+  - npm run test
+
+build: off