-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename to createCollectionIfDoesNotExist for clarity
- Loading branch information
Showing
5 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
api.planx.uk/modules/analytics/metabase/collection/controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { checkCollections } from "./service.js"; | ||
import { createCollectionIfDoesNotExist } from "./service.js"; | ||
import type { NewCollectionRequestHandler } from "./types.js"; | ||
|
||
export const checkCollectionsController: NewCollectionRequestHandler = async ( | ||
_req, | ||
res, | ||
) => { | ||
try { | ||
const params = res.locals.parsedReq.body; | ||
const collection = await checkCollections(params); | ||
res.status(201).json({ data: collection }); | ||
} catch (error) { | ||
res.status(400).json({ | ||
error: | ||
error instanceof Error ? error.message : "An unexpected error occurred", | ||
}); | ||
} | ||
}; | ||
export const createCollectionIfDoesNotExistController: NewCollectionRequestHandler = | ||
async (_req, res) => { | ||
try { | ||
const params = res.locals.parsedReq.body; | ||
const collection = await createCollectionIfDoesNotExist(params); | ||
res.status(201).json({ data: collection }); | ||
} catch (error) { | ||
res.status(400).json({ | ||
error: | ||
error instanceof Error | ||
? error.message | ||
: "An unexpected error occurred", | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters