File tree Expand file tree Collapse file tree 3 files changed +64
-8
lines changed Expand file tree Collapse file tree 3 files changed +64
-8
lines changed Original file line number Diff line number Diff line change @@ -57,9 +57,23 @@ export const ListView: React.FC<AdminViewProps> = async ({
57
57
req,
58
58
user,
59
59
where : {
60
- key : {
61
- equals : preferenceKey ,
62
- } ,
60
+ and : [
61
+ {
62
+ key : {
63
+ equals : preferenceKey ,
64
+ } ,
65
+ } ,
66
+ {
67
+ 'user.relationTo' : {
68
+ equals : user . collection ,
69
+ } ,
70
+ } ,
71
+ {
72
+ 'user.value' : {
73
+ equals : user ?. id ,
74
+ } ,
75
+ } ,
76
+ ] ,
63
77
} ,
64
78
} )
65
79
?. then ( ( res ) => res ?. docs ?. [ 0 ] ?. value ) ) as ListPreferences
Original file line number Diff line number Diff line change @@ -115,9 +115,23 @@ export const buildFormState = async ({ req }: { req: PayloadRequest }): Promise<
115
115
depth : 0 ,
116
116
limit : 1 ,
117
117
where : {
118
- key : {
119
- equals : preferencesKey ,
120
- } ,
118
+ and : [
119
+ {
120
+ key : {
121
+ equals : preferencesKey ,
122
+ } ,
123
+ } ,
124
+ {
125
+ 'user.relationTo' : {
126
+ equals : req . user . collection ,
127
+ } ,
128
+ } ,
129
+ {
130
+ 'user.value' : {
131
+ equals : req . user . id ,
132
+ } ,
133
+ } ,
134
+ ] ,
121
135
} ,
122
136
} ) ) as unknown as { docs : { value : DocumentPreferences } [ ] }
123
137
Original file line number Diff line number Diff line change @@ -367,7 +367,21 @@ describe('Auth', () => {
367
367
collection : 'payload-preferences' ,
368
368
depth : 0 ,
369
369
where : {
370
- key : { equals : key } ,
370
+ and : [
371
+ {
372
+ key : { equals : key } ,
373
+ } ,
374
+ {
375
+ 'user.relationTo' : {
376
+ equals : 'users' ,
377
+ } ,
378
+ } ,
379
+ {
380
+ 'user.value' : {
381
+ equals : loggedInUser . id ,
382
+ } ,
383
+ } ,
384
+ ] ,
371
385
} ,
372
386
} )
373
387
@@ -390,7 +404,21 @@ describe('Auth', () => {
390
404
collection : 'payload-preferences' ,
391
405
depth : 0 ,
392
406
where : {
393
- key : { equals : key } ,
407
+ and : [
408
+ {
409
+ key : { equals : key } ,
410
+ } ,
411
+ {
412
+ 'user.relationTo' : {
413
+ equals : 'users' ,
414
+ } ,
415
+ } ,
416
+ {
417
+ 'user.value' : {
418
+ equals : loggedInUser . id ,
419
+ } ,
420
+ } ,
421
+ ] ,
394
422
} ,
395
423
} )
396
424
You can’t perform that action at this time.
0 commit comments