File tree Expand file tree Collapse file tree 2 files changed +14
-38
lines changed Expand file tree Collapse file tree 2 files changed +14
-38
lines changed Original file line number Diff line number Diff line change @@ -1042,43 +1042,19 @@ class RequestHandler {
1042
1042
{
1043
1043
relatedName : field ,
1044
1044
linkers : {
1045
- related : new Linker ( ( primary , related ) =>
1046
- ! related || Array . isArray ( related )
1047
- ? this . makeLinkUrl (
1048
- `/${ lowerCaseFirst ( model ) } /${ this . getId (
1049
- model ,
1050
- primary ,
1051
- modelMeta
1052
- ) } /${ field } `
1053
- )
1054
- : this . makeLinkUrl (
1055
- `/${ lowerCaseFirst ( model ) } /${ this . getId (
1056
- model ,
1057
- primary ,
1058
- modelMeta
1059
- ) } /${ field } /${ this . getId ( fieldMeta . type , related , modelMeta ) } `
1060
- )
1045
+ related : new Linker ( ( primary ) =>
1046
+ this . makeLinkUrl (
1047
+ `/${ lowerCaseFirst ( model ) } /${ this . getId ( model , primary , modelMeta ) } /${ field } `
1048
+ )
1061
1049
) ,
1062
- relationship : new Linker ( ( primary , related ) =>
1063
- ! related || Array . isArray ( related )
1064
- ? this . makeLinkUrl (
1065
- `/${ lowerCaseFirst ( model ) } /${ this . getId (
1066
- model ,
1067
- primary ,
1068
- modelMeta
1069
- ) } /relationships/${ field } `
1070
- )
1071
- : this . makeLinkUrl (
1072
- `/${ lowerCaseFirst ( model ) } /${ this . getId (
1073
- model ,
1074
- primary ,
1075
- modelMeta
1076
- ) } /relationships/${ field } /${ this . getId (
1077
- fieldMeta . type ,
1078
- related ,
1079
- modelMeta
1080
- ) } `
1081
- )
1050
+ relationship : new Linker ( ( primary ) =>
1051
+ this . makeLinkUrl (
1052
+ `/${ lowerCaseFirst ( model ) } /${ this . getId (
1053
+ model ,
1054
+ primary ,
1055
+ modelMeta
1056
+ ) } /relationships/${ field } `
1057
+ )
1082
1058
) ,
1083
1059
} ,
1084
1060
}
Original file line number Diff line number Diff line change @@ -1386,8 +1386,8 @@ describe('REST server tests - regular prisma', () => {
1386
1386
relationships : {
1387
1387
author : {
1388
1388
links : {
1389
- self : 'http://localhost/api/post/1/relationships/author/user1 ' ,
1390
- related : 'http://localhost/api/post/1/author/user1 ' ,
1389
+ self : 'http://localhost/api/post/1/relationships/author' ,
1390
+ related : 'http://localhost/api/post/1/author' ,
1391
1391
} ,
1392
1392
data : { type : 'user' , id : 'user1' } ,
1393
1393
} ,
You can’t perform that action at this time.
0 commit comments