routes.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851
  1. // Code generated by goctl. DO NOT EDIT.
  2. package handler
  3. import (
  4. "net/http"
  5. ChatRoomMember "wechat-api/internal/handler/ChatRoomMember"
  6. Message "wechat-api/internal/handler/Message"
  7. Msg "wechat-api/internal/handler/Msg"
  8. User "wechat-api/internal/handler/User"
  9. WechatServer "wechat-api/internal/handler/WechatServer"
  10. Wx "wechat-api/internal/handler/Wx"
  11. Wxhook "wechat-api/internal/handler/Wxhook"
  12. agent "wechat-api/internal/handler/agent"
  13. base "wechat-api/internal/handler/base"
  14. batch_msg "wechat-api/internal/handler/batch_msg"
  15. category "wechat-api/internal/handler/category"
  16. contact "wechat-api/internal/handler/contact"
  17. employee "wechat-api/internal/handler/employee"
  18. employee_config "wechat-api/internal/handler/employee_config"
  19. label "wechat-api/internal/handler/label"
  20. label_relationship "wechat-api/internal/handler/label_relationship"
  21. message_records "wechat-api/internal/handler/message_records"
  22. openapi "wechat-api/internal/handler/openapi"
  23. sop_node "wechat-api/internal/handler/sop_node"
  24. sop_stage "wechat-api/internal/handler/sop_stage"
  25. sop_task "wechat-api/internal/handler/sop_task"
  26. token "wechat-api/internal/handler/token"
  27. tutorial "wechat-api/internal/handler/tutorial"
  28. work_experience "wechat-api/internal/handler/work_experience"
  29. "wechat-api/internal/svc"
  30. "github.com/zeromicro/go-zero/rest"
  31. )
  32. func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
  33. server.AddRoutes(
  34. []rest.Route{
  35. {
  36. Method: http.MethodGet,
  37. Path: "/init/database",
  38. Handler: base.InitDatabaseHandler(serverCtx),
  39. },
  40. },
  41. )
  42. server.AddRoutes(
  43. rest.WithMiddlewares(
  44. []rest.Middleware{serverCtx.Authority},
  45. []rest.Route{
  46. {
  47. Method: http.MethodPost,
  48. Path: "/server/create",
  49. Handler: WechatServer.CreateServerHandler(serverCtx),
  50. },
  51. {
  52. Method: http.MethodPost,
  53. Path: "/server/update",
  54. Handler: WechatServer.UpdateServerHandler(serverCtx),
  55. },
  56. {
  57. Method: http.MethodPost,
  58. Path: "/server/delete",
  59. Handler: WechatServer.DeleteServerHandler(serverCtx),
  60. },
  61. {
  62. Method: http.MethodPost,
  63. Path: "/server/list",
  64. Handler: WechatServer.GetServerListHandler(serverCtx),
  65. },
  66. {
  67. Method: http.MethodPost,
  68. Path: "/server",
  69. Handler: WechatServer.GetServerByIdHandler(serverCtx),
  70. },
  71. }...,
  72. ),
  73. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  74. )
  75. server.AddRoutes(
  76. rest.WithMiddlewares(
  77. []rest.Middleware{serverCtx.Authority},
  78. []rest.Route{
  79. {
  80. Method: http.MethodPost,
  81. Path: "/wx/create",
  82. Handler: Wx.CreateWxHandler(serverCtx),
  83. },
  84. {
  85. Method: http.MethodPost,
  86. Path: "/wx/check",
  87. Handler: Wx.CheckWxHandler(serverCtx),
  88. },
  89. {
  90. Method: http.MethodPost,
  91. Path: "/wx/update",
  92. Handler: Wx.UpdateWxHandler(serverCtx),
  93. },
  94. {
  95. Method: http.MethodPost,
  96. Path: "/wx/delete",
  97. Handler: Wx.DeleteWxHandler(serverCtx),
  98. },
  99. {
  100. Method: http.MethodPost,
  101. Path: "/wx/list",
  102. Handler: Wx.GetWxListHandler(serverCtx),
  103. },
  104. {
  105. Method: http.MethodPost,
  106. Path: "/wx",
  107. Handler: Wx.GetWxByIdHandler(serverCtx),
  108. },
  109. }...,
  110. ),
  111. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  112. )
  113. server.AddRoutes(
  114. rest.WithMiddlewares(
  115. []rest.Middleware{serverCtx.Authority},
  116. []rest.Route{
  117. {
  118. Method: http.MethodPost,
  119. Path: "/agent/create",
  120. Handler: agent.CreateAgentHandler(serverCtx),
  121. },
  122. {
  123. Method: http.MethodPost,
  124. Path: "/agent/update",
  125. Handler: agent.UpdateAgentHandler(serverCtx),
  126. },
  127. {
  128. Method: http.MethodPost,
  129. Path: "/agent/delete",
  130. Handler: agent.DeleteAgentHandler(serverCtx),
  131. },
  132. {
  133. Method: http.MethodPost,
  134. Path: "/agent/list",
  135. Handler: agent.GetAgentListHandler(serverCtx),
  136. },
  137. {
  138. Method: http.MethodPost,
  139. Path: "/agent",
  140. Handler: agent.GetAgentByIdHandler(serverCtx),
  141. },
  142. {
  143. Method: http.MethodPost,
  144. Path: "/agent/collection/list",
  145. Handler: agent.GetAgentCollectionListHandler(serverCtx),
  146. },
  147. {
  148. Method: http.MethodPost,
  149. Path: "/agent/data/list",
  150. Handler: agent.GetAgentDataListHandler(serverCtx),
  151. },
  152. {
  153. Method: http.MethodPost,
  154. Path: "/agent/data/create",
  155. Handler: agent.CreateAgentDataHandler(serverCtx),
  156. },
  157. {
  158. Method: http.MethodPost,
  159. Path: "/agent/data/update",
  160. Handler: agent.UpdateAgentDataHandler(serverCtx),
  161. },
  162. }...,
  163. ),
  164. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  165. )
  166. server.AddRoutes(
  167. []rest.Route{
  168. {
  169. Method: http.MethodPost,
  170. Path: "/wxhook/sendTextMsg",
  171. Handler: Wxhook.SendTextMsgHandler(serverCtx),
  172. },
  173. },
  174. )
  175. server.AddRoutes(
  176. rest.WithMiddlewares(
  177. []rest.Middleware{serverCtx.Authority},
  178. []rest.Route{
  179. {
  180. Method: http.MethodPost,
  181. Path: "/wxhook/refreshLoginQR",
  182. Handler: Wxhook.RefreshLoginQRHandler(serverCtx),
  183. },
  184. {
  185. Method: http.MethodPost,
  186. Path: "/wxhook/logout",
  187. Handler: Wxhook.LogoutHandler(serverCtx),
  188. },
  189. {
  190. Method: http.MethodPost,
  191. Path: "/wxhook/getFriendsAndGroups",
  192. Handler: Wxhook.GetFriendsAndGroupsHandler(serverCtx),
  193. },
  194. {
  195. Method: http.MethodPost,
  196. Path: "/wxhook/sendPicMsg",
  197. Handler: Wxhook.SendPicMsgHandler(serverCtx),
  198. },
  199. {
  200. Method: http.MethodPost,
  201. Path: "/wxhook/sendPicMsgLocal",
  202. Handler: Wxhook.SendPicMsgLocalHandler(serverCtx),
  203. },
  204. }...,
  205. ),
  206. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  207. )
  208. server.AddRoutes(
  209. rest.WithMiddlewares(
  210. []rest.Middleware{serverCtx.Authority},
  211. []rest.Route{
  212. {
  213. Method: http.MethodPost,
  214. Path: "/contact/create",
  215. Handler: contact.CreateContactHandler(serverCtx),
  216. },
  217. {
  218. Method: http.MethodPost,
  219. Path: "/contact/update",
  220. Handler: contact.UpdateContactHandler(serverCtx),
  221. },
  222. {
  223. Method: http.MethodPost,
  224. Path: "/contact/delete",
  225. Handler: contact.DeleteContactHandler(serverCtx),
  226. },
  227. {
  228. Method: http.MethodPost,
  229. Path: "/contact/list",
  230. Handler: contact.GetContactListHandler(serverCtx),
  231. },
  232. {
  233. Method: http.MethodPost,
  234. Path: "/contact",
  235. Handler: contact.GetContactByIdHandler(serverCtx),
  236. },
  237. {
  238. Method: http.MethodPost,
  239. Path: "/contact/addNewFriend",
  240. Handler: contact.AddNewFriendHandler(serverCtx),
  241. },
  242. }...,
  243. ),
  244. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  245. )
  246. server.AddRoutes(
  247. rest.WithMiddlewares(
  248. []rest.Middleware{serverCtx.Authority},
  249. []rest.Route{
  250. {
  251. Method: http.MethodPost,
  252. Path: "/label_relationship/create",
  253. Handler: label_relationship.CreateLabelRelationshipHandler(serverCtx),
  254. },
  255. {
  256. Method: http.MethodPost,
  257. Path: "/label_relationship/update",
  258. Handler: label_relationship.UpdateLabelRelationshipHandler(serverCtx),
  259. },
  260. {
  261. Method: http.MethodPost,
  262. Path: "/label_relationship/update_contact_labels",
  263. Handler: label_relationship.UpdateLabelRelationshipsHandler(serverCtx),
  264. },
  265. {
  266. Method: http.MethodPost,
  267. Path: "/label_relationship/batch_update_contact_labels",
  268. Handler: label_relationship.BatchUpdateLabelRelationshipsHandler(serverCtx),
  269. },
  270. {
  271. Method: http.MethodPost,
  272. Path: "/label_relationship/delete",
  273. Handler: label_relationship.DeleteLabelRelationshipHandler(serverCtx),
  274. },
  275. {
  276. Method: http.MethodPost,
  277. Path: "/label_relationship/list",
  278. Handler: label_relationship.GetLabelRelationshipListHandler(serverCtx),
  279. },
  280. {
  281. Method: http.MethodPost,
  282. Path: "/label_relationship",
  283. Handler: label_relationship.GetLabelRelationshipByIdHandler(serverCtx),
  284. },
  285. }...,
  286. ),
  287. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  288. )
  289. server.AddRoutes(
  290. rest.WithMiddlewares(
  291. []rest.Middleware{serverCtx.Authority},
  292. []rest.Route{
  293. {
  294. Method: http.MethodPost,
  295. Path: "/message/create",
  296. Handler: Message.CreateMessageHandler(serverCtx),
  297. },
  298. {
  299. Method: http.MethodPost,
  300. Path: "/message/update",
  301. Handler: Message.UpdateMessageHandler(serverCtx),
  302. },
  303. {
  304. Method: http.MethodPost,
  305. Path: "/message/delete",
  306. Handler: Message.DeleteMessageHandler(serverCtx),
  307. },
  308. {
  309. Method: http.MethodPost,
  310. Path: "/message/list",
  311. Handler: Message.GetMessageListHandler(serverCtx),
  312. },
  313. {
  314. Method: http.MethodPost,
  315. Path: "/message",
  316. Handler: Message.GetMessageByIdHandler(serverCtx),
  317. },
  318. }...,
  319. ),
  320. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  321. )
  322. server.AddRoutes(
  323. rest.WithMiddlewares(
  324. []rest.Middleware{serverCtx.Authority},
  325. []rest.Route{
  326. {
  327. Method: http.MethodPost,
  328. Path: "/label/create",
  329. Handler: label.CreateLabelHandler(serverCtx),
  330. },
  331. {
  332. Method: http.MethodPost,
  333. Path: "/label/update",
  334. Handler: label.UpdateLabelHandler(serverCtx),
  335. },
  336. {
  337. Method: http.MethodPost,
  338. Path: "/label/delete",
  339. Handler: label.DeleteLabelHandler(serverCtx),
  340. },
  341. {
  342. Method: http.MethodPost,
  343. Path: "/label/list",
  344. Handler: label.GetLabelListHandler(serverCtx),
  345. },
  346. {
  347. Method: http.MethodPost,
  348. Path: "/label/select_list",
  349. Handler: label.GetLabelSelectListHandler(serverCtx),
  350. },
  351. {
  352. Method: http.MethodPost,
  353. Path: "/label/contacts",
  354. Handler: label.GetLabelContactsHandler(serverCtx),
  355. },
  356. {
  357. Method: http.MethodPost,
  358. Path: "/label",
  359. Handler: label.GetLabelByIdHandler(serverCtx),
  360. },
  361. }...,
  362. ),
  363. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  364. )
  365. server.AddRoutes(
  366. rest.WithMiddlewares(
  367. []rest.Middleware{serverCtx.Authority},
  368. []rest.Route{
  369. {
  370. Method: http.MethodPost,
  371. Path: "/sop_task/create",
  372. Handler: sop_task.CreateSopTaskHandler(serverCtx),
  373. },
  374. {
  375. Method: http.MethodPost,
  376. Path: "/sop_task/update",
  377. Handler: sop_task.UpdateSopTaskHandler(serverCtx),
  378. },
  379. {
  380. Method: http.MethodPost,
  381. Path: "/sop_task/delete",
  382. Handler: sop_task.DeleteSopTaskHandler(serverCtx),
  383. },
  384. {
  385. Method: http.MethodPost,
  386. Path: "/sop_task/list",
  387. Handler: sop_task.GetSopTaskListHandler(serverCtx),
  388. },
  389. {
  390. Method: http.MethodPost,
  391. Path: "/sop_task/record_list",
  392. Handler: sop_task.GetSopTaskRecordListHandler(serverCtx),
  393. },
  394. {
  395. Method: http.MethodPost,
  396. Path: "/sop_task",
  397. Handler: sop_task.GetSopTaskByIdHandler(serverCtx),
  398. },
  399. {
  400. Method: http.MethodPost,
  401. Path: "/sop_task/detail",
  402. Handler: sop_task.GetSopTaskDetailHandler(serverCtx),
  403. },
  404. {
  405. Method: http.MethodPost,
  406. Path: "/sop_task/publish",
  407. Handler: sop_task.PublishSopTaskHandler(serverCtx),
  408. },
  409. {
  410. Method: http.MethodPost,
  411. Path: "/sop_task/start",
  412. Handler: sop_task.SopTaskStartHandler(serverCtx),
  413. },
  414. {
  415. Method: http.MethodPost,
  416. Path: "/sop_task/stop",
  417. Handler: sop_task.SopTaskStopHandler(serverCtx),
  418. },
  419. }...,
  420. ),
  421. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  422. )
  423. server.AddRoutes(
  424. rest.WithMiddlewares(
  425. []rest.Middleware{serverCtx.Authority},
  426. []rest.Route{
  427. {
  428. Method: http.MethodPost,
  429. Path: "/sop_stage/create",
  430. Handler: sop_stage.CreateSopStageHandler(serverCtx),
  431. },
  432. {
  433. Method: http.MethodPost,
  434. Path: "/sop_stage/update",
  435. Handler: sop_stage.UpdateSopStageHandler(serverCtx),
  436. },
  437. {
  438. Method: http.MethodPost,
  439. Path: "/sop_stage/delete",
  440. Handler: sop_stage.DeleteSopStageHandler(serverCtx),
  441. },
  442. {
  443. Method: http.MethodPost,
  444. Path: "/sop_stage/list",
  445. Handler: sop_stage.GetSopStageListHandler(serverCtx),
  446. },
  447. {
  448. Method: http.MethodPost,
  449. Path: "/sop_stage",
  450. Handler: sop_stage.GetSopStageByIdHandler(serverCtx),
  451. },
  452. {
  453. Method: http.MethodPost,
  454. Path: "/sop_stage/detail",
  455. Handler: sop_stage.GetSopStageDetailHandler(serverCtx),
  456. },
  457. {
  458. Method: http.MethodPost,
  459. Path: "/sop_stage/move",
  460. Handler: sop_stage.MoveSopStageHandler(serverCtx),
  461. },
  462. }...,
  463. ),
  464. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  465. )
  466. server.AddRoutes(
  467. rest.WithMiddlewares(
  468. []rest.Middleware{serverCtx.Authority},
  469. []rest.Route{
  470. {
  471. Method: http.MethodPost,
  472. Path: "/sop_node/create",
  473. Handler: sop_node.CreateSopNodeHandler(serverCtx),
  474. },
  475. {
  476. Method: http.MethodPost,
  477. Path: "/sop_node/update",
  478. Handler: sop_node.UpdateSopNodeHandler(serverCtx),
  479. },
  480. {
  481. Method: http.MethodPost,
  482. Path: "/sop_node/delete",
  483. Handler: sop_node.DeleteSopNodeHandler(serverCtx),
  484. },
  485. {
  486. Method: http.MethodPost,
  487. Path: "/sop_node/list",
  488. Handler: sop_node.GetSopNodeListHandler(serverCtx),
  489. },
  490. {
  491. Method: http.MethodPost,
  492. Path: "/sop_node/detail",
  493. Handler: sop_node.GetSopNodeDetailHandler(serverCtx),
  494. },
  495. }...,
  496. ),
  497. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  498. )
  499. server.AddRoutes(
  500. rest.WithMiddlewares(
  501. []rest.Middleware{serverCtx.Authority},
  502. []rest.Route{
  503. {
  504. Method: http.MethodPost,
  505. Path: "/message_records/create",
  506. Handler: message_records.CreateMessageRecordsHandler(serverCtx),
  507. },
  508. {
  509. Method: http.MethodPost,
  510. Path: "/message_records/update",
  511. Handler: message_records.UpdateMessageRecordsHandler(serverCtx),
  512. },
  513. {
  514. Method: http.MethodPost,
  515. Path: "/message_records/delete",
  516. Handler: message_records.DeleteMessageRecordsHandler(serverCtx),
  517. },
  518. {
  519. Method: http.MethodPost,
  520. Path: "/message_records/list",
  521. Handler: message_records.GetMessageRecordsListHandler(serverCtx),
  522. },
  523. {
  524. Method: http.MethodPost,
  525. Path: "/message_records",
  526. Handler: message_records.GetMessageRecordsByIdHandler(serverCtx),
  527. },
  528. }...,
  529. ),
  530. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  531. )
  532. server.AddRoutes(
  533. rest.WithMiddlewares(
  534. []rest.Middleware{serverCtx.Authority},
  535. []rest.Route{
  536. {
  537. Method: http.MethodPost,
  538. Path: "/chatroom_member/list",
  539. Handler: ChatRoomMember.GetChatroomMemberListHandler(serverCtx),
  540. },
  541. }...,
  542. ),
  543. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  544. )
  545. server.AddRoutes(
  546. rest.WithMiddlewares(
  547. []rest.Middleware{serverCtx.Authority},
  548. []rest.Route{
  549. {
  550. Method: http.MethodGet,
  551. Path: "/user/info",
  552. Handler: User.GetUserInfoHandler(serverCtx),
  553. },
  554. }...,
  555. ),
  556. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  557. )
  558. server.AddRoutes(
  559. []rest.Route{
  560. {
  561. Method: http.MethodPost,
  562. Path: "/contact/getContactByWxid",
  563. Handler: openapi.OpenapiGetContactByWxidHandler(serverCtx),
  564. },
  565. {
  566. Method: http.MethodPost,
  567. Path: "/contact/getContactList",
  568. Handler: openapi.OpenapiGetContactListHandler(serverCtx),
  569. },
  570. },
  571. rest.WithPrefix("/openapi"),
  572. )
  573. server.AddRoutes(
  574. rest.WithMiddlewares(
  575. []rest.Middleware{serverCtx.Authority},
  576. []rest.Route{
  577. {
  578. Method: http.MethodPost,
  579. Path: "/batch_msg/create",
  580. Handler: batch_msg.CreateBatchMsgHandler(serverCtx),
  581. },
  582. {
  583. Method: http.MethodPost,
  584. Path: "/batch_msg/update",
  585. Handler: batch_msg.UpdateBatchMsgHandler(serverCtx),
  586. },
  587. {
  588. Method: http.MethodPost,
  589. Path: "/batch_msg/delete",
  590. Handler: batch_msg.DeleteBatchMsgHandler(serverCtx),
  591. },
  592. {
  593. Method: http.MethodPost,
  594. Path: "/batch_msg/list",
  595. Handler: batch_msg.GetBatchMsgListHandler(serverCtx),
  596. },
  597. {
  598. Method: http.MethodPost,
  599. Path: "/batch_msg",
  600. Handler: batch_msg.GetBatchMsgByIdHandler(serverCtx),
  601. },
  602. {
  603. Method: http.MethodPost,
  604. Path: "/batch_msg/stop",
  605. Handler: batch_msg.StopBatchMsgHandler(serverCtx),
  606. },
  607. }...,
  608. ),
  609. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  610. )
  611. server.AddRoutes(
  612. rest.WithMiddlewares(
  613. []rest.Middleware{serverCtx.Authority},
  614. []rest.Route{
  615. {
  616. Method: http.MethodPost,
  617. Path: "/msg/create",
  618. Handler: Msg.CreateMsgHandler(serverCtx),
  619. },
  620. {
  621. Method: http.MethodPost,
  622. Path: "/msg/update",
  623. Handler: Msg.UpdateMsgHandler(serverCtx),
  624. },
  625. {
  626. Method: http.MethodPost,
  627. Path: "/msg/delete",
  628. Handler: Msg.DeleteMsgHandler(serverCtx),
  629. },
  630. {
  631. Method: http.MethodPost,
  632. Path: "/msg/list",
  633. Handler: Msg.GetMsgListHandler(serverCtx),
  634. },
  635. {
  636. Method: http.MethodPost,
  637. Path: "/msg",
  638. Handler: Msg.GetMsgByIdHandler(serverCtx),
  639. },
  640. }...,
  641. ),
  642. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  643. )
  644. server.AddRoutes(
  645. rest.WithMiddlewares(
  646. []rest.Middleware{serverCtx.Authority},
  647. []rest.Route{
  648. {
  649. Method: http.MethodPost,
  650. Path: "/employee/create",
  651. Handler: employee.CreateEmployeeHandler(serverCtx),
  652. },
  653. {
  654. Method: http.MethodPost,
  655. Path: "/employee/update",
  656. Handler: employee.UpdateEmployeeHandler(serverCtx),
  657. },
  658. {
  659. Method: http.MethodPost,
  660. Path: "/employee/delete",
  661. Handler: employee.DeleteEmployeeHandler(serverCtx),
  662. },
  663. {
  664. Method: http.MethodPost,
  665. Path: "/employee/list",
  666. Handler: employee.GetEmployeeListHandler(serverCtx),
  667. },
  668. {
  669. Method: http.MethodPost,
  670. Path: "/employee",
  671. Handler: employee.GetEmployeeByIdHandler(serverCtx),
  672. },
  673. }...,
  674. ),
  675. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  676. )
  677. server.AddRoutes(
  678. rest.WithMiddlewares(
  679. []rest.Middleware{serverCtx.Authority},
  680. []rest.Route{
  681. {
  682. Method: http.MethodPost,
  683. Path: "/work_experience/create",
  684. Handler: work_experience.CreateWorkExperienceHandler(serverCtx),
  685. },
  686. {
  687. Method: http.MethodPost,
  688. Path: "/work_experience/update",
  689. Handler: work_experience.UpdateWorkExperienceHandler(serverCtx),
  690. },
  691. {
  692. Method: http.MethodPost,
  693. Path: "/work_experience/delete",
  694. Handler: work_experience.DeleteWorkExperienceHandler(serverCtx),
  695. },
  696. {
  697. Method: http.MethodPost,
  698. Path: "/work_experience/list",
  699. Handler: work_experience.GetWorkExperienceListHandler(serverCtx),
  700. },
  701. {
  702. Method: http.MethodPost,
  703. Path: "/work_experience",
  704. Handler: work_experience.GetWorkExperienceByIdHandler(serverCtx),
  705. },
  706. }...,
  707. ),
  708. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  709. )
  710. server.AddRoutes(
  711. rest.WithMiddlewares(
  712. []rest.Middleware{serverCtx.Authority},
  713. []rest.Route{
  714. {
  715. Method: http.MethodPost,
  716. Path: "/tutorial/create",
  717. Handler: tutorial.CreateTutorialHandler(serverCtx),
  718. },
  719. {
  720. Method: http.MethodPost,
  721. Path: "/tutorial/update",
  722. Handler: tutorial.UpdateTutorialHandler(serverCtx),
  723. },
  724. {
  725. Method: http.MethodPost,
  726. Path: "/tutorial/delete",
  727. Handler: tutorial.DeleteTutorialHandler(serverCtx),
  728. },
  729. {
  730. Method: http.MethodPost,
  731. Path: "/tutorial/list",
  732. Handler: tutorial.GetTutorialListHandler(serverCtx),
  733. },
  734. {
  735. Method: http.MethodPost,
  736. Path: "/tutorial",
  737. Handler: tutorial.GetTutorialByIdHandler(serverCtx),
  738. },
  739. }...,
  740. ),
  741. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  742. )
  743. server.AddRoutes(
  744. rest.WithMiddlewares(
  745. []rest.Middleware{serverCtx.Authority},
  746. []rest.Route{
  747. {
  748. Method: http.MethodGet,
  749. Path: "/employee_config/list",
  750. Handler: employee_config.GetEmployeeListConfigHandler(serverCtx),
  751. },
  752. }...,
  753. ),
  754. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  755. )
  756. server.AddRoutes(
  757. []rest.Route{
  758. {
  759. Method: http.MethodPost,
  760. Path: "/token/create",
  761. Handler: token.CreateTokenHandler(serverCtx),
  762. },
  763. {
  764. Method: http.MethodPost,
  765. Path: "/token/update",
  766. Handler: token.UpdateTokenHandler(serverCtx),
  767. },
  768. {
  769. Method: http.MethodPost,
  770. Path: "/token/delete",
  771. Handler: token.DeleteTokenHandler(serverCtx),
  772. },
  773. {
  774. Method: http.MethodPost,
  775. Path: "/token/list",
  776. Handler: token.GetTokenListHandler(serverCtx),
  777. },
  778. {
  779. Method: http.MethodPost,
  780. Path: "/token",
  781. Handler: token.GetTokenByIdHandler(serverCtx),
  782. },
  783. {
  784. Method: http.MethodPost,
  785. Path: "/token/check",
  786. Handler: token.CheckTokenHandler(serverCtx),
  787. },
  788. },
  789. )
  790. server.AddRoutes(
  791. rest.WithMiddlewares(
  792. []rest.Middleware{serverCtx.Authority},
  793. []rest.Route{
  794. {
  795. Method: http.MethodPost,
  796. Path: "/category/create",
  797. Handler: category.CreateCategoryHandler(serverCtx),
  798. },
  799. {
  800. Method: http.MethodPost,
  801. Path: "/category/update",
  802. Handler: category.UpdateCategoryHandler(serverCtx),
  803. },
  804. {
  805. Method: http.MethodPost,
  806. Path: "/category/delete",
  807. Handler: category.DeleteCategoryHandler(serverCtx),
  808. },
  809. {
  810. Method: http.MethodPost,
  811. Path: "/category/list",
  812. Handler: category.GetCategoryListHandler(serverCtx),
  813. },
  814. {
  815. Method: http.MethodPost,
  816. Path: "/category",
  817. Handler: category.GetCategoryByIdHandler(serverCtx),
  818. },
  819. }...,
  820. ),
  821. rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
  822. )
  823. }