Chever John 9c39c8cbd7
init: iloom WMS monorepo with K8s deployment manifests
Go workspace (go.work) with 5 microservices + shared library:
- gateway (8080), auth-service (8081), purchaser-service (8082)
- textile-service (8083), washing-service (8084)
- shared: proto definitions, common packages

Infrastructure: docker-compose for local dev, K8s manifests for
K3s cluster deployment (mysql/redis/etcd + traefik ingress).

Frontend (iloom-flatten) added as git submodule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-14 11:33:31 +08:00

48 lines
1.1 KiB
Go

package handler
import (
"github.com/gin-gonic/gin"
"github.com/muyuqingfeng/iloom/auth-service/internal/service"
"github.com/muyuqingfeng/iloom/shared/pkg/response"
)
type NotificationHandler struct {
svc *service.NotificationService
}
func NewNotificationHandler(svc *service.NotificationService) *NotificationHandler {
return &NotificationHandler{svc: svc}
}
func (h *NotificationHandler) List(c *gin.Context) {
userID := c.GetHeader("X-User-ID")
if userID == "" {
response.BadRequest(c, "user id not found")
return
}
notifications, err := h.svc.List(c.Request.Context(), userID)
if err != nil {
response.InternalError(c, err.Error())
return
}
response.OK(c, notifications)
}
func (h *NotificationHandler) MarkRead(c *gin.Context) {
id := c.Param("id")
userID := c.GetHeader("X-User-ID")
if userID == "" {
response.BadRequest(c, "user id not found")
return
}
if err := h.svc.MarkRead(c.Request.Context(), id, userID); err != nil {
response.InternalError(c, err.Error())
return
}
response.OK(c, gin.H{"message": "marked as read"})
}