Skip to content

Commit 2ba4a18

Browse files
committed
chore: reuse relationTypeByIds
1 parent a5ea005 commit 2ba4a18

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/server/templates/typescript.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,8 @@ export const apply = async ({
171171

172172
if (tablesNamesByTableId[relationId]) return tablesNamesByTableId[relationId]
173173
// if it's a composite type we use the type name as relation name to allow sub-selecting fields of the composite type
174-
if (returnTypeId && typesById[returnTypeId] && typesById[returnTypeId].attributes.length > 0)
175-
return typesById[returnTypeId].name
176-
return null
174+
const reltype = returnTypeId ? relationTypeByIds.get(returnTypeId) : null
175+
return reltype ? reltype.name : null
177176
}
178177

179178
for (const func of functions) {

0 commit comments

Comments
 (0)