MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / reorderProjects

Function reorderProjects

desktop/thread-state-db/project-writes.ts:103–122  ·  view source on GitHub ↗
(projectIds: string[])

Source from the content-addressed store, hash-verified

101}
102
103export function reorderProjects(projectIds: string[]) {
104 if (projectIds.length === 0) {
105 return
106 }
107
108 const db = getThreadStateDatabase()
109 const updateProjectOrder = db.prepare(
110 `
111 UPDATE projects
112 SET order_index = ?, updated_at = CURRENT_TIMESTAMP
113 WHERE cwd = ?
114 `,
115 )
116
117 runInTransaction(db, () => {
118 projectIds.forEach((projectId, index) => {
119 updateProjectOrder.run(index, projectId)
120 })
121 })
122}
123
124export function moveProjectToTop(projectId: string) {
125 const db = getThreadStateDatabase()

Callers 1

project-actions.tsFile · 0.90

Calls 4

getThreadStateDatabaseFunction · 0.90
runInTransactionFunction · 0.90
prepareMethod · 0.80
runMethod · 0.80

Tested by

no test coverage detected