Skip to content

Commit d93cbe4

Browse files
author
pedro
committed
feat:更新lin-mizar版本
1 parent daa73b3 commit d93cbe4

7 files changed

Lines changed: 23 additions & 20 deletions

File tree

app/api/cms/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ test.linGet(
2424
"getTestMsg",
2525
"/json",
2626
{
27-
auth: "hello",
28-
module: "world",
27+
auth: "测试日志记录",
28+
module: "信息",
2929
mount: true
3030
},
3131
loginRequired,

app/config/secure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module.exports = {
44
db: {
5-
database: "lin-cms4",
5+
database: "lin-cms5",
66
host: "localhost",
77
port: 3306,
88
username: "root",

app/models/book.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@ const { merge } = require("lodash");
55
const { Sequelize, Model } = require("sequelize");
66
const { db } = require("lin-mizar/lin/db");
77

8-
class Book extends Model {}
8+
class Book extends Model {
9+
toJSON () {
10+
let origin = {
11+
id: this.id,
12+
title: this.title,
13+
author: this.author,
14+
summary: this.summary,
15+
image: this.image,
16+
create_time: this.createTime
17+
};
18+
return origin;
19+
}
20+
}
921

1022
Book.init(
1123
{
@@ -42,16 +54,4 @@ Book.init(
4254
)
4355
);
4456

45-
Book.prototype.toJSON = function () {
46-
let origin = {
47-
id: this.id,
48-
title: this.title,
49-
author: this.author,
50-
summary: this.summary,
51-
image: this.image,
52-
create_time: this.createTime
53-
};
54-
return origin;
55-
};
56-
5757
module.exports = { Book };

app/validators/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class NewGroupValidator extends LinValidator {
9797
constructor () {
9898
super();
9999
this.name = new Rule("isNotEmpty", "请输入分组名称");
100-
this.info = new Rule("isOptional", "");
100+
this.info = new Rule("isOptional");
101101
this.auths = new Rule(this.checkAuths, "请输入auths字段");
102102
}
103103

app/validators/book.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class CreateOrUpdateBookValidator extends LinValidator {
1515
this.title = new Rule("isNotEmpty", "必须传入图书名");
1616
this.author = new Rule("isNotEmpty", "必须传入图书作者");
1717
this.summary = new Rule("isNotEmpty", "必须传入图书综述");
18-
this.image = new Rule("isNotEmpty", "必须传入图书插图");
18+
this.image = new Rule("isLength", "图书插图的url长度必须在0~100之间", {
19+
min: 0,
20+
max: 100
21+
});
1922
}
2023
}
2124

app/validators/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class RegisterValidator extends LinValidator {
77
super();
88
this.nickname = [
99
new Rule("isNotEmpty", "昵称不可为空"),
10-
new Rule("length", "昵称长度必须在2~10之间", 2, 10)
10+
new Rule("isLength", "昵称长度必须在2~10之间", 2, 10)
1111
];
1212
this.group_id = new Rule("isInt", "分组id必须是整数,且大于0", {
1313
min: 1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@
3939
"@koa/cors": "^2.2.3",
4040
"koa": "^2.7.0",
4141
"koa-bodyparser": "^4.2.1",
42-
"lin-mizar": "^0.0.1-alpha.14"
42+
"lin-mizar": "^0.0.1-alpha.16"
4343
}
4444
}

0 commit comments

Comments
 (0)