Skip to content

Commit

Permalink
fix(server): update updated_at field
Browse files Browse the repository at this point in the history
  • Loading branch information
lareii committed Sep 2, 2024
1 parent 373cb6b commit f27eee4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/handlers/posts/update_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func UpdatePost(c *fiber.Ctx) error {
}

update := bson.M{
"$set": bson.M{"updated_at": primitive.Timestamp{T: uint32(time.Now().Unix())}},
"$set": bson.M{},
}

if body.Content != "" {
Expand All @@ -56,6 +56,7 @@ func UpdatePost(c *fiber.Ctx) error {
}

update["$set"] = bson.M{"content": body.Content}
update["$set"] = bson.M{"updated_at": primitive.Timestamp{T: uint32(time.Now().Unix())}}
}

if body.Like != nil {
Expand Down

0 comments on commit f27eee4

Please sign in to comment.