UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

2 lines 793 B
import{copy as e}from"../../../libs/i18n/copy.mjs";import t from"../../../libs/repositories/documents.mjs";const n=async(n,r)=>{if(r.collectionMode===`multiple`)return{error:void 0,data:void 0};let i=await new t(n.db.client,n.config.db).selectMultipleCollectionDocumentIds({collectionKey:r.collectionKey,isDeleted:n.config.db.getDefault(`boolean`,`false`),tenantKey:n.request.tenantKey},{tableName:r.documentTable});return i.error?i:i.data?.some(e=>e.id!==r.documentId)?{error:{type:`basic`,message:e(`server:core.collections.single.document.exists`),status:400,errors:{collectionKey:{code:`invalid`,message:e(`server:core.collections.single.document.exists`)}}},data:void 0}:{error:void 0,data:void 0}};export{n as default}; //# sourceMappingURL=check-single-collection-document-count.mjs.map