added comments and added a comment end point

This commit is contained in:
rawleyIfowler
2022-02-25 17:59:48 -06:00
parent 979ef41aec
commit 598f372acd
4 changed files with 37 additions and 13 deletions

View File

@@ -22,9 +22,9 @@ import (
type BlogPost struct {
gorm.Model
Url string `json:"url" gorm:"primaryKey" gorm:"unique"`
Url string `json:"url" gorm:"primaryKey"`
Title string `json:"title" gorm:"unique"`
Date string `json:"date"`
Date string `json:"date" gorm:"default:NOW()"`
Content string `json:"content"`
Comments []Comment `gorm:"foreignKey:AssociatedPost"`
Comments []Comment `gorm:"foreignKey:AssociatedPost;references:Url;type:varchar(191)"`
}