projects.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. import express from 'express';
  2. import { promises as fs } from 'fs';
  3. import path from 'path';
  4. import { spawn } from 'child_process';
  5. import os from 'os';
  6. import {
  7. addProjectManually,
  8. extractProjectDirectory,
  9. } from '../projects.js';
  10. import {
  11. getProjectDiscoveryContext,
  12. getProjectDiscoveryPlansOverview,
  13. getProjectDiscoveryPlanReport,
  14. rerunDiscoveryPlan,
  15. getProjectWorkCycles,
  16. applyWorkCycle,
  17. archiveWorkCycle,
  18. } from '../discovery-plans.js';
  19. const router = express.Router();
  20. function sanitizeGitError(message, token) {
  21. if (!message || !token) return message;
  22. return message.replace(new RegExp(token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '***');
  23. }
  24. // Default root used by the folder browser when no path is provided.
  25. export const WORKSPACES_ROOT = process.env.WORKSPACES_ROOT || os.homedir();
  26. // System-critical paths that should never be used as workspace directories
  27. export const FORBIDDEN_PATHS = [
  28. // Unix
  29. '/',
  30. '/etc',
  31. '/bin',
  32. '/sbin',
  33. '/usr',
  34. '/dev',
  35. '/proc',
  36. '/sys',
  37. '/var',
  38. '/boot',
  39. '/root',
  40. '/lib',
  41. '/lib64',
  42. '/opt',
  43. '/run',
  44. // Windows
  45. 'C:\\Windows',
  46. 'C:\\Program Files',
  47. 'C:\\Program Files (x86)',
  48. 'C:\\ProgramData',
  49. 'C:\\System Volume Information',
  50. 'C:\\$Recycle.Bin'
  51. ];
  52. function isForbiddenWorkspacePath(inputPath) {
  53. const normalizedPath = path.normalize(path.resolve(inputPath));
  54. if (normalizedPath === '/' || FORBIDDEN_PATHS.includes(normalizedPath)) {
  55. return true;
  56. }
  57. for (const forbidden of FORBIDDEN_PATHS) {
  58. if (normalizedPath === forbidden || normalizedPath.startsWith(forbidden + path.sep)) {
  59. // Exception: allow user-accessible temporary folders under /var.
  60. if (
  61. forbidden === '/var' &&
  62. (normalizedPath.startsWith('/var/tmp') || normalizedPath.startsWith('/var/folders'))
  63. ) {
  64. continue;
  65. }
  66. return true;
  67. }
  68. }
  69. return false;
  70. }
  71. /**
  72. * Validates that a path is safe for workspace operations
  73. * @param {string} requestedPath - The path to validate
  74. * @returns {Promise<{valid: boolean, resolvedPath?: string, error?: string}>}
  75. */
  76. export async function validateWorkspacePath(requestedPath) {
  77. try {
  78. // Resolve to absolute path
  79. let absolutePath = path.resolve(requestedPath);
  80. // Reject system-critical directories and descendants.
  81. if (isForbiddenWorkspacePath(absolutePath)) {
  82. return {
  83. valid: false,
  84. error: 'Cannot create workspace in system-critical directories'
  85. };
  86. }
  87. // Try to resolve the real path (following symlinks)
  88. let realPath;
  89. try {
  90. // Check if path exists to resolve real path
  91. await fs.access(absolutePath);
  92. realPath = await fs.realpath(absolutePath);
  93. } catch (error) {
  94. if (error.code === 'ENOENT') {
  95. // Path doesn't exist yet - check parent directory
  96. let parentPath = path.dirname(absolutePath);
  97. try {
  98. const parentRealPath = await fs.realpath(parentPath);
  99. // Reconstruct the full path with real parent
  100. realPath = path.join(parentRealPath, path.basename(absolutePath));
  101. } catch (parentError) {
  102. if (parentError.code === 'ENOENT') {
  103. // Parent doesn't exist either - use the absolute path as-is
  104. // We'll validate it's within allowed root
  105. realPath = absolutePath;
  106. } else {
  107. throw parentError;
  108. }
  109. }
  110. } else {
  111. throw error;
  112. }
  113. }
  114. // Apply the same checks after symlink/canonical path resolution.
  115. if (isForbiddenWorkspacePath(realPath)) {
  116. return {
  117. valid: false,
  118. error: 'Resolved path points to a system-critical directory'
  119. };
  120. }
  121. // Additional symlink check for existing paths
  122. try {
  123. await fs.access(absolutePath);
  124. const stats = await fs.lstat(absolutePath);
  125. if (stats.isSymbolicLink()) {
  126. // Verify symlink target is not a forbidden system path.
  127. const linkTarget = await fs.readlink(absolutePath);
  128. const resolvedTarget = path.resolve(path.dirname(absolutePath), linkTarget);
  129. const realTarget = await fs.realpath(resolvedTarget);
  130. if (isForbiddenWorkspacePath(realTarget)) {
  131. return {
  132. valid: false,
  133. error: 'Symlink target points to a system-critical directory'
  134. };
  135. }
  136. }
  137. } catch (error) {
  138. if (error.code !== 'ENOENT') {
  139. throw error;
  140. }
  141. // Path doesn't exist - that's fine for new workspace creation
  142. }
  143. return {
  144. valid: true,
  145. resolvedPath: realPath
  146. };
  147. } catch (error) {
  148. return {
  149. valid: false,
  150. error: `Path validation failed: ${error.message}`
  151. };
  152. }
  153. }
  154. function getTrimmedParam(value) {
  155. return typeof value === 'string' ? value.trim() : '';
  156. }
  157. function getDiscoveryPlanErrorMessage(error, fallback) {
  158. if (error instanceof Error && error.message.trim().length > 0) {
  159. return error.message;
  160. }
  161. return fallback;
  162. }
  163. function getDiscoveryPlanErrorStatus(error) {
  164. if (error?.code === 'NOT_FOUND') {
  165. return 404;
  166. }
  167. if (error?.code === 'UNSUPPORTED_STRATEGY') {
  168. return 400;
  169. }
  170. if (error?.code === 'INVALID_STATE' || error?.code === 'MISSING_PLAN_BODY' || error?.code === 'MISSING_WORKSPACE') {
  171. return 409;
  172. }
  173. if (error?.code === 'ALREADY_RUNNING') {
  174. return 409;
  175. }
  176. return 500;
  177. }
  178. export async function handleGetProjectDiscoveryPlans(req, res) {
  179. try {
  180. const projectName = getTrimmedParam(req.params?.projectName);
  181. if (!projectName) {
  182. return res.status(400).json({ error: 'projectName is required' });
  183. }
  184. const overview = await getProjectDiscoveryPlansOverview(projectName);
  185. return res.json(overview);
  186. } catch (error) {
  187. return res.status(500).json({ error: error.message });
  188. }
  189. }
  190. export async function handleGetProjectDiscoveryContext(req, res) {
  191. try {
  192. const projectName = getTrimmedParam(req.params?.projectName);
  193. if (!projectName) {
  194. return res.status(400).json({ error: 'projectName is required' });
  195. }
  196. const context = await getProjectDiscoveryContext(projectName);
  197. return res.json(context);
  198. } catch (error) {
  199. return res.status(500).json({ error: error.message });
  200. }
  201. }
  202. export async function handleExecuteProjectDiscoveryPlan(req, res) {
  203. try {
  204. const projectName = getTrimmedParam(req.params?.projectName);
  205. const planId = getTrimmedParam(req.params?.planId);
  206. if (!projectName) {
  207. return res.status(400).json({ error: 'projectName is required' });
  208. }
  209. if (!planId) {
  210. return res.status(400).json({ error: 'planId is required' });
  211. }
  212. const result = await rerunDiscoveryPlan(projectName, planId);
  213. return res.json(result);
  214. } catch (error) {
  215. return res.status(getDiscoveryPlanErrorStatus(error)).json({
  216. error: getDiscoveryPlanErrorMessage(error, 'Failed to rerun discovery plan')
  217. });
  218. }
  219. }
  220. router.get('/:projectName/discovery-context', handleGetProjectDiscoveryContext);
  221. router.get('/:projectName/discovery-plans', handleGetProjectDiscoveryPlans);
  222. router.post('/:projectName/discovery-plans/:planId/execute', handleExecuteProjectDiscoveryPlan);
  223. router.get('/:projectName/discovery-plans/:planId/report', async (req, res) => {
  224. try {
  225. const projectName = getTrimmedParam(req.params?.projectName);
  226. const planId = getTrimmedParam(req.params?.planId);
  227. if (!projectName) return res.status(400).json({ error: 'projectName is required' });
  228. if (!planId) return res.status(400).json({ error: 'planId is required' });
  229. const result = await getProjectDiscoveryPlanReport(projectName, planId);
  230. return res.json(result);
  231. } catch (error) {
  232. return res.status(getDiscoveryPlanErrorStatus(error)).json({
  233. error: getDiscoveryPlanErrorMessage(error, 'Failed to read discovery plan report')
  234. });
  235. }
  236. });
  237. router.get('/:projectName/work-cycles', async (req, res) => {
  238. try {
  239. const projectName = getTrimmedParam(req.params?.projectName);
  240. if (!projectName) return res.status(400).json({ error: 'projectName is required' });
  241. const result = await getProjectWorkCycles(projectName);
  242. return res.json(result);
  243. } catch (error) {
  244. return res.status(getDiscoveryPlanErrorStatus(error)).json({
  245. error: getDiscoveryPlanErrorMessage(error, 'Failed to get work cycles')
  246. });
  247. }
  248. });
  249. router.post('/:projectName/work-cycles/:cycleId/apply', async (req, res) => {
  250. try {
  251. const projectName = getTrimmedParam(req.params?.projectName);
  252. const cycleId = getTrimmedParam(req.params?.cycleId);
  253. if (!projectName) return res.status(400).json({ error: 'projectName is required' });
  254. if (!cycleId) return res.status(400).json({ error: 'cycleId is required' });
  255. const result = await applyWorkCycle(projectName, cycleId);
  256. return res.json(result);
  257. } catch (error) {
  258. return res.status(getDiscoveryPlanErrorStatus(error)).json({
  259. error: getDiscoveryPlanErrorMessage(error, 'Failed to apply work cycle')
  260. });
  261. }
  262. });
  263. router.post('/:projectName/work-cycles/:cycleId/archive', async (req, res) => {
  264. try {
  265. const projectName = getTrimmedParam(req.params?.projectName);
  266. const cycleId = getTrimmedParam(req.params?.cycleId);
  267. if (!projectName) return res.status(400).json({ error: 'projectName is required' });
  268. if (!cycleId) return res.status(400).json({ error: 'cycleId is required' });
  269. const result = await archiveWorkCycle(projectName, cycleId);
  270. return res.json(result);
  271. } catch (error) {
  272. return res.status(getDiscoveryPlanErrorStatus(error)).json({
  273. error: getDiscoveryPlanErrorMessage(error, 'Failed to archive work cycle')
  274. });
  275. }
  276. });
  277. /**
  278. * Create a new workspace
  279. * POST /api/projects/create-workspace
  280. *
  281. * Body:
  282. * - workspaceType: 'existing' | 'new'
  283. * - path: string (workspace path)
  284. * - githubUrl?: string (optional, for new workspaces)
  285. * - githubTokenId?: number (optional, ID of stored token)
  286. * - newGithubToken?: string (optional, one-time token)
  287. */
  288. router.post('/create-workspace', async (req, res) => {
  289. try {
  290. const { workspaceType, path: workspacePath, githubUrl, githubTokenId, newGithubToken } = req.body;
  291. // Validate required fields
  292. if (!workspaceType || !workspacePath) {
  293. return res.status(400).json({ error: 'workspaceType and path are required' });
  294. }
  295. if (!['existing', 'new'].includes(workspaceType)) {
  296. return res.status(400).json({ error: 'workspaceType must be "existing" or "new"' });
  297. }
  298. // Validate path safety before any operations
  299. const validation = await validateWorkspacePath(workspacePath);
  300. if (!validation.valid) {
  301. return res.status(400).json({
  302. error: 'Invalid workspace path',
  303. details: validation.error
  304. });
  305. }
  306. const absolutePath = validation.resolvedPath;
  307. // Handle existing workspace
  308. if (workspaceType === 'existing') {
  309. // Check if the path exists
  310. try {
  311. await fs.access(absolutePath);
  312. const stats = await fs.stat(absolutePath);
  313. if (!stats.isDirectory()) {
  314. return res.status(400).json({ error: 'Path exists but is not a directory' });
  315. }
  316. } catch (error) {
  317. if (error.code === 'ENOENT') {
  318. return res.status(404).json({ error: 'Workspace path does not exist' });
  319. }
  320. throw error;
  321. }
  322. // Add the existing workspace to the project list
  323. const project = await addProjectManually(absolutePath);
  324. return res.json({
  325. success: true,
  326. project,
  327. message: 'Existing workspace added successfully'
  328. });
  329. }
  330. // Handle new workspace creation
  331. if (workspaceType === 'new') {
  332. // Create the directory if it doesn't exist
  333. await fs.mkdir(absolutePath, { recursive: true });
  334. // If GitHub URL is provided, clone the repository
  335. if (githubUrl) {
  336. let githubToken = null;
  337. // Get GitHub token if needed
  338. if (githubTokenId) {
  339. // Fetch token from database
  340. const token = await getGithubTokenById(githubTokenId, req.user.id);
  341. if (!token) {
  342. // Clean up created directory
  343. await fs.rm(absolutePath, { recursive: true, force: true });
  344. return res.status(404).json({ error: 'GitHub token not found' });
  345. }
  346. githubToken = token.github_token;
  347. } else if (newGithubToken) {
  348. githubToken = newGithubToken;
  349. }
  350. // Extract repo name from URL for the clone destination
  351. const normalizedUrl = githubUrl.replace(/\/+$/, '').replace(/\.git$/, '');
  352. const repoName = normalizedUrl.split('/').pop() || 'repository';
  353. const clonePath = path.join(absolutePath, repoName);
  354. // Check if clone destination already exists to prevent data loss
  355. try {
  356. await fs.access(clonePath);
  357. return res.status(409).json({
  358. error: 'Directory already exists',
  359. details: `The destination path "${clonePath}" already exists. Please choose a different location or remove the existing directory.`
  360. });
  361. } catch (err) {
  362. // Directory doesn't exist, which is what we want
  363. }
  364. // Clone the repository into a subfolder
  365. try {
  366. await cloneGitHubRepository(githubUrl, clonePath, githubToken);
  367. } catch (error) {
  368. // Only clean up if clone created partial data (check if dir exists and is empty or partial)
  369. try {
  370. const stats = await fs.stat(clonePath);
  371. if (stats.isDirectory()) {
  372. await fs.rm(clonePath, { recursive: true, force: true });
  373. }
  374. } catch (cleanupError) {
  375. // Directory doesn't exist or cleanup failed - ignore
  376. }
  377. throw new Error(`Failed to clone repository: ${error.message}`);
  378. }
  379. // Add the cloned repo path to the project list
  380. const project = await addProjectManually(clonePath);
  381. return res.json({
  382. success: true,
  383. project,
  384. message: 'New workspace created and repository cloned successfully'
  385. });
  386. }
  387. // Add the new workspace to the project list (no clone)
  388. const project = await addProjectManually(absolutePath);
  389. return res.json({
  390. success: true,
  391. project,
  392. message: 'New workspace created successfully'
  393. });
  394. }
  395. } catch (error) {
  396. console.error('Error creating workspace:', error);
  397. res.status(500).json({
  398. error: error.message || 'Failed to create workspace',
  399. details: process.env.NODE_ENV === 'development' ? error.stack : undefined
  400. });
  401. }
  402. });
  403. /**
  404. * Helper function to get GitHub token from database
  405. */
  406. async function getGithubTokenById(tokenId, userId) {
  407. const { db } = await import('../database/db.js');
  408. const credential = db.prepare(
  409. 'SELECT * FROM user_credentials WHERE id = ? AND user_id = ? AND credential_type = ? AND is_active = 1'
  410. ).get(tokenId, userId, 'github_token');
  411. // Return in the expected format (github_token field for compatibility)
  412. if (credential) {
  413. return {
  414. ...credential,
  415. github_token: credential.credential_value
  416. };
  417. }
  418. return null;
  419. }
  420. /**
  421. * Clone repository with progress streaming (SSE)
  422. * GET /api/projects/clone-progress
  423. */
  424. router.get('/clone-progress', async (req, res) => {
  425. const { path: workspacePath, githubUrl, githubTokenId, newGithubToken } = req.query;
  426. res.setHeader('Content-Type', 'text/event-stream');
  427. res.setHeader('Cache-Control', 'no-cache');
  428. res.setHeader('Connection', 'keep-alive');
  429. res.flushHeaders();
  430. const sendEvent = (type, data) => {
  431. res.write(`data: ${JSON.stringify({ type, ...data })}\n\n`);
  432. };
  433. try {
  434. if (!workspacePath || !githubUrl) {
  435. sendEvent('error', { message: 'workspacePath and githubUrl are required' });
  436. res.end();
  437. return;
  438. }
  439. const validation = await validateWorkspacePath(workspacePath);
  440. if (!validation.valid) {
  441. sendEvent('error', { message: validation.error });
  442. res.end();
  443. return;
  444. }
  445. const absolutePath = validation.resolvedPath;
  446. await fs.mkdir(absolutePath, { recursive: true });
  447. let githubToken = null;
  448. if (githubTokenId) {
  449. const token = await getGithubTokenById(parseInt(githubTokenId), req.user.id);
  450. if (!token) {
  451. await fs.rm(absolutePath, { recursive: true, force: true });
  452. sendEvent('error', { message: 'GitHub token not found' });
  453. res.end();
  454. return;
  455. }
  456. githubToken = token.github_token;
  457. } else if (newGithubToken) {
  458. githubToken = newGithubToken;
  459. }
  460. const normalizedUrl = githubUrl.replace(/\/+$/, '').replace(/\.git$/, '');
  461. const repoName = normalizedUrl.split('/').pop() || 'repository';
  462. const clonePath = path.join(absolutePath, repoName);
  463. // Check if clone destination already exists to prevent data loss
  464. try {
  465. await fs.access(clonePath);
  466. sendEvent('error', { message: `Directory "${repoName}" already exists. Please choose a different location or remove the existing directory.` });
  467. res.end();
  468. return;
  469. } catch (err) {
  470. // Directory doesn't exist, which is what we want
  471. }
  472. let cloneUrl = githubUrl;
  473. if (githubToken) {
  474. try {
  475. const url = new URL(githubUrl);
  476. url.username = githubToken;
  477. url.password = '';
  478. cloneUrl = url.toString();
  479. } catch (error) {
  480. // SSH URL or invalid - use as-is
  481. }
  482. }
  483. sendEvent('progress', { message: `Cloning into '${repoName}'...` });
  484. const gitProcess = spawn('git', ['clone', '--progress', cloneUrl, clonePath], {
  485. stdio: ['ignore', 'pipe', 'pipe'],
  486. env: {
  487. ...process.env,
  488. GIT_TERMINAL_PROMPT: '0'
  489. }
  490. });
  491. let lastError = '';
  492. gitProcess.stdout.on('data', (data) => {
  493. const message = data.toString().trim();
  494. if (message) {
  495. sendEvent('progress', { message });
  496. }
  497. });
  498. gitProcess.stderr.on('data', (data) => {
  499. const message = data.toString().trim();
  500. lastError = message;
  501. if (message) {
  502. sendEvent('progress', { message });
  503. }
  504. });
  505. gitProcess.on('close', async (code) => {
  506. if (code === 0) {
  507. try {
  508. const project = await addProjectManually(clonePath);
  509. sendEvent('complete', { project, message: 'Repository cloned successfully' });
  510. } catch (error) {
  511. sendEvent('error', { message: `Clone succeeded but failed to add project: ${error.message}` });
  512. }
  513. } else {
  514. const sanitizedError = sanitizeGitError(lastError, githubToken);
  515. let errorMessage = 'Git clone failed';
  516. if (lastError.includes('Authentication failed') || lastError.includes('could not read Username')) {
  517. errorMessage = 'Authentication failed. Please check your credentials.';
  518. } else if (lastError.includes('Repository not found')) {
  519. errorMessage = 'Repository not found. Please check the URL and ensure you have access.';
  520. } else if (lastError.includes('already exists')) {
  521. errorMessage = 'Directory already exists';
  522. } else if (sanitizedError) {
  523. errorMessage = sanitizedError;
  524. }
  525. try {
  526. await fs.rm(clonePath, { recursive: true, force: true });
  527. } catch (cleanupError) {
  528. console.error('Failed to clean up after clone failure:', sanitizeGitError(cleanupError.message, githubToken));
  529. }
  530. sendEvent('error', { message: errorMessage });
  531. }
  532. res.end();
  533. });
  534. gitProcess.on('error', (error) => {
  535. if (error.code === 'ENOENT') {
  536. sendEvent('error', { message: 'Git is not installed or not in PATH' });
  537. } else {
  538. sendEvent('error', { message: error.message });
  539. }
  540. res.end();
  541. });
  542. req.on('close', () => {
  543. gitProcess.kill();
  544. });
  545. } catch (error) {
  546. sendEvent('error', { message: error.message });
  547. res.end();
  548. }
  549. });
  550. /**
  551. * Helper function to clone a GitHub repository
  552. */
  553. function cloneGitHubRepository(githubUrl, destinationPath, githubToken = null) {
  554. return new Promise((resolve, reject) => {
  555. let cloneUrl = githubUrl;
  556. if (githubToken) {
  557. try {
  558. const url = new URL(githubUrl);
  559. url.username = githubToken;
  560. url.password = '';
  561. cloneUrl = url.toString();
  562. } catch (error) {
  563. // SSH URL - use as-is
  564. }
  565. }
  566. const gitProcess = spawn('git', ['clone', '--progress', cloneUrl, destinationPath], {
  567. stdio: ['ignore', 'pipe', 'pipe'],
  568. env: {
  569. ...process.env,
  570. GIT_TERMINAL_PROMPT: '0'
  571. }
  572. });
  573. let stdout = '';
  574. let stderr = '';
  575. gitProcess.stdout.on('data', (data) => {
  576. stdout += data.toString();
  577. });
  578. gitProcess.stderr.on('data', (data) => {
  579. stderr += data.toString();
  580. });
  581. gitProcess.on('close', (code) => {
  582. if (code === 0) {
  583. resolve({ stdout, stderr });
  584. } else {
  585. let errorMessage = 'Git clone failed';
  586. if (stderr.includes('Authentication failed') || stderr.includes('could not read Username')) {
  587. errorMessage = 'Authentication failed. Please check your GitHub token.';
  588. } else if (stderr.includes('Repository not found')) {
  589. errorMessage = 'Repository not found. Please check the URL and ensure you have access.';
  590. } else if (stderr.includes('already exists')) {
  591. errorMessage = 'Directory already exists';
  592. } else if (stderr) {
  593. errorMessage = stderr;
  594. }
  595. reject(new Error(errorMessage));
  596. }
  597. });
  598. gitProcess.on('error', (error) => {
  599. if (error.code === 'ENOENT') {
  600. reject(new Error('Git is not installed or not in PATH'));
  601. } else {
  602. reject(error);
  603. }
  604. });
  605. });
  606. }
  607. export default router;