diff options
| -rw-r--r-- | models/models.go | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/models/models.go b/models/models.go index 1ccf37f..355851a 100644 --- a/models/models.go +++ b/models/models.go @@ -1,14 +1,5 @@ package models - -type User struct { - ID uint `gorm:"primaryKey" json:"id"` - Username string `gorm:"unique;not null" json:"username"` - Password string `gorm:"not null" json:"-"` - Blogs []Blog `gorm:"foreignKey:UserID" json:"blogs"` - Comments []Comment `gorm:"foreignKey:UserID" json:"comments"` -} - type Blog struct { ID uint `gorm:"primaryKey" json:"id"` Title string `gorm:"not null" json:"title"` @@ -18,13 +9,3 @@ type Blog struct { Comments []Comment `gorm:"foreignKey:BlogID" json:"comments"` } -type Comment struct { - ID uint `gorm:"primaryKey" json:"id"` - Content string `gorm:"not null" json:"content"` - UserID uint `gorm:"not null" json:"user_id"` - BlogID uint `gorm:"not null" json:"blog_id"` - User User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"user"` - Blog Blog `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"blog"` -} - - |
