Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fixed validators (#10543)
Browse files Browse the repository at this point in the history
  • Loading branch information
MoizAdnan authored Aug 16, 2024
1 parent 09a2269 commit 97044a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/common/src/schemas/media/file-browser.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export const fileBrowserPatchSchema = Type.Intersect(
project: Type.String(),
body: Type.Any(), // Buffer | string
contentType: Type.Optional(Type.String()),
storageProviderName: Type.Optional(Type.String())
storageProviderName: Type.Optional(Type.String()),
fileName: Type.Optional(Type.String())
})
],
{
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/schemas/media/invalidation.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const invalidationSchema = Type.Object(
export interface InvalidationType extends Static<typeof invalidationSchema> {}

// Schema for creating new entries
export const invalidationDataSchema = Type.Partial(invalidationSchema, { $id: 'InvalidationData' })
export const invalidationDataSchema = Type.Pick(invalidationSchema, ['path'], { $id: 'InvalidationData' })
export interface InvalidationData extends Static<typeof invalidationDataSchema> {}

// Schema for allowed query properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export default {
return context
}
],
update: [() => schemaHooks.validateData(fileBrowserUpdateValidator)],
update: [schemaHooks.validateData(fileBrowserUpdateValidator)],
patch: [
(context) => {
context[SYNC] = false
return context
},
() => schemaHooks.validateData(fileBrowserPatchValidator)
schemaHooks.validateData(fileBrowserPatchValidator)
],
remove: []
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,12 @@ export default {
before: {
all: [
disallow('external'),
() => schemaHooks.validateQuery(invalidationQueryValidator),
schemaHooks.validateQuery(invalidationQueryValidator),
schemaHooks.resolveQuery(invalidationQueryResolver)
],
find: [],
get: [],
create: [
() => schemaHooks.validateData(invalidationDataValidator),
schemaHooks.resolveData(invalidationDataResolver)
],
create: [schemaHooks.validateData(invalidationDataValidator), schemaHooks.resolveData(invalidationDataResolver)],
update: [disallow()],
patch: [disallow()],
remove: []
Expand Down

0 comments on commit 97044a8

Please sign in to comment.