Skip to content

Commit

Permalink
Merge pull request #85 from saitamau-maximum/development
Browse files Browse the repository at this point in the history
Release: v1.4.1
  • Loading branch information
sor4chi authored Oct 31, 2023
2 parents 7fdb036 + 0e075bf commit 7e3047e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Handler struct {
type Post struct {
ID string `db:"id" json:"id"`
Body string `db:"body" json:"body"`
CreatedAt string `db:"created_at" json:"created_at"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}

var (
Expand Down Expand Up @@ -133,7 +133,7 @@ func sendPostWebhookDiscord(post *Post) error {
Name: "匿名のユーザー",
Icon: DISCORD_AVATAR_URL,
},
TimeStamp: post.CreatedAt,
TimeStamp: post.CreatedAt.String(),
},
},
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func (h *Handler) CreatePost(c echo.Context) error {
return c.JSON(500, err)
}
post.ID = id.String()
post.CreatedAt = time.Now().Format("2006-01-02 15:04:05")
post.CreatedAt = time.Now()

_, err = h.DB.Exec("INSERT INTO posts (id, body, created_at) VALUES (?, ?, ?)", post.ID, post.Body, post.CreatedAt)
if err != nil {
Expand Down

0 comments on commit 7e3047e

Please sign in to comment.