chore: revert removal of packages

This commit is contained in:
Wojtek Rybakiewicz
2023-12-07 15:38:32 +01:00
parent 7b3a9ec5f7
commit 76ae41dc8b

View File

@@ -96,7 +96,8 @@ export const packages = (router: Router) => {
"/packages/latest",
asyncHandler(async (req, res) => {
console.log("Getting latest packages")
throwExpiredApiError()
const initialMongoQuery = {};
return await findPackage(req, res, initialMongoQuery);
})
);
@@ -108,7 +109,14 @@ export const packages = (router: Router) => {
"/packages",
asyncHandler(async (req, res) => {
console.log("Getting packages by timestamp")
throwExpiredApiError()
if (!req.query.toTimestamp) {
throw new Error("toTimestamp query param is required");
}
const initialMongoQuery = {
timestamp: { $lte: req.query.toTimestamp },
};
return await findPackage(req, res, initialMongoQuery);
})
);
};