Reorganization of backend + new routes
This commit is contained in:
24
backend/core/models/blogs.go
Normal file
24
backend/core/models/blogs.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type Blog struct {
|
||||
bun.BaseModel `bun:"table:blogs"`
|
||||
|
||||
BlogID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()" json:"blogID"`
|
||||
Slug string `bun:"slug,unique,notnull" json:"slug"`
|
||||
Content string `bun:"content,notnull" json:"content"`
|
||||
Label string `bun:"label" json:"label"`
|
||||
AuthorID uuid.UUID `bun:"author_id,type:uuid,notnull" json:"authorID"`
|
||||
Published time.Time `bun:"published,default:current_timestamp" json:"published"`
|
||||
Summary string `bun:"summary" json:"summary"`
|
||||
Image string `bun:"image" json:"image"`
|
||||
Href string `bun:"href" json:"href"`
|
||||
|
||||
Author User `bun:"rel:belongs-to,join:author_id=user_id" json:"author"`
|
||||
}
|
||||
Reference in New Issue
Block a user