Search about lifecycle.js.
So you can catch the event of duplication like this;
src/api/article/content-types/article/lifecycles.js
export default {
async beforeCreate(event) {
const { data } = event.params;
const existing = await strapi.entityService.findMany('api::article.article', {
filters: {
title: data.title,
},
});
if (existing.length > 0) {
throw new Error('already exists!');
}
//
// strapi.log.warn(`Duplicate entry detected for title: ${data.title}`);
},
};
i strongly suggest to use AI tool in the page of strapi doc.
Also you can create a plugin for more flexible solution but i belive lifecycle hooks may solve your issue.
Love Strapi ![]()