diff --git a/svc/pkg/handler/milestone.go b/svc/pkg/handler/milestone.go index 02a532f..cc1e9f8 100644 --- a/svc/pkg/handler/milestone.go +++ b/svc/pkg/handler/milestone.go @@ -4,6 +4,7 @@ import ( "a-project-backend/gen/gModel" "a-project-backend/gen/gQuery" "a-project-backend/svc/pkg/domain/model/pkg_time" + "a-project-backend/svc/pkg/middleware" "io" "github.com/google/uuid" @@ -53,7 +54,7 @@ func (m MileStone) PostMileStone() gin.HandlerFunc { } target := gModel.Milestone{ MilestoneID: uuid.New().String(), - UserID: milestoneCreateRequest.Milestone.UserId, + UserID: c.Param(middleware.AuthorizedUserIDField), Title: milestoneCreateRequest.Milestone.Title, Content: milestoneCreateRequest.Milestone.Content, ImageHash: "", @@ -104,7 +105,10 @@ func (m MileStone) UpdateMileStone() gin.HandlerFunc { c.AbortWithStatusJSON(500, gin.H{"error": err.Error()}) } - _, err = m.q.Milestone.WithContext(c).Where(m.q.Milestone.MilestoneID.Eq(milestoneUpdateRequest.Milestone.MilestoneId)).Updates( + _, err = m.q.Milestone.WithContext(c). + Where(m.q.Milestone.MilestoneID.Eq(milestoneUpdateRequest.Milestone.MilestoneId), + m.q.Milestone.UserID.Eq(c.Param(middleware.AuthorizedUserIDField)), + ).Updates( map[string]interface{}{ "title": milestoneUpdateRequest.Milestone.Title, "content": milestoneUpdateRequest.Milestone.Content,