thread-master/apps/backend/generate/api/invite.api

111 lines
3.3 KiB
Plaintext

syntax = "v1"
// M6 邀請網絡:會員補填碼 + admin 樹/移動(防環)
type (
InviteMemberBrief {
Uid int64 `json:"uid"`
Email string `json:"email"`
DisplayName string `json:"display_name"`
InviteCode string `json:"invite_code"`
ParentUid int64 `json:"parent_uid,optional"` // 0 = 無上線
Roles []string `json:"roles"`
Status string `json:"status"`
DownlineCount int `json:"downline_count"`
TotalDownlineCount int `json:"total_downline_count"`
Depth int `json:"depth"`
JoinedAt int64 `json:"joined_at"`
AvatarUrl string `json:"avatar_url,optional"`
}
InviteTreeNode {
Uid int64 `json:"uid"`
Email string `json:"email"`
DisplayName string `json:"display_name"`
InviteCode string `json:"invite_code"`
ParentUid int64 `json:"parent_uid,optional"`
Roles []string `json:"roles"`
Status string `json:"status"`
DownlineCount int `json:"downline_count"`
TotalDownlineCount int `json:"total_downline_count"`
Depth int `json:"depth"`
JoinedAt int64 `json:"joined_at"`
AvatarUrl string `json:"avatar_url,optional"`
Children []InviteTreeNode `json:"children"`
}
InviteRewardPublic {
Id string `json:"id"`
InviteeUid int64 `json:"invitee_uid"`
PlanId string `json:"plan_id"`
Points int `json:"points"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
}
InviteRewardsSummary {
TotalPoints int `json:"total_points"`
MonthPoints int `json:"month_points"`
MonthCap int `json:"month_cap"`
Recent []InviteRewardPublic `json:"recent"`
}
MyInviteNetworkData {
Me InviteMemberBrief `json:"me"`
Upline *InviteMemberBrief `json:"upline,optional"`
Downlines []InviteMemberBrief `json:"downlines"`
TotalDownlineCount int `json:"total_downline_count"`
Rewards *InviteRewardsSummary `json:"rewards,optional"`
}
ApplyInviteCodeReq {
Code string `json:"code"`
}
InviteTreeData {
List []InviteTreeNode `json:"list"`
}
MoveInviteMemberReq {
Uid int64 `json:"uid"`
ParentUid int64 `json:"parent_uid,optional"` // 0 = 獨立根
}
ListParentCandidatesReq {
ExcludeSubtreeRootUid int64 `form:"exclude_subtree_root_uid,optional"`
}
InviteParentCandidatesData {
List []InviteMemberBrief `json:"list"`
}
)
@server (
group: invite
prefix: /api/v1/invite
middleware: AuthJWT
)
service gateway {
@handler GetMyInviteNetwork
get /me returns (MyInviteNetworkData)
@handler ApplyInviteCode
post /apply (ApplyInviteCodeReq) returns (MyInviteNetworkData)
}
@server (
group: invite
prefix: /api/v1/invite
middleware: AuthJWT,AdminAuth
)
service gateway {
@handler GetInviteTree
get /tree returns (InviteTreeData)
@handler MoveInviteMember
post /move (MoveInviteMemberReq) returns (InviteMemberBrief)
@handler ListInviteParentCandidates
get /parent-candidates (ListParentCandidatesReq) returns (InviteParentCandidatesData)
}