mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
refactoring the api endpoints to be separate files to reduce context usage
This commit is contained in:
37
apps/server/src/routes/auto-mode/routes/verify-feature.ts
Normal file
37
apps/server/src/routes/auto-mode/routes/verify-feature.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* POST /verify-feature endpoint - Verify a feature
|
||||
*/
|
||||
|
||||
import type { Request, Response } from "express";
|
||||
import type { AutoModeService } from "../../../services/auto-mode-service.js";
|
||||
import { getErrorMessage, logError } from "../common.js";
|
||||
|
||||
export function createVerifyFeatureHandler(autoModeService: AutoModeService) {
|
||||
return async (req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const { projectPath, featureId } = req.body as {
|
||||
projectPath: string;
|
||||
featureId: string;
|
||||
};
|
||||
|
||||
if (!projectPath || !featureId) {
|
||||
res
|
||||
.status(400)
|
||||
.json({
|
||||
success: false,
|
||||
error: "projectPath and featureId are required",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const passes = await autoModeService.verifyFeature(
|
||||
projectPath,
|
||||
featureId
|
||||
);
|
||||
res.json({ success: true, passes });
|
||||
} catch (error) {
|
||||
logError(error, "Verify feature failed");
|
||||
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user