chore: removes ability to retain deleted versions

This commit is contained in:
James
2023-01-31 21:16:40 -05:00
parent 44d55e39f3
commit 6ae6b9268f
9 changed files with 77 additions and 88 deletions

View File

@@ -126,7 +126,6 @@ const collectionSchema = joi.object().keys({
versions: joi.alternatives().try(
joi.object({
maxPerDoc: joi.number(),
retainDeleted: joi.boolean(),
drafts: joi.alternatives().try(
joi.object({
autosave: joi.alternatives().try(

View File

@@ -173,13 +173,11 @@ async function deleteOperation<TSlug extends keyof GeneratedTypes['collections']
// Delete versions
// /////////////////////////////////////
if (!collectionConfig.versions.retainDeleted) {
deleteCollectionVersions({
payload,
id,
slug: collectionConfig.slug,
});
}
deleteCollectionVersions({
payload,
id,
slug: collectionConfig.slug,
});
// /////////////////////////////////////
// afterDelete - Collection

View File

@@ -6,7 +6,6 @@ export const versionCollectionDefaults: IncomingCollectionVersions = {
interval: 2000, // in milliseconds
},
},
retainDeleted: false,
};
export const versionGlobalDefaults: IncomingGlobalVersions = {

View File

@@ -12,22 +12,20 @@ export type SanitizedDrafts = {
export type IncomingCollectionVersions = {
maxPerDoc?: number
retainDeleted?: boolean
drafts?: boolean | IncomingDrafts
}
export interface SanitizedCollectionVersions extends Omit<IncomingCollectionVersions, 'drafts'> {
maxPerDoc?: number
retainDeleted: boolean
drafts: SanitizedDrafts | false
}
export type IncomingGlobalVersions= {
export type IncomingGlobalVersions = {
max?: number
drafts?: boolean | IncomingDrafts
}
export type SanitizedGlobalVersions= {
export type SanitizedGlobalVersions = {
max: number
drafts: SanitizedDrafts | false
}