@@ -1689,14 +1689,14 @@ export interface ${formattedTableName}Table {
16891689 }
16901690
16911691 // Add relation foreign keys to the table interface
1692- for ( const relation of relations ) {
1693- const relationType = getRelationType ( relation . relationship )
1694- const relationCount = getRelationCount ( relation . relationship )
1692+ // for (const relation of relations) {
1693+ // const relationType = getRelationType(relation.relationship)
1694+ // const relationCount = getRelationCount(relation.relationship)
16951695
1696- if ( relationType === 'belongsType' && ! relationCount ) {
1697- typeString += ` ${ relation . modelKey } : number\n`
1698- }
1699- }
1696+ // if (relationType === 'belongsType' && !relationCount) {
1697+ // typeString += ` ${relation.modelKey}: number\n`
1698+ // }
1699+ // }
17001700
17011701 if ( useUuid ) {
17021702 typeString += ` uuid?: string\n`
@@ -1757,14 +1757,14 @@ export interface ${formattedTableName}Table {
17571757
17581758 if ( relationType === 'belongsType' && ! relationCount ) {
17591759 const relationName = camelCase ( relation . relationName || formattedModelRelation )
1760- modelTypeInterface += `
1761- ${ relationName } Belong: () => Promise< ${ modelRelation } Type> `
1760+ modelTypeInterface += ` get ${ snakeCase ( relationName ) } (): ${ modelRelation } ModelType | undefined
1761+ `
17621762 }
17631763
17641764 if ( relationType === 'belongsType' && relationCount === 'many' ) {
17651765 const relationName = relation . relationName || formattedModelName + plural ( pascalCase ( modelRelation ) )
1766- modelTypeInterface += `
1767- ${ relationName } : () => Promise< ${ modelRelation } Type[]> `
1766+ modelTypeInterface += ` get ${ snakeCase ( relationName ) } (): ${ modelRelation } ModelType[] | []
1767+ `
17681768 }
17691769 }
17701770
@@ -1890,13 +1890,13 @@ export interface ${formattedTableName}Table {
18901890 if ( relationType === 'belongsType' && ! relationCount ) {
18911891 const relationName = camelCase ( relation . relationName || formattedModelRelation )
18921892 modelTypeInterface += `
1893- ${ relationName } Belong: () => Promise<${ modelRelation } ModelType>`
1893+ ${ relationName } Belong: () => Promise<${ modelRelation } ModelType>`
18941894 }
18951895
18961896 if ( relationType === 'belongsType' && relationCount === 'many' ) {
18971897 const relationName = relation . relationName || formattedModelName + plural ( pascalCase ( modelRelation ) )
18981898 modelTypeInterface += `
1899- ${ relationName } : () => Promise<${ modelRelation } ModelType[]>`
1899+ ${ relationName } : () => Promise<${ modelRelation } ModelType[]>`
19001900 }
19011901 }
19021902
0 commit comments