( db: Database, id: string, updatedAt: string = nowIso(), )
| 190 | } |
| 191 | |
| 192 | export function touchDesignActivity( |
| 193 | db: Database, |
| 194 | id: string, |
| 195 | updatedAt: string = nowIso(), |
| 196 | ): Design | null { |
| 197 | return mutateStore(db, (data) => { |
| 198 | const idx = data.designs.findIndex((design) => design.id === id); |
| 199 | if (idx < 0) return null; |
| 200 | const current = data.designs[idx]; |
| 201 | if (current === undefined) return null; |
| 202 | const nextUpdatedAt = updatedAt > current.updatedAt ? updatedAt : current.updatedAt; |
| 203 | const updated: Design = { ...current, updatedAt: nextUpdatedAt }; |
| 204 | data.designs[idx] = updated; |
| 205 | return updated; |
| 206 | }); |
| 207 | } |
| 208 | |
| 209 | export function renameDesign(db: Database, id: string, name: string): Design | null { |
| 210 | const trimmed = name.trim(); |
no test coverage detected