File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
packages/server/src/api/rest Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,7 @@ class RequestHandler extends APIHandlerBase {
848
848
return error ;
849
849
}
850
850
851
+ const matchFields = ( requestBody as any ) . meta . matchFields ;
851
852
const uniqueFields = Object . values ( modelMeta . models [ type ] . uniqueConstraints || { } ) . map ( ( uf ) => uf . fields ) ;
852
853
853
854
if (
@@ -856,14 +857,12 @@ class RequestHandler extends APIHandlerBase {
856
857
return this . makeError ( 'invalidPayload' , 'Match fields must be unique fields' , 400 ) ;
857
858
}
858
859
859
- const matchFields = ( requestBody as any ) . meta . matchFields ;
860
-
861
- const upsertPayload : any = { } ;
862
- upsertPayload . where = this . makeUpsertWhere ( matchFields , attributes , typeInfo ) ;
863
-
864
- upsertPayload . create = { ...attributes } ;
865
- upsertPayload . update = {
866
- ...Object . fromEntries ( Object . entries ( attributes ) . filter ( ( e ) => ! matchFields . includes ( e [ 0 ] ) ) ) ,
860
+ const upsertPayload : any = {
861
+ where : this . makeUpsertWhere ( matchFields , attributes , typeInfo ) ,
862
+ create : { ...attributes } ,
863
+ update : {
864
+ ...Object . fromEntries ( Object . entries ( attributes ) . filter ( ( e ) => ! matchFields . includes ( e [ 0 ] ) ) ) ,
865
+ } ,
867
866
} ;
868
867
869
868
if ( relationships ) {
You can’t perform that action at this time.
0 commit comments