DC-001: Fix 4 failing services.routes tests - add /services/ prefix to credential routes

The 3 credential endpoints (POST/DELETE/GET /:serviceId/credentials) were missing
the /services/ path segment, causing 404s when tests called /api/services/<id>/credentials.

Fixed routes now match the URL pattern used by the live frontend
(/api/v1/services/<id>/credentials) and the test suite.

All 759 tests pass.
This commit is contained in:
Hermes
2026-06-13 11:12:14 -07:00
parent 8e703d9c4c
commit 2580c65074
+3 -3
View File
@@ -197,7 +197,7 @@ module.exports = function({
// ===== SERVICE CREDENTIAL ENDPOINTS =====
// Store credentials for a service
router.post('/:serviceId/credentials', asyncHandler(async (req, res) => {
router.post('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
const { serviceId } = req.params;
// Validate serviceId to prevent path traversal in credential keys
@@ -221,7 +221,7 @@ module.exports = function({
}, 'store-service-creds'));
// Delete credentials for a service
router.delete('/:serviceId/credentials', asyncHandler(async (req, res) => {
router.delete('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
const { serviceId } = req.params;
// Validate serviceId to prevent path traversal in credential keys
@@ -236,7 +236,7 @@ module.exports = function({
}, 'delete-service-creds'));
// Check credential status for a service (what's stored)
router.get('/:serviceId/credentials', asyncHandler(async (req, res) => {
router.get('/services/:serviceId/credentials', asyncHandler(async (req, res) => {
const { serviceId } = req.params;
// Validate serviceId to prevent path traversal in credential keys