forked from jappel/leistungsbilanz-ts
15 lines
511 B
TypeScript
15 lines
511 B
TypeScript
import type { Request, Response } from "express";
|
|
import { projectHistoryStore } from "../composition/project-command-stores.js";
|
|
|
|
export function getProjectHistory(req: Request, res: Response) {
|
|
const { projectId } = req.params;
|
|
if (typeof projectId !== "string") {
|
|
return res.status(400).json({ error: "Invalid projectId" });
|
|
}
|
|
|
|
const state = projectHistoryStore.getState(projectId);
|
|
if (!state) {
|
|
return res.status(404).json({ error: "Project not found" });
|
|
}
|
|
return res.json(state);
|
|
}
|