| 459 | }, |
| 460 | |
| 461 | async updateRepo(request) { |
| 462 | const updatedAt = request.updatedAt ?? now() |
| 463 | const reposDoc = await loadDoc(storage, "code:repos") |
| 464 | |
| 465 | try { |
| 466 | const repoMap = findRepoMap(reposDoc, request.repoId) |
| 467 | if (!repoMap) throw new Error(`Repository ${request.repoId} not found`) |
| 468 | |
| 469 | reposDoc.transact(() => { |
| 470 | if (request.name !== undefined) repoMap.set("name", request.name) |
| 471 | if (request.path !== undefined) repoMap.set("path", request.path) |
| 472 | if (request.archived !== undefined) repoMap.set("archived", request.archived) |
| 473 | repoMap.set("updatedAt", updatedAt) |
| 474 | }) |
| 475 | await saveDoc(storage, "code:repos", reposDoc) |
| 476 | } finally { |
| 477 | reposDoc.destroy() |
| 478 | } |
| 479 | }, |
| 480 | |
| 481 | async deleteRepo(request) { |
| 482 | const reposDoc = await loadDoc(storage, "code:repos") |