feat(calendar): 일정에 참여자(participants) — 그들 캘린더에도 표시
All checks were successful
build-and-push / build (push) Successful in 33s
All checks were successful
build-and-push / build (push) Successful in 33s
- CalendarEvent.Participants(JSON 이메일 배열), patch 시 JSON 변환 - 목록은 전 구성원 공유(이미) → 프론트가 소유자 OR 참여자로 필터/표시 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
317db37a04
commit
ed4ef537e6
@ -1,11 +1,13 @@
|
|||||||
package httpapi
|
package httpapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"spin/internal/models"
|
"spin/internal/models"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
"gorm.io/datatypes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 개인 캘린더 — 각자 본인 이벤트만 보고 관리(분류: 프로젝트/기타/개인 + 색).
|
// 개인 캘린더 — 각자 본인 이벤트만 보고 관리(분류: 프로젝트/기타/개인 + 색).
|
||||||
@ -47,6 +49,11 @@ func (s *Server) handlePatchEvent(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
delete(patch, "id")
|
delete(patch, "id")
|
||||||
delete(patch, "ownerEmail")
|
delete(patch, "ownerEmail")
|
||||||
|
if v, ok := patch["participants"]; ok {
|
||||||
|
if b, err := json.Marshal(v); err == nil {
|
||||||
|
patch["participants"] = datatypes.JSON(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
s.db.Model(&e).Updates(snakeKeys(patch))
|
s.db.Model(&e).Updates(snakeKeys(patch))
|
||||||
s.db.First(&e, "id = ?", e.ID)
|
s.db.First(&e, "id = ?", e.ID)
|
||||||
writeJSON(w, http.StatusOK, e)
|
writeJSON(w, http.StatusOK, e)
|
||||||
|
|||||||
@ -185,6 +185,7 @@ type CalendarEvent struct {
|
|||||||
End string `json:"end"` // YYYY-MM-DD (빈값=하루)
|
End string `json:"end"` // YYYY-MM-DD (빈값=하루)
|
||||||
AllDay bool `json:"allDay"`
|
AllDay bool `json:"allDay"`
|
||||||
Memo string `json:"memo"`
|
Memo string `json:"memo"`
|
||||||
|
Participants datatypes.JSONSlice[string] `json:"participants"` // 참여자 이메일 — 그들 캘린더에도 표시
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user