Skip to content

Commit e0bc54d

Browse files
committed
updated
1 parent 421054b commit e0bc54d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

models/post.model.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package models
2+
3+
import (
4+
"time"
5+
6+
"github.com/google/uuid"
7+
)
8+
9+
type Post struct {
10+
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
11+
Title string ``
12+
Content string ``
13+
Image string ``
14+
User string ``
15+
CreateAt time.Time ``
16+
UpdatedAt time.Time ``
17+
}
18+
19+
type CreatePostRequest struct {
20+
Title string `json:"title" bson:"title" binding:"required"`
21+
Content string `json:"content" bson:"content" binding:"required"`
22+
Image string `json:"image,omitempty" bson:"image,omitempty"`
23+
User string `json:"user" bson:"user" binding:"required"`
24+
CreateAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
25+
UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
26+
}
27+
28+
type UpdatePost struct {
29+
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key"`
30+
Title string `json:"title,omitempty" bson:"title,omitempty"`
31+
Content string `json:"content,omitempty" bson:"content,omitempty"`
32+
Image string `json:"image,omitempty" bson:"image,omitempty"`
33+
User string `json:"user,omitempty" bson:"user,omitempty"`
34+
CreateAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"`
35+
UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
36+
}

0 commit comments

Comments
 (0)