Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abaldeweg authored Oct 26, 2024
1 parent 78732a4 commit 2dae5e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 5 additions & 0 deletions gateway/core/models/author.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ type Author struct {
func (a *Author) Validate(v *validator.Validate) error {
return v.Struct(a)
}

// TableName specifies the table name for the Author model in the database.
func (Author) TableName() string {
return "authors"
}
5 changes: 1 addition & 4 deletions gateway/core/repository/author.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ type AuthorRepository struct {
db *gorm.DB
}

// TableName overrides the table name used by Author to `authors`
func (r *AuthorRepository) TableName() string {
return "author"
}


// NewAuthorRepository creates a new author repository.
func NewAuthorRepository(db *gorm.DB) *AuthorRepository {
Expand Down

0 comments on commit 2dae5e8

Please sign in to comment.