feat(project): support project metadata updates

This commit is contained in:
Brendan Allan 2026-07-21 19:02:33 +08:00
commit 9afd059fa1
No known key found for this signature in database
GPG key ID: 41E835AEA046A32E
13 changed files with 111 additions and 2 deletions

View file

@ -66,6 +66,31 @@ describe("ProjectV2.list", () => {
)
})
describe("ProjectV2.update", () => {
it.effect("updates project metadata", () =>
Effect.gen(function* () {
const db = (yield* Database.Service).db
const project = yield* ProjectV2.Service
const id = ProjectV2.ID.make("updated")
yield* db
.insert(ProjectTable)
.values({ id, worktree: abs("/updated"), sandboxes: [], time_created: 1, time_updated: 1 })
.run()
const result = yield* project.update(id, {
name: "Updated",
icon: { color: "#ffffff" },
commands: { start: "bun dev" },
})
expect(result.name).toBe("Updated")
expect(result.icon).toEqual({ color: "#ffffff" })
expect(result.commands).toEqual({ start: "bun dev" })
expect(result.time.updated).toBeGreaterThan(1)
}),
)
})
function remoteID(remote: string) {
return ProjectV2.ID.make(Hash.fast(`git-remote:${remote}`))
}