reloaded 4 rokov pred
rodič
commit
a464abafb7

+ 34 - 22
app/controller/.notice.js

@@ -1,43 +1,55 @@
 module.exports = {
   create: {
     requestBody: [
-      '!noticeid',
-      '!content',
-      'notified'
-    ]
+      "!planyearid",
+      "!planid",
+      "termid",
+      "classid",
+      "!noticeid",
+      "!content",
+      "notified",
+    ],
   },
   destroy: {
-    params: ['!id'],
-    service: 'delete'
+    params: ["!id"],
+    service: "delete",
   },
   update: {
-    params: ['!id'],
+    params: ["!id"],
     requestBody: [
-      'noticeid',
-      'content',
-      'notified'
-    ]
+      "planyearid",
+      "planid",
+      "termid",
+      "classid",
+      "noticeid",
+      "content",
+      "notified",
+    ],
   },
   show: {
     parameters: {
-      params: ['!id']
+      params: ["!id"],
     },
-    service: 'fetch'
+    service: "fetch",
   },
   index: {
     parameters: {
       query: {
-        noticeid:'noticeid',
-        content :'content',
-        notified :'notified'
-      }
+        planyearid: "planyearid",
+        planid:"planid",
+        termid: "termid",
+        classid: "classid",
+        noticeid: "noticeid",
+        content: "content",
+        notified: "notified",
+      },
     },
-    service: 'query',
+    service: "query",
     options: {
-      query: ['skip', 'limit'],
-      sort: ['meta.createdAt'],
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
       desc: true,
-      count: true
-    }
+      count: true,
+    },
   },
 };

+ 4 - 0
app/model/notice.js

@@ -12,6 +12,10 @@ const notifiedInfo = new Schema({
 
 // 通知表
 const NoticeSchema = {
+  planyearid: { type: String, required: true, maxLength: 200 }, // 年度计划id
+  planid: { type: String, required: true, maxLength: 200 }, // 计划id
+  termid: { type: String, required: false, maxLength: 200 }, // 期id
+  classid: { type: String, required: false, maxLength: 200 }, // 班级id
   noticeid: { type: String, required: true, maxLength: 200 }, // 通知人id
   content: { type: String, required: true }, // 通知内容
   notified: { type: [ notifiedInfo ], select: true }, // 被通知信息

+ 9 - 3
app/model/teacher.js

@@ -3,6 +3,12 @@ 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 zynumberfileInfo = new Schema({
+  uri: { type: String, required: false, maxLength: 200 }, // 路径
+  name: { type: String, required: false, maxLength: 200 }, // 名称
+});
+
 // 资料路径详情
 const urlInfo = new Schema({
   uri: { type: String, required: false, maxLength: 200 }, // 路径
@@ -23,7 +29,7 @@ const TeacherSchema = {
   idnumber: { type: String, required: true, maxLength: 200 }, // 身份证号
   gender: { type: String, required: true, maxLength: 200 }, // 教师性别
   zynumber: { type: String, required: true, maxLength: 200 }, // 职业资格证号
-  zynumberfile: { type: [ String ], required: true, maxLength: 200 }, // 职业资格证图片
+  zynumberfile: { type: [ zynumberfileInfo ], required: true, maxLength: 200 }, // 职业资格证图片
   schid: { type: String, required: true, maxLength: 200 }, // 学校id
   schname: { type: String, required: true, maxLength: 200 }, // 学校名称
   email: { type: String, required: true, maxLength: 200 }, // 邮箱
@@ -51,8 +57,8 @@ const TeacherSchema = {
   file: { type: [ FileInfo ], select: false }, // 资料,教案PPT视频等
   status: { type: String, required: false, maxLength: 200, default: '0' },
   // 状态:0-注册,1-确认身份,2-资料评分,3-面试评分,4-确认入库
-}
-;
+};
+
 
 const schema = new Schema(TeacherSchema, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });

+ 3 - 1
app/service/notice.js

@@ -20,7 +20,9 @@ class NoticeService extends CrudService {
   }
 
   async create(data) {
-    const { noticeid, content, notified } = data;
+    const { planyearid, planid, termid, classid, noticeid, content, notified } = data;
+    assert(planyearid, '年度计划id为必填项');
+    assert(planid, '计划id为必填项');
     assert(noticeid, '通知人id为必填项');
     assert(content, '通知内容为必填项');
     const res = await this.model.create(data);