feat: 添加通知微服务,支持站内通知已读状态

This commit is contained in:
zetaloop
2026-04-24 12:44:59 +08:00
parent 95f2f10f9f
commit b557bfcc2e
52 changed files with 7035 additions and 30 deletions
+31 -30
View File
@@ -1,40 +1,41 @@
syntax = "v1"
import "common.api"
type (
PathId {
Id int64 `path:"id"`
}
Notification {
Id int64 `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
Read bool `json:"read"`
Link string `json:"link,optional"`
CreatedAt string `json:"createdAt"`
}
NotificationListResp {
Items []Notification `json:"items"`
Meta PageMeta `json:"meta"`
}
PathId {
Id int64 `path:"id"`
}
Notification {
Id int64 `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
Read bool `json:"read"`
Link string `json:"link,optional"`
CreatedAt string `json:"createdAt"`
}
NotificationListResp {
Items []Notification `json:"items"`
Meta PageMeta `json:"meta"`
}
)
@server(
prefix: api/v1
group: notification
@server (
prefix: api/v1
group: notification
)
service notifi-api {
@doc "获取通知列表"
@handler ListNotifications
get /notifications (PageReq) returns (NotificationListResp)
@doc "获取通知列表"
@handler ListNotifications
get /notifications (PageReq) returns (NotificationListResp)
@doc "标记已读"
@handler ReadNotification
put /notifications/:id/read (PathId) returns (EmptyResp)
@doc "标记已读"
@handler ReadNotification
put /notifications/:id/read (PathId) returns (EmptyResp)
@doc "全部已读"
@handler ReadAllNotifications
put /notifications/read-all (EmptyResp) returns (EmptyResp)
}
@doc "全部已读"
@handler ReadAllNotifications
put /notifications/read-all (EmptyResp) returns (EmptyResp)
}