(request)
| 431 | |
| 432 | return { |
| 433 | async createRepo(request) { |
| 434 | const repoId = request.repoId ?? createId() |
| 435 | const createdAt = request.createdAt ?? now() |
| 436 | const reposDoc = await loadDoc(storage, "code:repos") |
| 437 | |
| 438 | try { |
| 439 | if (findRepoMap(reposDoc, repoId)) { |
| 440 | return { repoId, createdAt } |
| 441 | } |
| 442 | |
| 443 | reposDoc.transact(() => { |
| 444 | pushOrderedItem(reposDoc, "repos", { |
| 445 | id: repoId, |
| 446 | name: request.name, |
| 447 | path: request.path, |
| 448 | createdBy: request.createdBy, |
| 449 | createdAt, |
| 450 | updatedAt: createdAt, |
| 451 | tasks: [], |
| 452 | }) |
| 453 | }) |
| 454 | await saveDoc(storage, "code:repos", reposDoc) |
| 455 | return { repoId, createdAt } |
| 456 | } finally { |
| 457 | reposDoc.destroy() |
| 458 | } |
| 459 | }, |
| 460 | |
| 461 | async updateRepo(request) { |
| 462 | const updatedAt = request.updatedAt ?? now() |
nothing calls this directly
no test coverage detected