dygapp 7 years ago
parent
commit
5a9d34cb77
3 changed files with 24 additions and 7 deletions
  1. 19 4
      app/controller/README.md
  2. 2 3
      app/service/README.md
  3. 3 0
      patch.sh

+ 19 - 4
app/controller/README.md

@@ -2,11 +2,10 @@
 ```
 'use strict';
 
-const Controller = require('egg').Controller;
 const meta = require('./category.json');
-const { CrudController } = require('naf-framework-mongoose').controller;
+const { CrudController, NafController } = require('naf-framework-mongoose').Controllers;
 
-class CategoryController extends Controller {
+class CategoryController extends NafController {
   constructor(ctx) {
     super(ctx);
     this.service = this.ctx.service.category;
@@ -34,7 +33,23 @@ module.exports = CrudController(CategoryController, meta);
     "options": {
       "sort": ["order", "code"]
     }
-},
+  },
+  "simple": {
+    "parameters": {
+      "query": ["corp.id"]
+    },
+    "service": "query",
+    "options": {
+      "query": ["skip", "limit"],
+      "sort": ["meta.createAt"],
+      "desc": true,
+      "projection": {
+        "title": 1,
+        "corp.name": 1,
+        "meta.createdAt": 1
+      }
+    }
+  },
   "fetch": {
     "query": ["id"]
   }

+ 2 - 3
app/service/README.md

@@ -6,12 +6,11 @@ const ObjectID = require('mongodb').ObjectID;
 const assert = require('assert');
 const util = require('core-util-is');
 const { BusinessError, ErrorCode } = require('naf-core').Error;
-const service = require('naf-framework-mongoose').service;
-const { CrudService } = service;
+const { CrudService } = require('naf-framework-mongoose').Services;
 
 class CategoryService extends CrudService {
   constructor(ctx) {
-    super(ctx, 'naf_code_category');
+    super(ctx);
     this.model = ctx.model.Category;
     this.mItems = ctx.model.Items;
   }

+ 3 - 0
patch.sh

@@ -0,0 +1,3 @@
+#patch for linux install
+chmod ogu+w appveyor.yml
+chmod ogu+w .travis.yml