chore: add back in condition for collection GET path with 2 slugs

This commit is contained in:
Jarrod Flesch
2024-02-08 12:27:20 -05:00
parent 33aefb69f4
commit f2c766ddaf

View File

@@ -149,11 +149,15 @@ export const GET = async (
if (slug.length === 1) {
// /:collection
response = endpoints.collection.GET.find({ req, collection })
} else if (slug.length === 2 && slug2 in endpoints.collection.GET) {
// /:collection/init
// /:collection/me
// /:collection/versions
response = endpoints.collection.GET?.[slug2]({ req, collection })
} else if (slug.length === 2) {
if (slug2 in endpoints.collection.GET) {
// /:collection/init
// /:collection/me
// /:collection/versions
response = endpoints.collection.GET?.[slug2]({ req, collection })
} else {
response = endpoints.collection.GET.findByID({ req, id: slug2, collection })
}
} else if (slug.length === 3 && `doc-${slug2}-by-id` in endpoints.collection.GET) {
// /:collection/access/:id
// /:collection/versions/:id