|
@@ -36,45 +36,48 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -36,45 +36,48 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
36
|
)
|
36
|
)
|
37
|
|
37
|
|
38
|
server.AddRoutes(
|
38
|
server.AddRoutes(
|
39
|
- []rest.Route{
|
|
|
40
|
- {
|
|
|
41
|
- Method: http.MethodPost,
|
|
|
42
|
- Path: "/article_comment",
|
|
|
43
|
- Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
|
|
|
44
|
- },
|
|
|
45
|
- {
|
|
|
46
|
- Method: http.MethodPost,
|
|
|
47
|
- Path: "/article_comment/list",
|
|
|
48
|
- Handler: comment.MiniListArticleCommentHandler(serverCtx),
|
|
|
49
|
- },
|
|
|
50
|
- {
|
|
|
51
|
- Method: http.MethodPost,
|
|
|
52
|
- Path: "/article_comment/top5",
|
|
|
53
|
- Handler: comment.MiniTop5ArticleCommentHandler(serverCtx),
|
|
|
54
|
- },
|
|
|
55
|
- {
|
|
|
56
|
- Method: http.MethodGet,
|
|
|
57
|
- Path: "/article_comment/:id",
|
|
|
58
|
- Handler: comment.MiniGetArticleCommentHandler(serverCtx),
|
|
|
59
|
- },
|
|
|
60
|
- {
|
|
|
61
|
- Method: http.MethodDelete,
|
|
|
62
|
- Path: "/article_comment/:id",
|
|
|
63
|
- Handler: comment.MiniDeleteArticleCommentHandler(serverCtx),
|
|
|
64
|
- },
|
|
|
65
|
- {
|
|
|
66
|
- Method: http.MethodPost,
|
|
|
67
|
- Path: "/article_comment/at_who/list",
|
|
|
68
|
- Handler: comment.MiniArticleCommentAtWhoHandler(serverCtx),
|
|
|
69
|
- },
|
|
|
70
|
- },
|
39
|
+ rest.WithMiddlewares(
|
|
|
40
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
41
|
+ []rest.Route{
|
|
|
42
|
+ {
|
|
|
43
|
+ Method: http.MethodPost,
|
|
|
44
|
+ Path: "/article_comment",
|
|
|
45
|
+ Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
|
|
|
46
|
+ },
|
|
|
47
|
+ {
|
|
|
48
|
+ Method: http.MethodPost,
|
|
|
49
|
+ Path: "/article_comment/list",
|
|
|
50
|
+ Handler: comment.MiniListArticleCommentHandler(serverCtx),
|
|
|
51
|
+ },
|
|
|
52
|
+ {
|
|
|
53
|
+ Method: http.MethodPost,
|
|
|
54
|
+ Path: "/article_comment/top5",
|
|
|
55
|
+ Handler: comment.MiniTop5ArticleCommentHandler(serverCtx),
|
|
|
56
|
+ },
|
|
|
57
|
+ {
|
|
|
58
|
+ Method: http.MethodGet,
|
|
|
59
|
+ Path: "/article_comment/:id",
|
|
|
60
|
+ Handler: comment.MiniGetArticleCommentHandler(serverCtx),
|
|
|
61
|
+ },
|
|
|
62
|
+ {
|
|
|
63
|
+ Method: http.MethodDelete,
|
|
|
64
|
+ Path: "/article_comment/:id",
|
|
|
65
|
+ Handler: comment.MiniDeleteArticleCommentHandler(serverCtx),
|
|
|
66
|
+ },
|
|
|
67
|
+ {
|
|
|
68
|
+ Method: http.MethodPost,
|
|
|
69
|
+ Path: "/article_comment/at_who/list",
|
|
|
70
|
+ Handler: comment.MiniArticleCommentAtWhoHandler(serverCtx),
|
|
|
71
|
+ },
|
|
|
72
|
+ }...,
|
|
|
73
|
+ ),
|
71
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
74
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
72
|
rest.WithPrefix("/v1/mini"),
|
75
|
rest.WithPrefix("/v1/mini"),
|
73
|
)
|
76
|
)
|
74
|
|
77
|
|
75
|
server.AddRoutes(
|
78
|
server.AddRoutes(
|
76
|
rest.WithMiddlewares(
|
79
|
rest.WithMiddlewares(
|
77
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
80
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
78
|
[]rest.Route{
|
81
|
[]rest.Route{
|
79
|
{
|
82
|
{
|
80
|
Method: http.MethodPost,
|
83
|
Method: http.MethodPost,
|
|
@@ -113,30 +116,33 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -113,30 +116,33 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
113
|
)
|
116
|
)
|
114
|
|
117
|
|
115
|
server.AddRoutes(
|
118
|
server.AddRoutes(
|
116
|
- []rest.Route{
|
|
|
117
|
- {
|
|
|
118
|
- Method: http.MethodPost,
|
|
|
119
|
- Path: "/mini/message/system",
|
|
|
120
|
- Handler: message.MiniSystemHandler(serverCtx),
|
|
|
121
|
- },
|
|
|
122
|
- {
|
|
|
123
|
- Method: http.MethodPost,
|
|
|
124
|
- Path: "/mini/message/comment",
|
|
|
125
|
- Handler: message.MiniCommentHandler(serverCtx),
|
|
|
126
|
- },
|
|
|
127
|
- {
|
|
|
128
|
- Method: http.MethodPost,
|
|
|
129
|
- Path: "/mini/message/like",
|
|
|
130
|
- Handler: message.MiniLikeHandler(serverCtx),
|
|
|
131
|
- },
|
|
|
132
|
- },
|
119
|
+ rest.WithMiddlewares(
|
|
|
120
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
121
|
+ []rest.Route{
|
|
|
122
|
+ {
|
|
|
123
|
+ Method: http.MethodPost,
|
|
|
124
|
+ Path: "/mini/message/system",
|
|
|
125
|
+ Handler: message.MiniSystemHandler(serverCtx),
|
|
|
126
|
+ },
|
|
|
127
|
+ {
|
|
|
128
|
+ Method: http.MethodPost,
|
|
|
129
|
+ Path: "/mini/message/comment",
|
|
|
130
|
+ Handler: message.MiniCommentHandler(serverCtx),
|
|
|
131
|
+ },
|
|
|
132
|
+ {
|
|
|
133
|
+ Method: http.MethodPost,
|
|
|
134
|
+ Path: "/mini/message/like",
|
|
|
135
|
+ Handler: message.MiniLikeHandler(serverCtx),
|
|
|
136
|
+ },
|
|
|
137
|
+ }...,
|
|
|
138
|
+ ),
|
133
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
139
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
134
|
rest.WithPrefix("/v1"),
|
140
|
rest.WithPrefix("/v1"),
|
135
|
)
|
141
|
)
|
136
|
|
142
|
|
137
|
server.AddRoutes(
|
143
|
server.AddRoutes(
|
138
|
rest.WithMiddlewares(
|
144
|
rest.WithMiddlewares(
|
139
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
145
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
140
|
[]rest.Route{
|
146
|
[]rest.Route{
|
141
|
{
|
147
|
{
|
142
|
Method: http.MethodPost,
|
148
|
Method: http.MethodPost,
|
|
@@ -191,90 +197,93 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -191,90 +197,93 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
191
|
)
|
197
|
)
|
192
|
|
198
|
|
193
|
server.AddRoutes(
|
199
|
server.AddRoutes(
|
194
|
- []rest.Route{
|
|
|
195
|
- {
|
|
|
196
|
- Method: http.MethodPost,
|
|
|
197
|
- Path: "/mini/user/switch_account",
|
|
|
198
|
- Handler: user.MiniUserSwitchAccountHandler(serverCtx),
|
|
|
199
|
- },
|
|
|
200
|
- {
|
|
|
201
|
- Method: http.MethodPost,
|
|
|
202
|
- Path: "/mini/user/info",
|
|
|
203
|
- Handler: user.MiniUserInfoHandler(serverCtx),
|
|
|
204
|
- },
|
|
|
205
|
- {
|
|
|
206
|
- Method: http.MethodPost,
|
|
|
207
|
- Path: "/mini/user/statistics",
|
|
|
208
|
- Handler: user.MiniUserStatisticsHandler(serverCtx),
|
|
|
209
|
- },
|
|
|
210
|
- {
|
|
|
211
|
- Method: http.MethodPost,
|
|
|
212
|
- Path: "/mini/user/audit_list",
|
|
|
213
|
- Handler: user.MiniUserAuditListHandler(serverCtx),
|
|
|
214
|
- },
|
|
|
215
|
- {
|
|
|
216
|
- Method: http.MethodPost,
|
|
|
217
|
- Path: "/mini/user/audit",
|
|
|
218
|
- Handler: user.MiniUserAuditHandler(serverCtx),
|
|
|
219
|
- },
|
|
|
220
|
- {
|
|
|
221
|
- Method: http.MethodPost,
|
|
|
222
|
- Path: "/mini/user/department_users",
|
|
|
223
|
- Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
|
|
|
224
|
- },
|
|
|
225
|
- {
|
|
|
226
|
- Method: http.MethodPost,
|
|
|
227
|
- Path: "/mini/user/user_list",
|
|
|
228
|
- Handler: user.MiniUsersListHandler(serverCtx),
|
|
|
229
|
- },
|
|
|
230
|
- {
|
|
|
231
|
- Method: http.MethodPost,
|
|
|
232
|
- Path: "/mini/user/news",
|
|
|
233
|
- Handler: user.MiniUserNewsHandler(serverCtx),
|
|
|
234
|
- },
|
|
|
235
|
- {
|
|
|
236
|
- Method: http.MethodPost,
|
|
|
237
|
- Path: "/mini/user/follower",
|
|
|
238
|
- Handler: user.MiniUserFollowerHandler(serverCtx),
|
|
|
239
|
- },
|
|
|
240
|
- {
|
|
|
241
|
- Method: http.MethodPost,
|
|
|
242
|
- Path: "/mini/user/following",
|
|
|
243
|
- Handler: user.MiniUserFollowingHandler(serverCtx),
|
|
|
244
|
- },
|
|
|
245
|
- {
|
|
|
246
|
- Method: http.MethodPost,
|
|
|
247
|
- Path: "/mini/user/following/latest_unread_list",
|
|
|
248
|
- Handler: user.MiniUserFollowingLatestUnreadListHandler(serverCtx),
|
|
|
249
|
- },
|
|
|
250
|
- {
|
|
|
251
|
- Method: http.MethodPost,
|
|
|
252
|
- Path: "/mini/user/following/mark_read",
|
|
|
253
|
- Handler: user.MiniUserFollowingMarkReadHandler(serverCtx),
|
|
|
254
|
- },
|
|
|
255
|
- {
|
|
|
256
|
- Method: http.MethodPost,
|
|
|
257
|
- Path: "/mini/user/follow",
|
|
|
258
|
- Handler: user.MiniUserFollowHandler(serverCtx),
|
|
|
259
|
- },
|
|
|
260
|
- {
|
|
|
261
|
- Method: http.MethodPost,
|
|
|
262
|
- Path: "/mini/user/unfollow",
|
|
|
263
|
- Handler: user.MiniUserUnFollowHandler(serverCtx),
|
|
|
264
|
- },
|
|
|
265
|
- {
|
|
|
266
|
- Method: http.MethodPost,
|
|
|
267
|
- Path: "/mini/user/mylike",
|
|
|
268
|
- Handler: user.MiniMyLikeHandler(serverCtx),
|
|
|
269
|
- },
|
|
|
270
|
- },
|
200
|
+ rest.WithMiddlewares(
|
|
|
201
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
202
|
+ []rest.Route{
|
|
|
203
|
+ {
|
|
|
204
|
+ Method: http.MethodPost,
|
|
|
205
|
+ Path: "/mini/user/switch_account",
|
|
|
206
|
+ Handler: user.MiniUserSwitchAccountHandler(serverCtx),
|
|
|
207
|
+ },
|
|
|
208
|
+ {
|
|
|
209
|
+ Method: http.MethodPost,
|
|
|
210
|
+ Path: "/mini/user/info",
|
|
|
211
|
+ Handler: user.MiniUserInfoHandler(serverCtx),
|
|
|
212
|
+ },
|
|
|
213
|
+ {
|
|
|
214
|
+ Method: http.MethodPost,
|
|
|
215
|
+ Path: "/mini/user/statistics",
|
|
|
216
|
+ Handler: user.MiniUserStatisticsHandler(serverCtx),
|
|
|
217
|
+ },
|
|
|
218
|
+ {
|
|
|
219
|
+ Method: http.MethodPost,
|
|
|
220
|
+ Path: "/mini/user/audit_list",
|
|
|
221
|
+ Handler: user.MiniUserAuditListHandler(serverCtx),
|
|
|
222
|
+ },
|
|
|
223
|
+ {
|
|
|
224
|
+ Method: http.MethodPost,
|
|
|
225
|
+ Path: "/mini/user/audit",
|
|
|
226
|
+ Handler: user.MiniUserAuditHandler(serverCtx),
|
|
|
227
|
+ },
|
|
|
228
|
+ {
|
|
|
229
|
+ Method: http.MethodPost,
|
|
|
230
|
+ Path: "/mini/user/department_users",
|
|
|
231
|
+ Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
|
|
|
232
|
+ },
|
|
|
233
|
+ {
|
|
|
234
|
+ Method: http.MethodPost,
|
|
|
235
|
+ Path: "/mini/user/user_list",
|
|
|
236
|
+ Handler: user.MiniUsersListHandler(serverCtx),
|
|
|
237
|
+ },
|
|
|
238
|
+ {
|
|
|
239
|
+ Method: http.MethodPost,
|
|
|
240
|
+ Path: "/mini/user/news",
|
|
|
241
|
+ Handler: user.MiniUserNewsHandler(serverCtx),
|
|
|
242
|
+ },
|
|
|
243
|
+ {
|
|
|
244
|
+ Method: http.MethodPost,
|
|
|
245
|
+ Path: "/mini/user/follower",
|
|
|
246
|
+ Handler: user.MiniUserFollowerHandler(serverCtx),
|
|
|
247
|
+ },
|
|
|
248
|
+ {
|
|
|
249
|
+ Method: http.MethodPost,
|
|
|
250
|
+ Path: "/mini/user/following",
|
|
|
251
|
+ Handler: user.MiniUserFollowingHandler(serverCtx),
|
|
|
252
|
+ },
|
|
|
253
|
+ {
|
|
|
254
|
+ Method: http.MethodPost,
|
|
|
255
|
+ Path: "/mini/user/following/latest_unread_list",
|
|
|
256
|
+ Handler: user.MiniUserFollowingLatestUnreadListHandler(serverCtx),
|
|
|
257
|
+ },
|
|
|
258
|
+ {
|
|
|
259
|
+ Method: http.MethodPost,
|
|
|
260
|
+ Path: "/mini/user/following/mark_read",
|
|
|
261
|
+ Handler: user.MiniUserFollowingMarkReadHandler(serverCtx),
|
|
|
262
|
+ },
|
|
|
263
|
+ {
|
|
|
264
|
+ Method: http.MethodPost,
|
|
|
265
|
+ Path: "/mini/user/follow",
|
|
|
266
|
+ Handler: user.MiniUserFollowHandler(serverCtx),
|
|
|
267
|
+ },
|
|
|
268
|
+ {
|
|
|
269
|
+ Method: http.MethodPost,
|
|
|
270
|
+ Path: "/mini/user/unfollow",
|
|
|
271
|
+ Handler: user.MiniUserUnFollowHandler(serverCtx),
|
|
|
272
|
+ },
|
|
|
273
|
+ {
|
|
|
274
|
+ Method: http.MethodPost,
|
|
|
275
|
+ Path: "/mini/user/mylike",
|
|
|
276
|
+ Handler: user.MiniMyLikeHandler(serverCtx),
|
|
|
277
|
+ },
|
|
|
278
|
+ }...,
|
|
|
279
|
+ ),
|
271
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
280
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
272
|
rest.WithPrefix("/v1"),
|
281
|
rest.WithPrefix("/v1"),
|
273
|
)
|
282
|
)
|
274
|
|
283
|
|
275
|
server.AddRoutes(
|
284
|
server.AddRoutes(
|
276
|
rest.WithMiddlewares(
|
285
|
rest.WithMiddlewares(
|
277
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
286
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
278
|
[]rest.Route{
|
287
|
[]rest.Route{
|
279
|
{
|
288
|
{
|
280
|
Method: http.MethodPost,
|
289
|
Method: http.MethodPost,
|
|
@@ -338,31 +347,37 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -338,31 +347,37 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
338
|
)
|
347
|
)
|
339
|
|
348
|
|
340
|
server.AddRoutes(
|
349
|
server.AddRoutes(
|
341
|
- []rest.Route{
|
|
|
342
|
- {
|
|
|
343
|
- Method: http.MethodPost,
|
|
|
344
|
- Path: "/mini/company/search",
|
|
|
345
|
- Handler: company.MiniCompanySearchHandler(serverCtx),
|
|
|
346
|
- },
|
|
|
347
|
- },
|
350
|
+ rest.WithMiddlewares(
|
|
|
351
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
352
|
+ []rest.Route{
|
|
|
353
|
+ {
|
|
|
354
|
+ Method: http.MethodPost,
|
|
|
355
|
+ Path: "/mini/company/search",
|
|
|
356
|
+ Handler: company.MiniCompanySearchHandler(serverCtx),
|
|
|
357
|
+ },
|
|
|
358
|
+ }...,
|
|
|
359
|
+ ),
|
348
|
rest.WithPrefix("/v1"),
|
360
|
rest.WithPrefix("/v1"),
|
349
|
)
|
361
|
)
|
350
|
|
362
|
|
351
|
server.AddRoutes(
|
363
|
server.AddRoutes(
|
352
|
- []rest.Route{
|
|
|
353
|
- {
|
|
|
354
|
- Method: http.MethodPost,
|
|
|
355
|
- Path: "/mini/company/search-joined",
|
|
|
356
|
- Handler: company.MiniCompanySearchJoinedHandler(serverCtx),
|
|
|
357
|
- },
|
|
|
358
|
- },
|
364
|
+ rest.WithMiddlewares(
|
|
|
365
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
366
|
+ []rest.Route{
|
|
|
367
|
+ {
|
|
|
368
|
+ Method: http.MethodPost,
|
|
|
369
|
+ Path: "/mini/company/search-joined",
|
|
|
370
|
+ Handler: company.MiniCompanySearchJoinedHandler(serverCtx),
|
|
|
371
|
+ },
|
|
|
372
|
+ }...,
|
|
|
373
|
+ ),
|
359
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
374
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
360
|
rest.WithPrefix("/v1"),
|
375
|
rest.WithPrefix("/v1"),
|
361
|
)
|
376
|
)
|
362
|
|
377
|
|
363
|
server.AddRoutes(
|
378
|
server.AddRoutes(
|
364
|
rest.WithMiddlewares(
|
379
|
rest.WithMiddlewares(
|
365
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
380
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
366
|
[]rest.Route{
|
381
|
[]rest.Route{
|
367
|
{
|
382
|
{
|
368
|
Method: http.MethodPost,
|
383
|
Method: http.MethodPost,
|
|
@@ -381,100 +396,103 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -381,100 +396,103 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
381
|
)
|
396
|
)
|
382
|
|
397
|
|
383
|
server.AddRoutes(
|
398
|
server.AddRoutes(
|
384
|
- []rest.Route{
|
|
|
385
|
- {
|
|
|
386
|
- Method: http.MethodPost,
|
|
|
387
|
- Path: "/article",
|
|
|
388
|
- Handler: article.MiniCreateArticleHandler(serverCtx),
|
|
|
389
|
- },
|
|
|
390
|
- {
|
|
|
391
|
- Method: http.MethodGet,
|
|
|
392
|
- Path: "/article/:id",
|
|
|
393
|
- Handler: article.MiniGetArticleHandler(serverCtx),
|
|
|
394
|
- },
|
|
|
395
|
- {
|
|
|
396
|
- Method: http.MethodPost,
|
|
|
397
|
- Path: "/article/user_like/list",
|
|
|
398
|
- Handler: article.MiniUserLikeArticleHandler(serverCtx),
|
|
|
399
|
- },
|
|
|
400
|
- {
|
|
|
401
|
- Method: http.MethodPost,
|
|
|
402
|
- Path: "/article/user_like/set",
|
|
|
403
|
- Handler: article.MiniSetUserLikeHandler(serverCtx),
|
|
|
404
|
- },
|
|
|
405
|
- {
|
|
|
406
|
- Method: http.MethodPost,
|
|
|
407
|
- Path: "/article/mark/user_read",
|
|
|
408
|
- Handler: article.MiniArticleMarkUserReadHandler(serverCtx),
|
|
|
409
|
- },
|
|
|
410
|
- {
|
|
|
411
|
- Method: http.MethodPost,
|
|
|
412
|
- Path: "/article/mark/list",
|
|
|
413
|
- Handler: article.MiniArticleMarkListHandler(serverCtx),
|
|
|
414
|
- },
|
|
|
415
|
- {
|
|
|
416
|
- Method: http.MethodPost,
|
|
|
417
|
- Path: "/article/search/me",
|
|
|
418
|
- Handler: article.MiniArticleSearchMeHandler(serverCtx),
|
|
|
419
|
- },
|
|
|
420
|
- {
|
|
|
421
|
- Method: http.MethodPost,
|
|
|
422
|
- Path: "/article_draft",
|
|
|
423
|
- Handler: article.MiniCreateArticleDraftHandler(serverCtx),
|
|
|
424
|
- },
|
|
|
425
|
- {
|
|
|
426
|
- Method: http.MethodPut,
|
|
|
427
|
- Path: "/article_draft",
|
|
|
428
|
- Handler: article.MiniUpdateArticleDraftHandler(serverCtx),
|
|
|
429
|
- },
|
|
|
430
|
- {
|
|
|
431
|
- Method: http.MethodPost,
|
|
|
432
|
- Path: "/article_draft/search/me",
|
|
|
433
|
- Handler: article.MiniSearchArticleDraftMeHandler(serverCtx),
|
|
|
434
|
- },
|
|
|
435
|
- {
|
|
|
436
|
- Method: http.MethodGet,
|
|
|
437
|
- Path: "/article_draft/me/:id",
|
|
|
438
|
- Handler: article.MiniGetArticleDraftMeHandler(serverCtx),
|
|
|
439
|
- },
|
|
|
440
|
- {
|
|
|
441
|
- Method: http.MethodDelete,
|
|
|
442
|
- Path: "/article_draft/me/:id",
|
|
|
443
|
- Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx),
|
|
|
444
|
- },
|
|
|
445
|
- {
|
|
|
446
|
- Method: http.MethodPost,
|
|
|
447
|
- Path: "/article_backup/search",
|
|
|
448
|
- Handler: article.MiniArticleBackupSearchHandler(serverCtx),
|
|
|
449
|
- },
|
|
|
450
|
- {
|
|
|
451
|
- Method: http.MethodPost,
|
|
|
452
|
- Path: "/article/set_tag",
|
|
|
453
|
- Handler: article.MiniArticleSetTagHandler(serverCtx),
|
|
|
454
|
- },
|
|
|
455
|
- {
|
|
|
456
|
- Method: http.MethodGet,
|
|
|
457
|
- Path: "/article_tag/list/all",
|
|
|
458
|
- Handler: article.MiniAllArticleTagHandler(serverCtx),
|
|
|
459
|
- },
|
|
|
460
|
- {
|
|
|
461
|
- Method: http.MethodGet,
|
|
|
462
|
- Path: "/show/home_page",
|
|
|
463
|
- Handler: article.MiniShowHomePageHandler(serverCtx),
|
|
|
464
|
- },
|
|
|
465
|
- {
|
|
|
466
|
- Method: http.MethodPost,
|
|
|
467
|
- Path: "/show/search_article",
|
|
|
468
|
- Handler: article.MiniSearchArticlePageHandler(serverCtx),
|
|
|
469
|
- },
|
|
|
470
|
- },
|
399
|
+ rest.WithMiddlewares(
|
|
|
400
|
+ []rest.Middleware{serverCtx.LogRequest},
|
|
|
401
|
+ []rest.Route{
|
|
|
402
|
+ {
|
|
|
403
|
+ Method: http.MethodPost,
|
|
|
404
|
+ Path: "/article",
|
|
|
405
|
+ Handler: article.MiniCreateArticleHandler(serverCtx),
|
|
|
406
|
+ },
|
|
|
407
|
+ {
|
|
|
408
|
+ Method: http.MethodGet,
|
|
|
409
|
+ Path: "/article/:id",
|
|
|
410
|
+ Handler: article.MiniGetArticleHandler(serverCtx),
|
|
|
411
|
+ },
|
|
|
412
|
+ {
|
|
|
413
|
+ Method: http.MethodPost,
|
|
|
414
|
+ Path: "/article/user_like/list",
|
|
|
415
|
+ Handler: article.MiniUserLikeArticleHandler(serverCtx),
|
|
|
416
|
+ },
|
|
|
417
|
+ {
|
|
|
418
|
+ Method: http.MethodPost,
|
|
|
419
|
+ Path: "/article/user_like/set",
|
|
|
420
|
+ Handler: article.MiniSetUserLikeHandler(serverCtx),
|
|
|
421
|
+ },
|
|
|
422
|
+ {
|
|
|
423
|
+ Method: http.MethodPost,
|
|
|
424
|
+ Path: "/article/mark/user_read",
|
|
|
425
|
+ Handler: article.MiniArticleMarkUserReadHandler(serverCtx),
|
|
|
426
|
+ },
|
|
|
427
|
+ {
|
|
|
428
|
+ Method: http.MethodPost,
|
|
|
429
|
+ Path: "/article/mark/list",
|
|
|
430
|
+ Handler: article.MiniArticleMarkListHandler(serverCtx),
|
|
|
431
|
+ },
|
|
|
432
|
+ {
|
|
|
433
|
+ Method: http.MethodPost,
|
|
|
434
|
+ Path: "/article/search/me",
|
|
|
435
|
+ Handler: article.MiniArticleSearchMeHandler(serverCtx),
|
|
|
436
|
+ },
|
|
|
437
|
+ {
|
|
|
438
|
+ Method: http.MethodPost,
|
|
|
439
|
+ Path: "/article_draft",
|
|
|
440
|
+ Handler: article.MiniCreateArticleDraftHandler(serverCtx),
|
|
|
441
|
+ },
|
|
|
442
|
+ {
|
|
|
443
|
+ Method: http.MethodPut,
|
|
|
444
|
+ Path: "/article_draft",
|
|
|
445
|
+ Handler: article.MiniUpdateArticleDraftHandler(serverCtx),
|
|
|
446
|
+ },
|
|
|
447
|
+ {
|
|
|
448
|
+ Method: http.MethodPost,
|
|
|
449
|
+ Path: "/article_draft/search/me",
|
|
|
450
|
+ Handler: article.MiniSearchArticleDraftMeHandler(serverCtx),
|
|
|
451
|
+ },
|
|
|
452
|
+ {
|
|
|
453
|
+ Method: http.MethodGet,
|
|
|
454
|
+ Path: "/article_draft/me/:id",
|
|
|
455
|
+ Handler: article.MiniGetArticleDraftMeHandler(serverCtx),
|
|
|
456
|
+ },
|
|
|
457
|
+ {
|
|
|
458
|
+ Method: http.MethodDelete,
|
|
|
459
|
+ Path: "/article_draft/me/:id",
|
|
|
460
|
+ Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx),
|
|
|
461
|
+ },
|
|
|
462
|
+ {
|
|
|
463
|
+ Method: http.MethodPost,
|
|
|
464
|
+ Path: "/article_backup/search",
|
|
|
465
|
+ Handler: article.MiniArticleBackupSearchHandler(serverCtx),
|
|
|
466
|
+ },
|
|
|
467
|
+ {
|
|
|
468
|
+ Method: http.MethodPost,
|
|
|
469
|
+ Path: "/article/set_tag",
|
|
|
470
|
+ Handler: article.MiniArticleSetTagHandler(serverCtx),
|
|
|
471
|
+ },
|
|
|
472
|
+ {
|
|
|
473
|
+ Method: http.MethodGet,
|
|
|
474
|
+ Path: "/article_tag/list/all",
|
|
|
475
|
+ Handler: article.MiniAllArticleTagHandler(serverCtx),
|
|
|
476
|
+ },
|
|
|
477
|
+ {
|
|
|
478
|
+ Method: http.MethodGet,
|
|
|
479
|
+ Path: "/show/home_page",
|
|
|
480
|
+ Handler: article.MiniShowHomePageHandler(serverCtx),
|
|
|
481
|
+ },
|
|
|
482
|
+ {
|
|
|
483
|
+ Method: http.MethodPost,
|
|
|
484
|
+ Path: "/show/search_article",
|
|
|
485
|
+ Handler: article.MiniSearchArticlePageHandler(serverCtx),
|
|
|
486
|
+ },
|
|
|
487
|
+ }...,
|
|
|
488
|
+ ),
|
471
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
489
|
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
|
472
|
rest.WithPrefix("/v1/mini"),
|
490
|
rest.WithPrefix("/v1/mini"),
|
473
|
)
|
491
|
)
|
474
|
|
492
|
|
475
|
server.AddRoutes(
|
493
|
server.AddRoutes(
|
476
|
rest.WithMiddlewares(
|
494
|
rest.WithMiddlewares(
|
477
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
495
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
478
|
[]rest.Route{
|
496
|
[]rest.Route{
|
479
|
{
|
497
|
{
|
480
|
Method: http.MethodGet,
|
498
|
Method: http.MethodGet,
|
|
@@ -519,7 +537,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -519,7 +537,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
519
|
|
537
|
|
520
|
server.AddRoutes(
|
538
|
server.AddRoutes(
|
521
|
rest.WithMiddlewares(
|
539
|
rest.WithMiddlewares(
|
522
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
540
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
523
|
[]rest.Route{
|
541
|
[]rest.Route{
|
524
|
{
|
542
|
{
|
525
|
Method: http.MethodGet,
|
543
|
Method: http.MethodGet,
|
|
@@ -554,7 +572,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
|
@@ -554,7 +572,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { |
554
|
|
572
|
|
555
|
server.AddRoutes(
|
573
|
server.AddRoutes(
|
556
|
rest.WithMiddlewares(
|
574
|
rest.WithMiddlewares(
|
557
|
- []rest.Middleware{serverCtx.LoginStatusCheck},
|
575
|
+ []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
|
558
|
[]rest.Route{
|
576
|
[]rest.Route{
|
559
|
{
|
577
|
{
|
560
|
Method: http.MethodPost,
|
578
|
Method: http.MethodPost,
|