project.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. package router
  2. import (
  3. "github.com/go-chi/chi"
  4. "github.com/porter-dev/porter/api/server/handlers/cluster"
  5. "github.com/porter-dev/porter/api/server/handlers/gitinstallation"
  6. "github.com/porter-dev/porter/api/server/handlers/invite"
  7. "github.com/porter-dev/porter/api/server/handlers/project"
  8. "github.com/porter-dev/porter/api/server/handlers/provision"
  9. "github.com/porter-dev/porter/api/server/handlers/registry"
  10. "github.com/porter-dev/porter/api/server/shared"
  11. "github.com/porter-dev/porter/api/server/shared/config"
  12. "github.com/porter-dev/porter/api/types"
  13. )
  14. func NewProjectScopedRegisterer(children ...*Registerer) *Registerer {
  15. return &Registerer{
  16. GetRoutes: GetProjectScopedRoutes,
  17. Children: children,
  18. }
  19. }
  20. func GetProjectScopedRoutes(
  21. r chi.Router,
  22. config *config.Config,
  23. basePath *types.Path,
  24. factory shared.APIEndpointFactory,
  25. children ...*Registerer,
  26. ) []*Route {
  27. routes, projPath := getProjectRoutes(r, config, basePath, factory)
  28. if len(children) > 0 {
  29. r.Route(projPath.RelativePath, func(r chi.Router) {
  30. for _, child := range children {
  31. childRoutes := child.GetRoutes(r, config, basePath, factory, child.Children...)
  32. routes = append(routes, childRoutes...)
  33. }
  34. })
  35. }
  36. return routes
  37. }
  38. func getProjectRoutes(
  39. r chi.Router,
  40. config *config.Config,
  41. basePath *types.Path,
  42. factory shared.APIEndpointFactory,
  43. ) ([]*Route, *types.Path) {
  44. relPath := "/projects/{project_id}"
  45. newPath := &types.Path{
  46. Parent: basePath,
  47. RelativePath: relPath,
  48. }
  49. routes := make([]*Route, 0)
  50. // GET /api/projects/{project_id} -> project.NewProjectGetHandler
  51. getEndpoint := factory.NewAPIEndpoint(
  52. &types.APIRequestMetadata{
  53. Verb: types.APIVerbGet,
  54. Method: types.HTTPVerbGet,
  55. Path: &types.Path{
  56. Parent: basePath,
  57. RelativePath: relPath,
  58. },
  59. Scopes: []types.PermissionScope{
  60. types.UserScope,
  61. types.ProjectScope,
  62. },
  63. },
  64. )
  65. getHandler := project.NewProjectGetHandler(
  66. config,
  67. factory.GetResultWriter(),
  68. )
  69. routes = append(routes, &Route{
  70. Endpoint: getEndpoint,
  71. Handler: getHandler,
  72. Router: r,
  73. })
  74. // GET /api/projects/{project_id}/policy -> project.NewProjectGetPolicyHandler
  75. getPolicyEndpoint := factory.NewAPIEndpoint(
  76. &types.APIRequestMetadata{
  77. Verb: types.APIVerbGet,
  78. Method: types.HTTPVerbGet,
  79. Path: &types.Path{
  80. Parent: basePath,
  81. RelativePath: relPath + "/policy",
  82. },
  83. Scopes: []types.PermissionScope{
  84. types.UserScope,
  85. types.ProjectScope,
  86. },
  87. },
  88. )
  89. getPolicyHandler := project.NewProjectGetPolicyHandler(
  90. config,
  91. factory.GetResultWriter(),
  92. )
  93. routes = append(routes, &Route{
  94. Endpoint: getPolicyEndpoint,
  95. Handler: getPolicyHandler,
  96. Router: r,
  97. })
  98. // GET /api/projects/{project_id}/infra -> project.NewListProjectInfraHandler
  99. listInfraEndpoint := factory.NewAPIEndpoint(
  100. &types.APIRequestMetadata{
  101. Verb: types.APIVerbGet,
  102. Method: types.HTTPVerbGet,
  103. Path: &types.Path{
  104. Parent: basePath,
  105. RelativePath: relPath + "/infra",
  106. },
  107. Scopes: []types.PermissionScope{
  108. types.UserScope,
  109. types.ProjectScope,
  110. },
  111. },
  112. )
  113. listInfraHandler := project.NewProjectListInfraHandler(
  114. config,
  115. factory.GetResultWriter(),
  116. )
  117. routes = append(routes, &Route{
  118. Endpoint: listInfraEndpoint,
  119. Handler: listInfraHandler,
  120. Router: r,
  121. })
  122. // GET /api/projects/{project_id}/clusters -> cluster.NewClusterListHandler
  123. listClusterEndpoint := factory.NewAPIEndpoint(
  124. &types.APIRequestMetadata{
  125. Verb: types.APIVerbList,
  126. Method: types.HTTPVerbGet,
  127. Path: &types.Path{
  128. Parent: basePath,
  129. RelativePath: relPath + "/clusters",
  130. },
  131. Scopes: []types.PermissionScope{
  132. types.UserScope,
  133. types.ProjectScope,
  134. },
  135. },
  136. )
  137. listClusterHandler := cluster.NewClusterListHandler(
  138. config,
  139. factory.GetResultWriter(),
  140. )
  141. routes = append(routes, &Route{
  142. Endpoint: listClusterEndpoint,
  143. Handler: listClusterHandler,
  144. Router: r,
  145. })
  146. // GET /api/projects/{project_id}/gitrepos -> gitinstallation.NewGitRepoListHandler
  147. listGitReposEndpoint := factory.NewAPIEndpoint(
  148. &types.APIRequestMetadata{
  149. Verb: types.APIVerbList,
  150. Method: types.HTTPVerbGet,
  151. Path: &types.Path{
  152. Parent: basePath,
  153. RelativePath: relPath + "/gitrepos",
  154. },
  155. Scopes: []types.PermissionScope{
  156. types.UserScope,
  157. types.ProjectScope,
  158. },
  159. },
  160. )
  161. listGitReposHandler := gitinstallation.NewGitRepoListHandler(
  162. config,
  163. factory.GetResultWriter(),
  164. )
  165. routes = append(routes, &Route{
  166. Endpoint: listGitReposEndpoint,
  167. Handler: listGitReposHandler,
  168. Router: r,
  169. })
  170. // GET /api/projects/{project_id}/collaborators -> project.NewCollaboratorsListHandler
  171. listCollaboratorsEndpoint := factory.NewAPIEndpoint(
  172. &types.APIRequestMetadata{
  173. Verb: types.APIVerbList,
  174. Method: types.HTTPVerbGet,
  175. Path: &types.Path{
  176. Parent: basePath,
  177. RelativePath: relPath + "/collaborators",
  178. },
  179. Scopes: []types.PermissionScope{
  180. types.UserScope,
  181. types.ProjectScope,
  182. },
  183. },
  184. )
  185. listCollaboratorsHandler := project.NewCollaboratorsListHandler(
  186. config,
  187. factory.GetResultWriter(),
  188. )
  189. routes = append(routes, &Route{
  190. Endpoint: listCollaboratorsEndpoint,
  191. Handler: listCollaboratorsHandler,
  192. Router: r,
  193. })
  194. // GET /api/projects/{project_id}/roles -> project.NewRolesListHandler
  195. listRolesEndpoint := factory.NewAPIEndpoint(
  196. &types.APIRequestMetadata{
  197. Verb: types.APIVerbList,
  198. Method: types.HTTPVerbGet,
  199. Path: &types.Path{
  200. Parent: basePath,
  201. RelativePath: relPath + "/roles",
  202. },
  203. Scopes: []types.PermissionScope{
  204. types.UserScope,
  205. types.ProjectScope,
  206. },
  207. },
  208. )
  209. listRolesHandler := project.NewRolesListHandler(
  210. config,
  211. factory.GetResultWriter(),
  212. )
  213. routes = append(routes, &Route{
  214. Endpoint: listRolesEndpoint,
  215. Handler: listRolesHandler,
  216. Router: r,
  217. })
  218. // POST /api/projects/{project_id}/roles -> project.NewRoleUpdateHandler
  219. updateRoleEndpoint := factory.NewAPIEndpoint(
  220. &types.APIRequestMetadata{
  221. Verb: types.APIVerbUpdate,
  222. Method: types.HTTPVerbPost,
  223. Path: &types.Path{
  224. Parent: basePath,
  225. RelativePath: relPath + "/roles",
  226. },
  227. Scopes: []types.PermissionScope{
  228. types.UserScope,
  229. types.ProjectScope,
  230. },
  231. },
  232. )
  233. updateRoleHandler := project.NewRoleUpdateHandler(
  234. config,
  235. factory.GetDecoderValidator(),
  236. factory.GetResultWriter(),
  237. )
  238. routes = append(routes, &Route{
  239. Endpoint: updateRoleEndpoint,
  240. Handler: updateRoleHandler,
  241. Router: r,
  242. })
  243. // DELETE /api/projects/{project_id}/roles -> project.NewRoleDeleteHandler
  244. deleteRoleEndpoint := factory.NewAPIEndpoint(
  245. &types.APIRequestMetadata{
  246. Verb: types.APIVerbDelete,
  247. Method: types.HTTPVerbDelete,
  248. Path: &types.Path{
  249. Parent: basePath,
  250. RelativePath: relPath + "/roles",
  251. },
  252. Scopes: []types.PermissionScope{
  253. types.UserScope,
  254. types.ProjectScope,
  255. },
  256. },
  257. )
  258. deleteRoleHandler := project.NewRoleDeleteHandler(
  259. config,
  260. factory.GetDecoderValidator(),
  261. factory.GetResultWriter(),
  262. )
  263. routes = append(routes, &Route{
  264. Endpoint: deleteRoleEndpoint,
  265. Handler: deleteRoleHandler,
  266. Router: r,
  267. })
  268. // GET /api/projects/{project_id}/registries -> registry.NewRegistryListHandler
  269. listRegistriesEndpoint := factory.NewAPIEndpoint(
  270. &types.APIRequestMetadata{
  271. Verb: types.APIVerbList,
  272. Method: types.HTTPVerbGet,
  273. Path: &types.Path{
  274. Parent: basePath,
  275. RelativePath: relPath + "/registries",
  276. },
  277. Scopes: []types.PermissionScope{
  278. types.UserScope,
  279. types.ProjectScope,
  280. },
  281. },
  282. )
  283. listRegistriesHandler := registry.NewRegistryListHandler(
  284. config,
  285. factory.GetResultWriter(),
  286. )
  287. routes = append(routes, &Route{
  288. Endpoint: listRegistriesEndpoint,
  289. Handler: listRegistriesHandler,
  290. Router: r,
  291. })
  292. // POST /api/projects/{project_id}/registries -> registry.NewRegistryCreateHandler
  293. createRegistryEndpoint := factory.NewAPIEndpoint(
  294. &types.APIRequestMetadata{
  295. Verb: types.APIVerbCreate,
  296. Method: types.HTTPVerbPost,
  297. Path: &types.Path{
  298. Parent: basePath,
  299. RelativePath: relPath + "/registries",
  300. },
  301. Scopes: []types.PermissionScope{
  302. types.UserScope,
  303. types.ProjectScope,
  304. },
  305. },
  306. )
  307. createRegistryHandler := registry.NewRegistryCreateHandler(
  308. config,
  309. factory.GetDecoderValidator(),
  310. factory.GetResultWriter(),
  311. )
  312. routes = append(routes, &Route{
  313. Endpoint: createRegistryEndpoint,
  314. Handler: createRegistryHandler,
  315. Router: r,
  316. })
  317. // GET /api/projects/{project_id}/registries/ecr/token -> registry.NewRegistryGetECRTokenHandler
  318. getECRTokenEndpoint := factory.NewAPIEndpoint(
  319. &types.APIRequestMetadata{
  320. Verb: types.APIVerbGet,
  321. Method: types.HTTPVerbGet,
  322. Path: &types.Path{
  323. Parent: basePath,
  324. RelativePath: relPath + "/registries/ecr/token",
  325. },
  326. Scopes: []types.PermissionScope{
  327. types.UserScope,
  328. types.ProjectScope,
  329. },
  330. },
  331. )
  332. getECRTokenHandler := registry.NewRegistryGetECRTokenHandler(
  333. config,
  334. factory.GetDecoderValidator(),
  335. factory.GetResultWriter(),
  336. )
  337. routes = append(routes, &Route{
  338. Endpoint: getECRTokenEndpoint,
  339. Handler: getECRTokenHandler,
  340. Router: r,
  341. })
  342. // GET /api/projects/{project_id}/registries/docr/token -> registry.NewRegistryGetDOCRTokenHandler
  343. getDOCRTokenEndpoint := factory.NewAPIEndpoint(
  344. &types.APIRequestMetadata{
  345. Verb: types.APIVerbGet,
  346. Method: types.HTTPVerbGet,
  347. Path: &types.Path{
  348. Parent: basePath,
  349. RelativePath: relPath + "/registries/docr/token",
  350. },
  351. Scopes: []types.PermissionScope{
  352. types.UserScope,
  353. types.ProjectScope,
  354. },
  355. },
  356. )
  357. getDOCRTokenHandler := registry.NewRegistryGetDOCRTokenHandler(
  358. config,
  359. factory.GetDecoderValidator(),
  360. factory.GetResultWriter(),
  361. )
  362. routes = append(routes, &Route{
  363. Endpoint: getDOCRTokenEndpoint,
  364. Handler: getDOCRTokenHandler,
  365. Router: r,
  366. })
  367. // GET /api/projects/{project_id}/registries/gcr/token -> registry.NewRegistryGetGCRTokenHandler
  368. getGCRTokenEndpoint := factory.NewAPIEndpoint(
  369. &types.APIRequestMetadata{
  370. Verb: types.APIVerbGet,
  371. Method: types.HTTPVerbGet,
  372. Path: &types.Path{
  373. Parent: basePath,
  374. RelativePath: relPath + "/registries/gcr/token",
  375. },
  376. Scopes: []types.PermissionScope{
  377. types.UserScope,
  378. types.ProjectScope,
  379. },
  380. },
  381. )
  382. getGCRTokenHandler := registry.NewRegistryGetGCRTokenHandler(
  383. config,
  384. factory.GetDecoderValidator(),
  385. factory.GetResultWriter(),
  386. )
  387. routes = append(routes, &Route{
  388. Endpoint: getGCRTokenEndpoint,
  389. Handler: getGCRTokenHandler,
  390. Router: r,
  391. })
  392. // GET /api/projects/{project_id}/registries/dockerhub/token -> registry.NewRegistryGetDockerhubTokenHandler
  393. getDockerhubTokenEndpoint := factory.NewAPIEndpoint(
  394. &types.APIRequestMetadata{
  395. Verb: types.APIVerbGet,
  396. Method: types.HTTPVerbGet,
  397. Path: &types.Path{
  398. Parent: basePath,
  399. RelativePath: relPath + "/registries/dockerhub/token",
  400. },
  401. Scopes: []types.PermissionScope{
  402. types.UserScope,
  403. types.ProjectScope,
  404. },
  405. },
  406. )
  407. getDockerhubTokenHandler := registry.NewRegistryGetDockerhubTokenHandler(
  408. config,
  409. factory.GetDecoderValidator(),
  410. factory.GetResultWriter(),
  411. )
  412. routes = append(routes, &Route{
  413. Endpoint: getDockerhubTokenEndpoint,
  414. Handler: getDockerhubTokenHandler,
  415. Router: r,
  416. })
  417. // POST /api/projects/{project_id}/provision/ecr -> provision.NewProvisionECRHandler
  418. provisionECREndpoint := factory.NewAPIEndpoint(
  419. &types.APIRequestMetadata{
  420. Verb: types.APIVerbCreate,
  421. Method: types.HTTPVerbPost,
  422. Path: &types.Path{
  423. Parent: basePath,
  424. RelativePath: relPath + "/provision/ecr",
  425. },
  426. Scopes: []types.PermissionScope{
  427. types.UserScope,
  428. types.ProjectScope,
  429. },
  430. },
  431. )
  432. provisionECRHandler := provision.NewProvisionECRHandler(
  433. config,
  434. factory.GetDecoderValidator(),
  435. factory.GetResultWriter(),
  436. )
  437. routes = append(routes, &Route{
  438. Endpoint: provisionECREndpoint,
  439. Handler: provisionECRHandler,
  440. Router: r,
  441. })
  442. // POST /api/projects/{project_id}/provision/eks -> provision.NewProvisionEKSHandler
  443. provisionEKSEndpoint := factory.NewAPIEndpoint(
  444. &types.APIRequestMetadata{
  445. Verb: types.APIVerbCreate,
  446. Method: types.HTTPVerbPost,
  447. Path: &types.Path{
  448. Parent: basePath,
  449. RelativePath: relPath + "/provision/eks",
  450. },
  451. Scopes: []types.PermissionScope{
  452. types.UserScope,
  453. types.ProjectScope,
  454. },
  455. },
  456. )
  457. provisionEKSHandler := provision.NewProvisionEKSHandler(
  458. config,
  459. factory.GetDecoderValidator(),
  460. factory.GetResultWriter(),
  461. )
  462. routes = append(routes, &Route{
  463. Endpoint: provisionEKSEndpoint,
  464. Handler: provisionEKSHandler,
  465. Router: r,
  466. })
  467. // POST /api/projects/{project_id}/provision/docr -> provision.NewProvisionDOCRHandler
  468. provisionDOCREndpoint := factory.NewAPIEndpoint(
  469. &types.APIRequestMetadata{
  470. Verb: types.APIVerbCreate,
  471. Method: types.HTTPVerbPost,
  472. Path: &types.Path{
  473. Parent: basePath,
  474. RelativePath: relPath + "/provision/docr",
  475. },
  476. Scopes: []types.PermissionScope{
  477. types.UserScope,
  478. types.ProjectScope,
  479. },
  480. },
  481. )
  482. provisionDOCRHandler := provision.NewProvisionDOCRHandler(
  483. config,
  484. factory.GetDecoderValidator(),
  485. factory.GetResultWriter(),
  486. )
  487. routes = append(routes, &Route{
  488. Endpoint: provisionDOCREndpoint,
  489. Handler: provisionDOCRHandler,
  490. Router: r,
  491. })
  492. // POST /api/projects/{project_id}/provision/doks -> provision.NewProvisionDOKSHandler
  493. provisionDOKSEndpoint := factory.NewAPIEndpoint(
  494. &types.APIRequestMetadata{
  495. Verb: types.APIVerbCreate,
  496. Method: types.HTTPVerbPost,
  497. Path: &types.Path{
  498. Parent: basePath,
  499. RelativePath: relPath + "/provision/doks",
  500. },
  501. Scopes: []types.PermissionScope{
  502. types.UserScope,
  503. types.ProjectScope,
  504. },
  505. },
  506. )
  507. provisionDOKSHandler := provision.NewProvisionDOCRHandler(
  508. config,
  509. factory.GetDecoderValidator(),
  510. factory.GetResultWriter(),
  511. )
  512. routes = append(routes, &Route{
  513. Endpoint: provisionDOKSEndpoint,
  514. Handler: provisionDOKSHandler,
  515. Router: r,
  516. })
  517. // POST /api/projects/{project_id}/provision/gcr -> provision.NewProvisionGCRHandler
  518. provisionGCREndpoint := factory.NewAPIEndpoint(
  519. &types.APIRequestMetadata{
  520. Verb: types.APIVerbCreate,
  521. Method: types.HTTPVerbPost,
  522. Path: &types.Path{
  523. Parent: basePath,
  524. RelativePath: relPath + "/provision/gcr",
  525. },
  526. Scopes: []types.PermissionScope{
  527. types.UserScope,
  528. types.ProjectScope,
  529. },
  530. },
  531. )
  532. provisionGCRHandler := provision.NewProvisionGCRHandler(
  533. config,
  534. factory.GetDecoderValidator(),
  535. factory.GetResultWriter(),
  536. )
  537. routes = append(routes, &Route{
  538. Endpoint: provisionGCREndpoint,
  539. Handler: provisionGCRHandler,
  540. Router: r,
  541. })
  542. // POST /api/projects/{project_id}/provision/gke -> provision.NewProvisionGKEHandler
  543. provisionGKEEndpoint := factory.NewAPIEndpoint(
  544. &types.APIRequestMetadata{
  545. Verb: types.APIVerbCreate,
  546. Method: types.HTTPVerbPost,
  547. Path: &types.Path{
  548. Parent: basePath,
  549. RelativePath: relPath + "/provision/gke",
  550. },
  551. Scopes: []types.PermissionScope{
  552. types.UserScope,
  553. types.ProjectScope,
  554. },
  555. },
  556. )
  557. provisionGKEHandler := provision.NewProvisionGKEHandler(
  558. config,
  559. factory.GetDecoderValidator(),
  560. factory.GetResultWriter(),
  561. )
  562. routes = append(routes, &Route{
  563. Endpoint: provisionGKEEndpoint,
  564. Handler: provisionGKEHandler,
  565. Router: r,
  566. })
  567. // GET /api/projects/{project_id}/invites -> invite.NewInvitesListHandler
  568. listInvitesEndpoint := factory.NewAPIEndpoint(
  569. &types.APIRequestMetadata{
  570. Verb: types.APIVerbGet,
  571. Method: types.HTTPVerbGet,
  572. Path: &types.Path{
  573. Parent: basePath,
  574. RelativePath: relPath + "/invites",
  575. },
  576. Scopes: []types.PermissionScope{
  577. types.UserScope,
  578. types.ProjectScope,
  579. },
  580. },
  581. )
  582. listInvitesHandler := invite.NewInvitesListHandler(
  583. config,
  584. factory.GetResultWriter(),
  585. )
  586. routes = append(routes, &Route{
  587. Endpoint: listInvitesEndpoint,
  588. Handler: listInvitesHandler,
  589. Router: r,
  590. })
  591. // POST /api/projects/{project_id}/invites -> invite.NewInviteCreateHandler
  592. createInviteEndpoint := factory.NewAPIEndpoint(
  593. &types.APIRequestMetadata{
  594. Verb: types.APIVerbCreate,
  595. Method: types.HTTPVerbPost,
  596. Path: &types.Path{
  597. Parent: basePath,
  598. RelativePath: relPath + "/invites",
  599. },
  600. Scopes: []types.PermissionScope{
  601. types.UserScope,
  602. types.ProjectScope,
  603. },
  604. },
  605. )
  606. createInviteHandler := invite.NewInviteCreateHandler(
  607. config,
  608. factory.GetDecoderValidator(),
  609. factory.GetResultWriter(),
  610. )
  611. routes = append(routes, &Route{
  612. Endpoint: createInviteEndpoint,
  613. Handler: createInviteHandler,
  614. Router: r,
  615. })
  616. // GET /api/projects/{project_id}/invites/accept -> invite.NewInviteAcceptHandler
  617. acceptInviteEndpoint := factory.NewAPIEndpoint(
  618. &types.APIRequestMetadata{
  619. Verb: types.APIVerbGet,
  620. Method: types.HTTPVerbGet,
  621. Path: &types.Path{
  622. Parent: basePath,
  623. RelativePath: relPath + "/invites/accept",
  624. },
  625. Scopes: []types.PermissionScope{},
  626. },
  627. )
  628. acceptInviteHandler := invite.NewInviteAcceptHandler(
  629. config,
  630. factory.GetDecoderValidator(),
  631. )
  632. routes = append(routes, &Route{
  633. Endpoint: acceptInviteEndpoint,
  634. Handler: acceptInviteHandler,
  635. Router: r,
  636. })
  637. return routes, newPath
  638. }