Files
leistungsbilanz-ts/src/server/controllers/circuit.controller.ts
T
2026-07-25 21:30:29 +02:00

18 lines
654 B
TypeScript

import type { Request, Response } from "express";
import { circuitNumberingService } from "../composition/circuit-numbering-service.js";
export async function getNextCircuitIdentifier(req: Request, res: Response) {
const { sectionId } = req.params;
if (typeof sectionId !== "string") {
return res.status(400).json({ error: "Invalid sectionId" });
}
try {
const nextIdentifier =
await circuitNumberingService.getNextIdentifier(sectionId);
return res.json({ sectionId, nextIdentifier });
} catch (error) {
return res.status(400).json({ error: error instanceof Error ? error.message : "Failed to get identifier." });
}
}