fix: readers and linting issues
Some checks failed
CI / Test (1.24) (push) Failing after -24m50s
CI / Test (1.25) (push) Failing after -24m42s
CI / Build (push) Successful in -25m49s
CI / Lint (push) Successful in -25m36s

This commit is contained in:
2025-12-19 22:28:24 +02:00
parent d9225a7310
commit aad5db5175
16 changed files with 1237 additions and 80 deletions

View File

@@ -520,9 +520,9 @@ func (w *Writer) generateInverseRelations(table *models.Table, schema *models.Sc
fieldName := w.pluralize(strings.ToLower(otherTable.Name))
inverseName := strings.ToLower(table.Name)
sb.WriteString(fmt.Sprintf(" @OneToMany(() => %s, %s => %s.%s)\n",
otherTable.Name, strings.ToLower(otherTable.Name), strings.ToLower(otherTable.Name), inverseName))
sb.WriteString(fmt.Sprintf(" %s: %s[];\n", fieldName, otherTable.Name))
fmt.Fprintf(sb, " @OneToMany(() => %s, %s => %s.%s)\n",
otherTable.Name, strings.ToLower(otherTable.Name), strings.ToLower(otherTable.Name), inverseName)
fmt.Fprintf(sb, " %s: %s[];\n", fieldName, otherTable.Name)
sb.WriteString("\n")
}
}
@@ -570,15 +570,15 @@ func (w *Writer) generateManyToManyRelations(table *models.Table, schema *models
inverseName := w.pluralize(strings.ToLower(table.Name))
if isOwner {
sb.WriteString(fmt.Sprintf(" @ManyToMany(() => %s, %s => %s.%s)\n",
otherTable, strings.ToLower(otherTable), strings.ToLower(otherTable), inverseName))
fmt.Fprintf(sb, " @ManyToMany(() => %s, %s => %s.%s)\n",
otherTable, strings.ToLower(otherTable), strings.ToLower(otherTable), inverseName)
sb.WriteString(" @JoinTable()\n")
} else {
sb.WriteString(fmt.Sprintf(" @ManyToMany(() => %s, %s => %s.%s)\n",
otherTable, strings.ToLower(otherTable), strings.ToLower(otherTable), inverseName))
fmt.Fprintf(sb, " @ManyToMany(() => %s, %s => %s.%s)\n",
otherTable, strings.ToLower(otherTable), strings.ToLower(otherTable), inverseName)
}
sb.WriteString(fmt.Sprintf(" %s: %s[];\n", fieldName, otherTable))
fmt.Fprintf(sb, " %s: %s[];\n", fieldName, otherTable)
sb.WriteString("\n")
}
}