Spaces:
Configuration error
Configuration error
| ```typescript | |
| import { readProjects, writeProjects } from "../routes/projects.store.js"; | |
| export const projectCreate = { | |
| name: "project.create", | |
| async run(input: { projectId: string; text: string }) { | |
| const name = input.text.split(":")[1]?.trim() || `Projet ${new Date().toISOString()}`; | |
| const db = readProjects(); | |
| const id = "p_" + Math.random().toString(16).slice(2); | |
| db.projects.push({ id, name, createdAt: Date.now() }); | |
| writeProjects(db); | |
| return `Projet créé ✅ id=${id} name="${name}"`; | |
| } | |
| }; | |
| ``` |