mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 16:01:40 +03:00
6e68c43f78
closes https://github.com/TryGhost/Product/issues/3818 - in Admin, when adding a recommendation, the URL is compared against all existing ones. If the URL is already recommended, the publisher is shown an error: "A recommendation with this URL already exists.". Protocol, www, query parameters and hash fragments are ignored during the URL comparison. - on the backend, there is another uniqueness validation for the recommendation URL. This check is redundant when adding a recommendation from Admin, but helps to keep data integrity when recommendations are added through other paths (e.g. via the API)
19 lines
702 B
TypeScript
19 lines
702 B
TypeScript
import {OrderOption} from '@tryghost/bookshelf-repository';
|
|
import {Recommendation} from './Recommendation';
|
|
|
|
export interface RecommendationRepository {
|
|
save(entity: Recommendation): Promise<void>;
|
|
getById(id: string): Promise<Recommendation | null>;
|
|
getByUrl(url: URL): Promise<Recommendation | null>;
|
|
getAll({filter, order}?: {filter?: string, order?: OrderOption<Recommendation>}): Promise<Recommendation[]>;
|
|
getPage({filter, order, page, limit}: {
|
|
filter?: string;
|
|
order?: OrderOption<Recommendation>;
|
|
page: number;
|
|
limit: number;
|
|
}): Promise<Recommendation[]>;
|
|
getCount({filter}?: {
|
|
filter?: string;
|
|
}): Promise<number>;
|
|
};
|