feat: types this within crreate op
This commit is contained in:
@@ -17,6 +17,7 @@ import sendVerificationEmail from '../../auth/sendVerificationEmail';
|
||||
import { AfterChangeHook, BeforeOperationHook, BeforeValidateHook, Collection } from '../config/types';
|
||||
import { PayloadRequest } from '../../express/types';
|
||||
import { Document } from '../../types';
|
||||
import { Payload } from '../..';
|
||||
|
||||
export type Arguments = {
|
||||
collection: Collection
|
||||
@@ -28,7 +29,7 @@ export type Arguments = {
|
||||
data: Record<string, unknown>
|
||||
}
|
||||
|
||||
async function create(incomingArgs: Arguments): Promise<Document> {
|
||||
async function create(this: Payload, incomingArgs: Arguments): Promise<Document> {
|
||||
const { performFieldOperations, config, emailOptions } = this;
|
||||
|
||||
let args = incomingArgs;
|
||||
|
||||
@@ -9,16 +9,16 @@ import { HookName } from './config/types';
|
||||
|
||||
type Arguments = {
|
||||
data: Record<string, unknown>
|
||||
originalDoc: Record<string, unknown>
|
||||
operation: Operation
|
||||
hook: HookName
|
||||
req: PayloadRequest
|
||||
id: string
|
||||
overrideAccess: boolean
|
||||
reduceLocales: boolean
|
||||
showHiddenFields: boolean
|
||||
depth: number
|
||||
currentDepth: number
|
||||
reduceLocales?: boolean
|
||||
originalDoc?: Record<string, unknown>
|
||||
id?: string
|
||||
showHiddenFields?: boolean
|
||||
depth?: number
|
||||
currentDepth?: number
|
||||
}
|
||||
|
||||
export default async function performFieldOperations(entityConfig: CollectionConfig | GlobalConfig, args: Arguments): Promise<{ [key: string]: unknown }> {
|
||||
@@ -35,7 +35,7 @@ export default async function performFieldOperations(entityConfig: CollectionCon
|
||||
},
|
||||
overrideAccess,
|
||||
reduceLocales,
|
||||
showHiddenFields,
|
||||
showHiddenFields = false,
|
||||
} = args;
|
||||
|
||||
const fallbackLocale = sanitizeFallbackLocale(req.fallbackLocale);
|
||||
|
||||
Reference in New Issue
Block a user