@waline/vercel 1.18.7 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/katex.spec.js +2 -0
- package/index.js +2 -0
- package/package.json +10 -10
- package/src/config/adapter.js +16 -0
- package/src/config/config.js +2 -1
- package/src/config/extend.js +6 -4
- package/src/controller/article.js +1 -0
- package/src/controller/comment.js +29 -0
- package/src/controller/db.js +54 -2
- package/src/controller/oauth.js +14 -8
- package/src/controller/rest.js +1 -0
- package/src/controller/token/2fa.js +4 -0
- package/src/controller/token.js +4 -0
- package/src/controller/user/password.js +3 -1
- package/src/controller/user.js +4 -1
- package/src/controller/verification.js +3 -0
- package/src/extend/controller.js +4 -0
- package/src/extend/think.js +8 -1
- package/src/locales/en.json +2 -2
- package/src/locales/zh-CN.json +2 -2
- package/src/locales/zh-TW.json +2 -2
- package/src/logic/base.js +15 -0
- package/src/logic/comment.js +5 -0
- package/src/logic/db.js +1 -0
- package/src/logic/token/2fa.js +1 -0
- package/src/logic/user.js +2 -0
- package/src/service/akismet.js +1 -0
- package/src/service/avatar.js +5 -0
- package/src/service/markdown/katex.js +2 -0
- package/src/service/markdown/mathCommon.js +5 -0
- package/src/service/markdown/mathjax.js +3 -0
- package/src/service/notify.js +109 -80
- package/src/service/storage/cloudbase.js +21 -0
- package/src/service/storage/deta.js +28 -0
- package/src/service/storage/github.js +77 -49
- package/src/service/storage/leancloud.js +42 -1
- package/src/service/storage/mongodb.js +17 -0
- package/src/service/storage/mysql.js +11 -0
- package/src/service/storage/postgresql.js +23 -2
- package/vanilla.js +1 -0
|
@@ -5,20 +5,37 @@ module.exports = class extends MySQL {
|
|
|
5
5
|
return super.model(tableName.toLowerCase());
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
async select(
|
|
9
|
-
const
|
|
8
|
+
async select(where, options = {}) {
|
|
9
|
+
const lowerWhere = {};
|
|
10
|
+
|
|
11
|
+
for (const i in where) {
|
|
12
|
+
lowerWhere[i.toLowerCase()] = where[i];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (options && options.desc) {
|
|
16
|
+
options.desc = options.desc.toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (Array.isArray(options.field)) {
|
|
20
|
+
options.field = options.field.map((field) => field.toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const data = await super.select(lowerWhere, options);
|
|
24
|
+
|
|
10
25
|
return data.map(({ insertedat, createdat, updatedat, ...item }) => {
|
|
11
26
|
const mapFields = {
|
|
12
27
|
insertedAt: insertedat,
|
|
13
28
|
createdAt: createdat,
|
|
14
29
|
updatedAt: updatedat,
|
|
15
30
|
};
|
|
31
|
+
|
|
16
32
|
for (const field in mapFields) {
|
|
17
33
|
if (!mapFields[field]) {
|
|
18
34
|
continue;
|
|
19
35
|
}
|
|
20
36
|
item[field] = mapFields[field];
|
|
21
37
|
}
|
|
38
|
+
|
|
22
39
|
return item;
|
|
23
40
|
});
|
|
24
41
|
}
|
|
@@ -28,17 +45,20 @@ module.exports = class extends MySQL {
|
|
|
28
45
|
.filter((key) => data[key])
|
|
29
46
|
.forEach((key) => {
|
|
30
47
|
const val = data[key];
|
|
48
|
+
|
|
31
49
|
data[key.toLowerCase()] =
|
|
32
50
|
val instanceof Date
|
|
33
51
|
? think.datetime(val, 'YYYY-MM-DD HH:mm:ss')
|
|
34
52
|
: val;
|
|
35
53
|
delete data[key];
|
|
36
54
|
});
|
|
55
|
+
|
|
37
56
|
return super.add(data);
|
|
38
57
|
}
|
|
39
58
|
|
|
40
59
|
async count(...args) {
|
|
41
60
|
let result = await super.count(...args);
|
|
61
|
+
|
|
42
62
|
try {
|
|
43
63
|
if (Array.isArray(result)) {
|
|
44
64
|
result.forEach((r) => {
|
|
@@ -50,6 +70,7 @@ module.exports = class extends MySQL {
|
|
|
50
70
|
} catch (e) {
|
|
51
71
|
console.log(e);
|
|
52
72
|
}
|
|
73
|
+
|
|
53
74
|
return result;
|
|
54
75
|
}
|
|
55
76
|
};
|