From ed4ef537e6b94077dbd0d8ccff52a578d8db0e65 Mon Sep 17 00:00:00 2001 From: theorose49 Date: Tue, 30 Jun 2026 16:32:02 +0900 Subject: [PATCH] =?UTF-8?q?feat(calendar):=20=EC=9D=BC=EC=A0=95=EC=97=90?= =?UTF-8?q?=20=EC=B0=B8=EC=97=AC=EC=9E=90(participants)=20=E2=80=94=20?= =?UTF-8?q?=EA=B7=B8=EB=93=A4=20=EC=BA=98=EB=A6=B0=EB=8D=94=EC=97=90?= =?UTF-8?q?=EB=8F=84=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CalendarEvent.Participants(JSON 이메일 배열), patch 시 JSON 변환 - 목록은 전 구성원 공유(이미) → 프론트가 소유자 OR 참여자로 필터/표시 Co-Authored-By: Claude Opus 4.8 (1M context) --- internal/httpapi/handlers_calendar.go | 7 +++++++ internal/models/project.go | 23 ++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/internal/httpapi/handlers_calendar.go b/internal/httpapi/handlers_calendar.go index 91b38fe..ec8e72e 100644 --- a/internal/httpapi/handlers_calendar.go +++ b/internal/httpapi/handlers_calendar.go @@ -1,11 +1,13 @@ package httpapi import ( + "encoding/json" "net/http" "spin/internal/models" "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, "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.First(&e, "id = ?", e.ID) writeJSON(w, http.StatusOK, e) diff --git a/internal/models/project.go b/internal/models/project.go index 19b8701..dd832c7 100644 --- a/internal/models/project.go +++ b/internal/models/project.go @@ -176,17 +176,18 @@ type ProjectMailState struct { // with a color. Owned by one member. type CalendarEvent struct { Base - OwnerEmail string `gorm:"index" json:"ownerEmail"` - Title string `json:"title"` - Category string `json:"category"` // project | etc | personal (분류 키) - ProjectID string `json:"projectId"` // category=project일 때 연결 - Color string `json:"color"` // 표시 색 - Start string `json:"start"` // YYYY-MM-DD - End string `json:"end"` // YYYY-MM-DD (빈값=하루) - AllDay bool `json:"allDay"` - Memo string `json:"memo"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` + OwnerEmail string `gorm:"index" json:"ownerEmail"` + Title string `json:"title"` + Category string `json:"category"` // project | etc | personal (분류 키) + ProjectID string `json:"projectId"` // category=project일 때 연결 + Color string `json:"color"` // 표시 색 + Start string `json:"start"` // YYYY-MM-DD + End string `json:"end"` // YYYY-MM-DD (빈값=하루) + AllDay bool `json:"allDay"` + Memo string `json:"memo"` + Participants datatypes.JSONSlice[string] `json:"participants"` // 참여자 이메일 — 그들 캘린더에도 표시 + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` } func (m *CalendarEvent) BeforeCreate(*gorm.DB) error { m.ensureID(); return nil }