Ghost/ghost/admin/app/adapters/collection.js
Naz baf0f4b692 Added /collections/slug/:slug Admin API endpoint
closes https://github.com/TryGhost/Arch/issues/45

- This endpoint is here to keep the convention of being able to fetch the resource by it's slug through a `GET /{resource_name}/slug/:slug`. It has identical output as the `GET /collections/:id` endpoint
- The alternative would be having an alias and try fetching by :id and then by slug if the result for id was null, but that would be a completely new pattern we have not used anywhere else yet.
2023-07-24 14:27:17 +08:00

11 lines
329 B
JavaScript

import ApplicationAdapter from 'ghost-admin/adapters/application';
import SlugUrl from 'ghost-admin/utils/slug-url';
export default class Tag extends ApplicationAdapter {
buildURL(_modelName, _id, _snapshot, _requestType, query) {
let url = super.buildURL(...arguments);
return SlugUrl(url, query);
}
}