Compare commits
1 Commits
db-postgre
...
chore/db-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fddeb621ca |
@@ -31,6 +31,7 @@ export const incrementLoginAttempts = async ({
|
||||
lockUntil: null,
|
||||
loginAttempts: 1,
|
||||
},
|
||||
depth: 0,
|
||||
req,
|
||||
})
|
||||
}
|
||||
@@ -52,6 +53,7 @@ export const incrementLoginAttempts = async ({
|
||||
id: doc.id,
|
||||
collection: collection.slug,
|
||||
data,
|
||||
depth: 0,
|
||||
req,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ export const registerLocalStrategy = async ({
|
||||
const existingUser = await payload.find({
|
||||
collection: collection.slug,
|
||||
depth: 0,
|
||||
limit: 1,
|
||||
pagination: false,
|
||||
where: {
|
||||
email: {
|
||||
equals: doc.email,
|
||||
|
||||
@@ -23,6 +23,7 @@ export const resetLoginAttempts = async ({
|
||||
lockUntil: null,
|
||||
loginAttempts: 0,
|
||||
},
|
||||
depth: 0,
|
||||
overrideAccess: true,
|
||||
req,
|
||||
})
|
||||
|
||||
@@ -31,16 +31,14 @@ async function deleteOperation(args: PreferenceRequest): Promise<Document> {
|
||||
],
|
||||
}
|
||||
|
||||
const result = await payload.delete({
|
||||
const result = await payload.db.deleteOne({
|
||||
collection: 'payload-preferences',
|
||||
depth: 0,
|
||||
user,
|
||||
req,
|
||||
where,
|
||||
})
|
||||
|
||||
// @ts-expect-error // TODO: fix later
|
||||
if (result.docs.length === 1) {
|
||||
return result.docs[0]
|
||||
if (result) {
|
||||
return result
|
||||
}
|
||||
throw new NotFound()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ async function findOne(
|
||||
const {
|
||||
key,
|
||||
req: { payload },
|
||||
req,
|
||||
user,
|
||||
} = args
|
||||
|
||||
@@ -21,17 +22,11 @@ async function findOne(
|
||||
],
|
||||
}
|
||||
|
||||
const { docs } = await payload.find({
|
||||
return await payload.db.findOne({
|
||||
collection: 'payload-preferences',
|
||||
depth: 0,
|
||||
pagination: false,
|
||||
user,
|
||||
req,
|
||||
where,
|
||||
})
|
||||
|
||||
if (docs.length === 0) return null
|
||||
|
||||
return docs[0]
|
||||
}
|
||||
|
||||
export default findOne
|
||||
|
||||
@@ -65,6 +65,7 @@ const replaceWithDraftIfAvailable = async <T extends TypeWithID>({
|
||||
global: entity.slug,
|
||||
limit: 1,
|
||||
locale,
|
||||
pagination: false,
|
||||
req,
|
||||
sort: '-updatedAt',
|
||||
where: combineQueries(queryToBuild, versionAccessResult),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { SanitizedCollectionConfig } from '../collections/config/types'
|
||||
import type { SanitizedGlobalConfig } from '../globals/config/types'
|
||||
import type { Payload } from '../payload'
|
||||
import type { PayloadRequest } from '../types'
|
||||
import type { Where } from '../types'
|
||||
import type { PayloadRequest, Where } from '../types'
|
||||
|
||||
type Args = {
|
||||
collection?: SanitizedCollectionConfig
|
||||
@@ -46,6 +45,7 @@ export const enforceMaxVersions = async ({
|
||||
} else if (global) {
|
||||
const query = await payload.db.findGlobalVersions({
|
||||
global: global.slug,
|
||||
pagination: false,
|
||||
req,
|
||||
skip: max,
|
||||
sort: '-updatedAt',
|
||||
|
||||
@@ -26,6 +26,8 @@ export const getLatestCollectionVersion = async <T extends TypeWithID = any>({
|
||||
if (config.versions?.drafts) {
|
||||
const { docs } = await payload.db.findVersions<T>({
|
||||
collection: config.slug,
|
||||
limit: 1,
|
||||
pagination: false,
|
||||
req,
|
||||
sort: '-updatedAt',
|
||||
where: { parent: { equals: id } },
|
||||
|
||||
@@ -14,11 +14,11 @@ type Args = {
|
||||
}
|
||||
|
||||
export const getLatestGlobalVersion = async ({
|
||||
slug,
|
||||
config,
|
||||
locale,
|
||||
payload,
|
||||
req,
|
||||
slug,
|
||||
where,
|
||||
}: Args): Promise<{ global: Document; globalExists: boolean }> => {
|
||||
let latestVersion
|
||||
@@ -30,6 +30,7 @@ export const getLatestGlobalVersion = async ({
|
||||
global: slug,
|
||||
limit: 1,
|
||||
locale,
|
||||
pagination: false,
|
||||
req,
|
||||
sort: '-updatedAt',
|
||||
})
|
||||
@@ -37,9 +38,9 @@ export const getLatestGlobalVersion = async ({
|
||||
}
|
||||
|
||||
const global = await payload.db.findGlobal({
|
||||
slug,
|
||||
locale,
|
||||
req,
|
||||
slug,
|
||||
where,
|
||||
})
|
||||
const globalExists = Boolean(global)
|
||||
|
||||
@@ -40,6 +40,7 @@ export const saveVersion = async ({
|
||||
let docs
|
||||
const findVersionArgs = {
|
||||
limit: 1,
|
||||
pagination: false,
|
||||
req,
|
||||
sort: '-updatedAt',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user