File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/runtime/src/client Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,19 @@ export function hasModel(schema: SchemaDef, model: string) {
1414}
1515
1616export function getModel ( schema : SchemaDef , model : string ) {
17- return schema . models [ model ] ;
17+ return Object . values ( schema . models ) . find ( ( m ) => m . name . toLowerCase ( ) === model . toLowerCase ( ) ) ;
1818}
1919
2020export function getTypeDef ( schema : SchemaDef , type : string ) {
2121 return schema . typeDefs ?. [ type ] ;
2222}
2323
2424export function requireModel ( schema : SchemaDef , model : string ) {
25- const matchedName = Object . keys ( schema . models ) . find ( ( k ) => k . toLowerCase ( ) === model . toLowerCase ( ) ) ;
26- if ( ! matchedName ) {
25+ const modelDef = getModel ( schema , model ) ;
26+ if ( ! modelDef ) {
2727 throw new QueryError ( `Model "${ model } " not found in schema` ) ;
2828 }
29- return schema . models [ matchedName ] ! ;
29+ return modelDef ;
3030}
3131
3232export function getField ( schema : SchemaDef , model : string , field : string ) {
You can’t perform that action at this time.
0 commit comments