feat: add superadmin assets and notifications

This commit is contained in:
2026-01-15 15:28:41 +08:00
parent c683fa5cf3
commit b896d0fa00
22 changed files with 4852 additions and 260 deletions

View File

@@ -18,6 +18,120 @@
"host": "localhost:8080",
"basePath": "/",
"paths": {
"/super/v1/assets": {
"get": {
"description": "List assets across tenants",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Asset"
],
"summary": "List assets",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperAssetItem"
}
}
}
}
]
}
}
}
}
},
"/super/v1/assets/usage": {
"get": {
"description": "Asset usage statistics",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Asset"
],
"summary": "Asset usage",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperAssetUsageResponse"
}
}
}
}
},
"/super/v1/assets/{id}": {
"delete": {
"description": "Delete asset",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Asset"
],
"summary": "Delete asset",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Asset ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "boolean",
"description": "Force delete",
"name": "force",
"in": "query"
}
],
"responses": {
"200": {
"description": "Deleted",
"schema": {
"type": "string"
}
}
}
}
},
"/super/v1/auth/login": {
"post": {
"description": "Login",
@@ -518,6 +632,162 @@
}
}
},
"/super/v1/notifications": {
"get": {
"description": "List notifications across tenants",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "List notifications",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperNotificationItem"
}
}
}
}
]
}
}
}
}
},
"/super/v1/notifications/broadcast": {
"post": {
"description": "Broadcast notification to users or tenant members",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Broadcast notification",
"parameters": [
{
"description": "Broadcast form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SuperNotificationBroadcastForm"
}
}
],
"responses": {
"200": {
"description": "Sent",
"schema": {
"type": "string"
}
}
}
}
},
"/super/v1/notifications/templates": {
"get": {
"description": "List notification templates",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "List notification templates",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperNotificationTemplateItem"
}
}
}
}
]
}
}
}
},
"post": {
"description": "Create notification template",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Notification"
],
"summary": "Create notification template",
"parameters": [
{
"description": "Template form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SuperNotificationTemplateCreateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperNotificationTemplateItem"
}
}
}
}
},
"/super/v1/orders": {
"get": {
"description": "List orders",
@@ -4970,6 +5240,62 @@
"GenderSecret"
]
},
"consts.MediaAssetStatus": {
"type": "string",
"enum": [
"uploaded",
"processing",
"ready",
"failed",
"deleted"
],
"x-enum-varnames": [
"MediaAssetStatusUploaded",
"MediaAssetStatusProcessing",
"MediaAssetStatusReady",
"MediaAssetStatusFailed",
"MediaAssetStatusDeleted"
]
},
"consts.MediaAssetType": {
"type": "string",
"enum": [
"video",
"audio",
"image"
],
"x-enum-varnames": [
"MediaAssetTypeVideo",
"MediaAssetTypeAudio",
"MediaAssetTypeImage"
]
},
"consts.MediaAssetVariant": {
"type": "string",
"enum": [
"main",
"preview"
],
"x-enum-varnames": [
"MediaAssetVariantMain",
"MediaAssetVariantPreview"
]
},
"consts.NotificationType": {
"type": "string",
"enum": [
"system",
"order",
"audit",
"interaction"
],
"x-enum-varnames": [
"NotificationTypeSystem",
"NotificationTypeOrder",
"NotificationTypeAudit",
"NotificationTypeInteraction"
]
},
"consts.OrderStatus": {
"type": "string",
"enum": [
@@ -6342,6 +6668,144 @@
}
}
},
"dto.SuperAssetItem": {
"type": "object",
"properties": {
"bucket": {
"description": "Bucket 存储桶名称。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 创建时间RFC3339。",
"type": "string"
},
"filename": {
"description": "Filename 原始文件名。",
"type": "string"
},
"hash": {
"description": "Hash 文件哈希MD5。",
"type": "string"
},
"id": {
"description": "ID 资产ID。",
"type": "integer"
},
"object_key": {
"description": "ObjectKey 对象Key。",
"type": "string"
},
"provider": {
"description": "Provider 存储提供方。",
"type": "string"
},
"size": {
"description": "Size 文件大小(字节)。",
"type": "integer"
},
"source_asset_id": {
"description": "SourceAssetID 源资产ID用于变体关联。",
"type": "integer"
},
"status": {
"description": "Status 处理状态。",
"allOf": [
{
"$ref": "#/definitions/consts.MediaAssetStatus"
}
]
},
"tenant_code": {
"description": "TenantCode 租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 租户名称。",
"type": "string"
},
"type": {
"description": "Type 媒体类型。",
"allOf": [
{
"$ref": "#/definitions/consts.MediaAssetType"
}
]
},
"updated_at": {
"description": "UpdatedAt 更新时间RFC3339。",
"type": "string"
},
"url": {
"description": "URL 访问URL若可用。",
"type": "string"
},
"used_count": {
"description": "UsedCount 被内容引用次数。",
"type": "integer"
},
"user_id": {
"description": "UserID 上传用户ID。",
"type": "integer"
},
"username": {
"description": "Username 上传用户名/昵称。",
"type": "string"
},
"variant": {
"description": "Variant 媒体变体main/preview/cover 等)。",
"allOf": [
{
"$ref": "#/definitions/consts.MediaAssetVariant"
}
]
}
}
},
"dto.SuperAssetUsageItem": {
"type": "object",
"properties": {
"count": {
"description": "Count 该类型资产数量。",
"type": "integer"
},
"total_size": {
"description": "TotalSize 该类型资产大小总和(字节)。",
"type": "integer"
},
"type": {
"description": "Type 媒体类型。",
"allOf": [
{
"$ref": "#/definitions/consts.MediaAssetType"
}
]
}
}
},
"dto.SuperAssetUsageResponse": {
"type": "object",
"properties": {
"by_type": {
"description": "ByType 按媒体类型汇总的用量统计。",
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperAssetUsageItem"
}
},
"total_count": {
"description": "TotalCount 资产总量。",
"type": "integer"
},
"total_size": {
"description": "TotalSize 资产总大小(字节)。",
"type": "integer"
}
}
},
"dto.SuperContentBatchReviewForm": {
"type": "object",
"required": [
@@ -6627,6 +7091,177 @@
}
}
},
"dto.SuperNotificationBroadcastForm": {
"type": "object",
"properties": {
"content": {
"description": "Content 通知内容。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID选填用于指定租户成员。",
"type": "integer"
},
"title": {
"description": "Title 通知标题。",
"type": "string"
},
"type": {
"description": "Type 通知类型system/order/audit/interaction。",
"allOf": [
{
"$ref": "#/definitions/consts.NotificationType"
}
]
},
"user_ids": {
"description": "UserIDs 指定接收用户ID列表优先级高于 TenantID。",
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dto.SuperNotificationItem": {
"type": "object",
"properties": {
"content": {
"description": "Content 通知内容。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 创建时间RFC3339。",
"type": "string"
},
"id": {
"description": "ID 通知ID。",
"type": "integer"
},
"is_read": {
"description": "IsRead 是否已读。",
"type": "boolean"
},
"tenant_code": {
"description": "TenantCode 租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 租户名称。",
"type": "string"
},
"title": {
"description": "Title 通知标题。",
"type": "string"
},
"type": {
"description": "Type 通知类型。",
"allOf": [
{
"$ref": "#/definitions/consts.NotificationType"
}
]
},
"user_id": {
"description": "UserID 用户ID。",
"type": "integer"
},
"username": {
"description": "Username 用户名/昵称。",
"type": "string"
}
}
},
"dto.SuperNotificationTemplateCreateForm": {
"type": "object",
"properties": {
"content": {
"description": "Content 通知内容。",
"type": "string"
},
"is_active": {
"description": "IsActive 是否启用(不传默认启用)。",
"type": "boolean"
},
"name": {
"description": "Name 模板名称(用于识别用途)。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID不传代表全平台模板。",
"type": "integer"
},
"title": {
"description": "Title 通知标题。",
"type": "string"
},
"type": {
"description": "Type 通知类型system/order/audit/interaction。",
"allOf": [
{
"$ref": "#/definitions/consts.NotificationType"
}
]
}
}
},
"dto.SuperNotificationTemplateItem": {
"type": "object",
"properties": {
"content": {
"description": "Content 模板内容。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 创建时间RFC3339。",
"type": "string"
},
"id": {
"description": "ID 模板ID。",
"type": "integer"
},
"is_active": {
"description": "IsActive 是否启用。",
"type": "boolean"
},
"name": {
"description": "Name 模板名称。",
"type": "string"
},
"tenant_code": {
"description": "TenantCode 租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 租户名称。",
"type": "string"
},
"title": {
"description": "Title 模板标题。",
"type": "string"
},
"type": {
"description": "Type 通知类型。",
"allOf": [
{
"$ref": "#/definitions/consts.NotificationType"
}
]
},
"updated_at": {
"description": "UpdatedAt 更新时间RFC3339。",
"type": "string"
}
}
},
"dto.SuperOrderDetail": {
"type": "object",
"properties": {