changing field names

This commit is contained in:
2025-12-10 17:30:40 +00:00
parent 78a86b176f
commit d39d5c23c4
2 changed files with 19 additions and 17 deletions

View File

@@ -1,17 +1,18 @@
package models
import (
"database/sql"
"time"
"gorm.io/gorm"
)
type Post struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt sql.NullTime `gorm:"index" json:"deletedAt"`
Title string `gorm:"not null" json:"title"`
AuthorID uint `json:"-"`
Author *User `gorm:"foreignKey:AuthorID" json:"author"`
Content string `json:"content"`
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
Title string `gorm:"not null" json:"title"`
AuthorID uint `json:"-"`
Author *User `gorm:"foreignKey:AuthorID" json:"author"`
Content string `json:"content"`
}

View File

@@ -1,16 +1,17 @@
package models
import (
"database/sql"
"time"
"gorm.io/gorm"
)
type User struct {
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt sql.NullTime `gorm:"index" json:"deletedAt"`
Username string `gorm:"uniqueIndex" json:"username"`
Password []byte `json:"-"`
Admin bool `json:"admin"`
ID uint `gorm:"primarykey" json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"`
Username string `gorm:"uniqueIndex" json:"username"`
Password []byte `json:"-"`
Admin bool `json:"admin"`
}