create-skweb 3.3.6 → 3.3.7

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.
@@ -1,17 +1,17 @@
1
1
 
2
- > create-skweb@3.3.6 prebuild
2
+ > create-skweb@3.3.7 prebuild
3
3
  > tsc --outDir dist --rootDir src
4
4
 
5
5
  ⠙
6
- > create-skweb@3.3.6 build
6
+ > create-skweb@3.3.7 build
7
7
  > rollup -c rollup.config.mjs && node scripts/inject-shebang.mjs && chmod +x dist/cli.js
8
8
 
9
9
  ⠙
10
10
  src/index.ts → dist/index.js...
11
11
  (!) [plugin typescript] @rollup/plugin-typescript: outputToFilesystem option is defaulting to true.
12
- created dist/index.js in 346ms
12
+ created dist/index.js in 347ms
13
13
  
14
14
  src/cli.ts → dist/cli.js...
15
- created dist/cli.js in 178ms
15
+ created dist/cli.js in 176ms
16
16
  [inject-shebang] Shebang added to /Users/stayknight/projects/skweb-mono/tools/create-skweb/dist/cli.js
17
17
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # create-skweb
2
2
 
3
+ ## 3.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - user 控制器添加 jwt 认证和 swagger security 定义
8
+
3
9
  ## 3.3.6
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skweb",
3
- "version": "3.3.6",
3
+ "version": "3.3.7",
4
4
  "description": "Create a new SKWeb project with TypeScript, CJS, or MJS support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -7,6 +7,8 @@ const { SysUser } = require('../models/SysUser.js')
7
7
  * get:
8
8
  * summary: 获取用户列表
9
9
  * tags: [Users]
10
+ * security:
11
+ * - bearerAuth: []
10
12
  * parameters:
11
13
  * - in: query
12
14
  * name: page
@@ -23,6 +25,7 @@ const { SysUser } = require('../models/SysUser.js')
23
25
  const userList = {
24
26
  method: 'get',
25
27
  path: '/api/users',
28
+ jwt: true,
26
29
  async handler(req) {
27
30
  const { page = 1, limit = 10 } = req.query
28
31
  const users = await SysUser.findAndCountAll({
@@ -42,6 +45,8 @@ const userList = {
42
45
  * get:
43
46
  * summary: 获取单个用户
44
47
  * tags: [Users]
48
+ * security:
49
+ * - bearerAuth: []
45
50
  * parameters:
46
51
  * - in: path
47
52
  * name: id
@@ -56,6 +61,7 @@ const userList = {
56
61
  const userGet = {
57
62
  method: 'get',
58
63
  path: '/api/users/:id',
64
+ jwt: true,
59
65
  paramsSchema: {
60
66
  type: 'object',
61
67
  required: ['id'],
@@ -77,6 +83,8 @@ const userGet = {
77
83
  * post:
78
84
  * summary: 创建用户
79
85
  * tags: [Users]
86
+ * security:
87
+ * - bearerAuth: []
80
88
  * requestBody:
81
89
  * required: true
82
90
  * content:
@@ -96,6 +104,7 @@ const userGet = {
96
104
  const userCreate = {
97
105
  method: 'post',
98
106
  path: '/api/users',
107
+ jwt: true,
99
108
  bodySchema: {
100
109
  type: 'object',
101
110
  required: ['username', 'password'],
@@ -117,6 +126,8 @@ const userCreate = {
117
126
  * put:
118
127
  * summary: 更新用户
119
128
  * tags: [Users]
129
+ * security:
130
+ * - bearerAuth: []
120
131
  * parameters:
121
132
  * - in: path
122
133
  * name: id
@@ -142,6 +153,7 @@ const userCreate = {
142
153
  const userUpdate = {
143
154
  method: 'put',
144
155
  path: '/api/users/:id',
156
+ jwt: true,
145
157
  paramsSchema: {
146
158
  type: 'object',
147
159
  required: ['id'],
@@ -173,6 +185,8 @@ const userUpdate = {
173
185
  * delete:
174
186
  * summary: 删除用户
175
187
  * tags: [Users]
188
+ * security:
189
+ * - bearerAuth: []
176
190
  * parameters:
177
191
  * - in: path
178
192
  * name: id
@@ -187,6 +201,7 @@ const userUpdate = {
187
201
  const userDelete = {
188
202
  method: 'delete',
189
203
  path: '/api/users/:id',
204
+ jwt: true,
190
205
  paramsSchema: {
191
206
  type: 'object',
192
207
  required: ['id'],
@@ -7,6 +7,8 @@ import { SysUser } from '../models/SysUser.js'
7
7
  * get:
8
8
  * summary: 获取用户列表
9
9
  * tags: [Users]
10
+ * security:
11
+ * - bearerAuth: []
10
12
  * parameters:
11
13
  * - in: query
12
14
  * name: page
@@ -23,6 +25,7 @@ import { SysUser } from '../models/SysUser.js'
23
25
  const userList = {
24
26
  method: 'get',
25
27
  path: '/api/users',
28
+ jwt: true,
26
29
  async handler(req) {
27
30
  const { page = 1, limit = 10 } = req.query
28
31
  const users = await SysUser.findAndCountAll({
@@ -42,6 +45,8 @@ const userList = {
42
45
  * get:
43
46
  * summary: 获取单个用户
44
47
  * tags: [Users]
48
+ * security:
49
+ * - bearerAuth: []
45
50
  * parameters:
46
51
  * - in: path
47
52
  * name: id
@@ -56,6 +61,7 @@ const userList = {
56
61
  const userGet = {
57
62
  method: 'get',
58
63
  path: '/api/users/:id',
64
+ jwt: true,
59
65
  paramsSchema: {
60
66
  type: 'object',
61
67
  required: ['id'],
@@ -77,6 +83,8 @@ const userGet = {
77
83
  * post:
78
84
  * summary: 创建用户
79
85
  * tags: [Users]
86
+ * security:
87
+ * - bearerAuth: []
80
88
  * requestBody:
81
89
  * required: true
82
90
  * content:
@@ -96,6 +104,7 @@ const userGet = {
96
104
  const userCreate = {
97
105
  method: 'post',
98
106
  path: '/api/users',
107
+ jwt: true,
99
108
  bodySchema: {
100
109
  type: 'object',
101
110
  required: ['username', 'password'],
@@ -117,6 +126,8 @@ const userCreate = {
117
126
  * put:
118
127
  * summary: 更新用户
119
128
  * tags: [Users]
129
+ * security:
130
+ * - bearerAuth: []
120
131
  * parameters:
121
132
  * - in: path
122
133
  * name: id
@@ -142,6 +153,7 @@ const userCreate = {
142
153
  const userUpdate = {
143
154
  method: 'put',
144
155
  path: '/api/users/:id',
156
+ jwt: true,
145
157
  paramsSchema: {
146
158
  type: 'object',
147
159
  required: ['id'],
@@ -173,6 +185,8 @@ const userUpdate = {
173
185
  * delete:
174
186
  * summary: 删除用户
175
187
  * tags: [Users]
188
+ * security:
189
+ * - bearerAuth: []
176
190
  * parameters:
177
191
  * - in: path
178
192
  * name: id
@@ -187,6 +201,7 @@ const userUpdate = {
187
201
  const userDelete = {
188
202
  method: 'delete',
189
203
  path: '/api/users/:id',
204
+ jwt: true,
190
205
  paramsSchema: {
191
206
  type: 'object',
192
207
  required: ['id'],
@@ -7,6 +7,8 @@ import { SysUser } from '../models/SysUser.js'
7
7
  * get:
8
8
  * summary: 获取用户列表
9
9
  * tags: [Users]
10
+ * security:
11
+ * - bearerAuth: []
10
12
  * parameters:
11
13
  * - in: query
12
14
  * name: page
@@ -23,6 +25,7 @@ import { SysUser } from '../models/SysUser.js'
23
25
  const userList = {
24
26
  method: 'get',
25
27
  path: '/api/users',
28
+ jwt: true,
26
29
  async handler(req: any) {
27
30
  const { page = 1, limit = 10 } = req.query
28
31
  const users = await SysUser.findAndCountAll({
@@ -42,6 +45,8 @@ const userList = {
42
45
  * get:
43
46
  * summary: 获取单个用户
44
47
  * tags: [Users]
48
+ * security:
49
+ * - bearerAuth: []
45
50
  * parameters:
46
51
  * - in: path
47
52
  * name: id
@@ -56,6 +61,7 @@ const userList = {
56
61
  const userGet = {
57
62
  method: 'get',
58
63
  path: '/api/users/:id',
64
+ jwt: true,
59
65
  paramsSchema: {
60
66
  type: 'object',
61
67
  required: ['id'],
@@ -77,6 +83,8 @@ const userGet = {
77
83
  * post:
78
84
  * summary: 创建用户
79
85
  * tags: [Users]
86
+ * security:
87
+ * - bearerAuth: []
80
88
  * requestBody:
81
89
  * required: true
82
90
  * content:
@@ -96,6 +104,7 @@ const userGet = {
96
104
  const userCreate = {
97
105
  method: 'post',
98
106
  path: '/api/users',
107
+ jwt: true,
99
108
  bodySchema: {
100
109
  type: 'object',
101
110
  required: ['username', 'password'],
@@ -117,6 +126,8 @@ const userCreate = {
117
126
  * put:
118
127
  * summary: 更新用户
119
128
  * tags: [Users]
129
+ * security:
130
+ * - bearerAuth: []
120
131
  * parameters:
121
132
  * - in: path
122
133
  * name: id
@@ -142,6 +153,7 @@ const userCreate = {
142
153
  const userUpdate = {
143
154
  method: 'put',
144
155
  path: '/api/users/:id',
156
+ jwt: true,
145
157
  paramsSchema: {
146
158
  type: 'object',
147
159
  required: ['id'],
@@ -173,6 +185,8 @@ const userUpdate = {
173
185
  * delete:
174
186
  * summary: 删除用户
175
187
  * tags: [Users]
188
+ * security:
189
+ * - bearerAuth: []
176
190
  * parameters:
177
191
  * - in: path
178
192
  * name: id
@@ -187,6 +201,7 @@ const userUpdate = {
187
201
  const userDelete = {
188
202
  method: 'delete',
189
203
  path: '/api/users/:id',
204
+ jwt: true,
190
205
  paramsSchema: {
191
206
  type: 'object',
192
207
  required: ['id'],