Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a dedicated route in the Version API to obtain the latest version of some terms #1034

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ndpnt
Copy link
Member

@Ndpnt Ndpnt commented Dec 12, 2023

No description provided.

@Ndpnt Ndpnt requested a review from MattiSG December 12, 2023 09:11
Copy link
Member

@MattiSG MattiSG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the refactor of tests and the opening of this route, but it is missing some important design choices. In particular, what happens if a service has been terminated, or if the chosen terms types have been phased out by the service? The latest version exists, but is not valid anymore. Do we really want to expose latest, or do we want to expose the current version?

If the service has been terminated (or the terms types do not exist anymore), do we reply with 404, 416 or 410 Gone?

Those questions should be discussed in a separate place than the PR implementing it.

@@ -97,14 +148,18 @@ router.get('/version/:serviceId/:termsType/:date', async (req, res) => {
const version = await versionsRepository.findByDate(serviceId, termsType, requestedDate);

if (!version) {
return res.status(404).json({ error: `No version found for date ${date}` });
return res.status(404).json({ error: `No version found the specified combination of service ID "${serviceId}", terms type "${termsType}" and date ${date}` });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return res.status(404).json({ error: `No version found the specified combination of service ID "${serviceId}", terms type "${termsType}" and date ${date}` });
return res.status(404).json({ error: `No version found for the specified combination of service ID "${serviceId}", terms type "${termsType}" and date ${date}` });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants