73 lines
2.3 KiB
Go
73 lines
2.3 KiB
Go
package v1
|
|
|
|
import (
|
|
dto "quyun/v2/app/http/super/v1/dto"
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/app/services"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type notifications struct{}
|
|
|
|
// List notifications
|
|
//
|
|
// @Router /super/v1/notifications [get]
|
|
// @Summary List notifications
|
|
// @Description List notifications across tenants
|
|
// @Tags Notification
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param page query int false "Page number"
|
|
// @Param limit query int false "Page size"
|
|
// @Success 200 {object} requests.Pager{items=[]dto.SuperNotificationItem}
|
|
// @Bind filter query
|
|
func (c *notifications) List(ctx fiber.Ctx, filter *dto.SuperNotificationListFilter) (*requests.Pager, error) {
|
|
return services.Super.ListNotifications(ctx, filter)
|
|
}
|
|
|
|
// Broadcast notification
|
|
//
|
|
// @Router /super/v1/notifications/broadcast [post]
|
|
// @Summary Broadcast notification
|
|
// @Description Broadcast notification to users or tenant members
|
|
// @Tags Notification
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param form body dto.SuperNotificationBroadcastForm true "Broadcast form"
|
|
// @Success 200 {string} string "Sent"
|
|
// @Bind form body
|
|
func (c *notifications) Broadcast(ctx fiber.Ctx, form *dto.SuperNotificationBroadcastForm) error {
|
|
return services.Super.BroadcastNotifications(ctx, form)
|
|
}
|
|
|
|
// List notification templates
|
|
//
|
|
// @Router /super/v1/notifications/templates [get]
|
|
// @Summary List notification templates
|
|
// @Description List notification templates
|
|
// @Tags Notification
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Success 200 {object} requests.Pager{items=[]dto.SuperNotificationTemplateItem}
|
|
// @Bind filter query
|
|
func (c *notifications) ListTemplates(ctx fiber.Ctx, filter *dto.SuperNotificationTemplateListFilter) (*requests.Pager, error) {
|
|
return services.Super.ListNotificationTemplates(ctx, filter)
|
|
}
|
|
|
|
// Create notification template
|
|
//
|
|
// @Router /super/v1/notifications/templates [post]
|
|
// @Summary Create notification template
|
|
// @Description Create notification template
|
|
// @Tags Notification
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param form body dto.SuperNotificationTemplateCreateForm true "Template form"
|
|
// @Success 200 {object} dto.SuperNotificationTemplateItem
|
|
// @Bind form body
|
|
func (c *notifications) CreateTemplate(ctx fiber.Ctx, form *dto.SuperNotificationTemplateCreateForm) (*dto.SuperNotificationTemplateItem, error) {
|
|
return services.Super.CreateNotificationTemplate(ctx, form)
|
|
}
|