added a 404 to bad blog posts
This commit is contained in:
@@ -26,5 +26,5 @@ type BlogPost struct {
|
||||
Title string `json:"title" gorm:"unique"`
|
||||
Date string `json:"date"`
|
||||
Content string `json:"content"`
|
||||
Comments []Comment `gorm:"foreignKey:Id"`
|
||||
Comments []Comment `gorm:"foreignKey:AssociatedPost"`
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ import (
|
||||
|
||||
type Comment struct {
|
||||
gorm.Model
|
||||
Id uint `json:"id"`
|
||||
Date string `json:"date"`
|
||||
Author string `json:"author"`
|
||||
Content string `json:"content"`
|
||||
Id uint `json:"id" gorm: "primaryKey" gorm: "unique"`
|
||||
Date string `json:"date"`
|
||||
Author string `json:"author" form:"author"`
|
||||
Content string `json:"content" form:"content"`
|
||||
AssociatedPost string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user