fischerX/tools/cli/templates/module/{{name}}.ts.template

20 lines
426 B
Plaintext

import type { {{pascalName}} } from './types';
export function create{{pascalName}}(name: string): {{pascalName}} {
const now = new Date();
return {
id: crypto.randomUUID(),
name,
createdAt: now,
updatedAt: now,
};
}
export function update{{pascalName}}(item: {{pascalName}}, updates: Partial<{{pascalName}}>): {{pascalName}} {
return {
...item,
...updates,
updatedAt: new Date(),
};
}