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

Commit

Permalink
IR-2915: Re-evaluate feathers validator usage for recording services (#…
Browse files Browse the repository at this point in the history
…10545)

* Fixed validators

* chore: add createdAt to recordingQueryProperties
  • Loading branch information
MoizAdnan authored Aug 16, 2024
1 parent 85aaea5 commit 09a2269
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/common/src/schemas/recording/recording.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface RecordingDatabaseType extends Omit<RecordingType, 'schema'> {
}

// Schema for creating new entries
export const recordingDataSchema = Type.Partial(recordingSchema, {
export const recordingDataSchema = Type.Pick(recordingSchema, ['schema'], {
$id: 'RecordingData'
})
export interface RecordingData extends Static<typeof recordingDataSchema> {}
Expand All @@ -81,7 +81,7 @@ export const recordingPatchSchema = Type.Partial(recordingSchema, {
export interface RecordingPatch extends Static<typeof recordingPatchSchema> {}

// Schema for allowed query properties
export const recordingQueryProperties = Type.Pick(recordingSchema, ['id', 'userId'])
export const recordingQueryProperties = Type.Pick(recordingSchema, ['id', 'userId', 'createdAt'])
export const recordingQuerySchema = Type.Intersect(
[
querySyntax(recordingQueryProperties),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ export default {

before: {
all: [
() => schemaHooks.validateQuery(recordingResourceQueryValidator),
schemaHooks.validateQuery(recordingResourceQueryValidator),
schemaHooks.resolveQuery(recordingResourceQueryResolver)
],
find: [iff(isProvider('external'), verifyScope('recording', 'read'))],
get: [iff(isProvider('external'), verifyScope('recording', 'read'))],
create: [
iff(isProvider('external'), verifyScope('recording', 'write'), verifyScope('settings', 'write')),
() => schemaHooks.validateData(recordingResourceDataValidator),
schemaHooks.validateData(recordingResourceDataValidator),
schemaHooks.resolveData(recordingResourceDataResolver)
],
update: [disallow()],
patch: [
iff(isProvider('external'), verifyScope('recording', 'write')),
() => schemaHooks.validateData(recordingResourcePatchValidator),
schemaHooks.validateData(recordingResourcePatchValidator),
schemaHooks.resolveData(recordingResourcePatchResolver)
],
remove: [iff(isProvider('external'), verifyScope('recording', 'write'))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
},

before: {
all: [() => schemaHooks.validateQuery(recordingQueryValidator), schemaHooks.resolveQuery(recordingQueryResolver)],
all: [schemaHooks.validateQuery(recordingQueryValidator), schemaHooks.resolveQuery(recordingQueryResolver)],
find: [
iff(
isProvider('external'),
Expand All @@ -100,13 +100,13 @@ export default {
create: [
iff(isProvider('external'), verifyScope('recording', 'write')),
setLoggedinUserInBody('userId'),
() => schemaHooks.validateData(recordingDataValidator),
schemaHooks.validateData(recordingDataValidator),
schemaHooks.resolveData(recordingDataResolver)
],
update: [disallow()],
patch: [
iff(isProvider('external'), verifyScope('recording', 'write')),
() => schemaHooks.validateData(recordingPatchValidator),
schemaHooks.validateData(recordingPatchValidator),
schemaHooks.resolveData(recordingPatchResolver)
],
remove: [iff(isProvider('external'), verifyScope('recording', 'write')), ensureRecording]
Expand Down

0 comments on commit 09a2269

Please sign in to comment.