133 lines
3.8 KiB
Go
133 lines
3.8 KiB
Go
package httpapi
|
|
|
|
// 本文件是各写接口的请求体契约;字段名与 web/src/shared/types.ts 对齐。
|
|
|
|
type loginInput struct {
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type saveDraftPayload struct {
|
|
EventID int64 `json:"eventId"`
|
|
CategoryID *int64 `json:"categoryId"`
|
|
Results []draftResultInput `json:"results"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type draftResultInput struct {
|
|
EntryID int64 `json:"entryId"`
|
|
Rank *int `json:"rank"`
|
|
ResultText *string `json:"resultText"`
|
|
ResultValue *float64 `json:"resultValue"`
|
|
Unit *string `json:"unit"`
|
|
IsTie bool `json:"isTie"`
|
|
Status string `json:"status"`
|
|
PointsOverride *float64 `json:"pointsOverride"`
|
|
Note *string `json:"note"`
|
|
}
|
|
|
|
type publishPayload struct {
|
|
EventID int64 `json:"eventId"`
|
|
CategoryID *int64 `json:"categoryId"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type voidResultPayload struct {
|
|
Reason string `json:"reason"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type adjustmentInput struct {
|
|
TeamID int64 `json:"teamId"`
|
|
Delta float64 `json:"delta"`
|
|
Category string `json:"category"`
|
|
Reason string `json:"reason"`
|
|
EventID *int64 `json:"eventId"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type recordBreakInput struct {
|
|
EventID int64 `json:"eventId"`
|
|
EntryID int64 `json:"entryId"`
|
|
Level string `json:"level"`
|
|
ResultValue float64 `json:"resultValue"`
|
|
ResultText string `json:"resultText"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type displayCommandInput struct {
|
|
Action string `json:"action"`
|
|
Payload any `json:"payload"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type voidAdjustmentPayload struct {
|
|
Reason string `json:"reason"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type settingsPatch struct {
|
|
Event *settingsEventPatch `json:"event"`
|
|
Display *settingsDisplayPatch `json:"display"`
|
|
Standings *settingsStandingsPatch `json:"standings"`
|
|
DefaultProfileID *int64 `json:"defaultProfileId"`
|
|
RequireApproval *bool `json:"requireApproval"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
type settingsEventPatch struct {
|
|
Name *string `json:"name"`
|
|
Subtitle *string `json:"subtitle"`
|
|
Host *string `json:"host"`
|
|
LogoPath *string `json:"logoPath"`
|
|
PrimaryColor *string `json:"primaryColor"`
|
|
}
|
|
|
|
type settingsDisplayPatch struct {
|
|
Background *string `json:"background"`
|
|
Logo *string `json:"logo"`
|
|
Title *string `json:"title"`
|
|
Subtitle *string `json:"subtitle"`
|
|
PrimaryColor *string `json:"primaryColor"`
|
|
RotateSeconds *float64 `json:"rotateSeconds"`
|
|
}
|
|
|
|
type settingsStandingsPatch struct {
|
|
IndividualToTeamWeight *float64 `json:"individualToTeamWeight"`
|
|
RankingMode *string `json:"rankingMode"`
|
|
ShowIndividualBoard *bool `json:"showIndividualBoard"`
|
|
}
|
|
|
|
type categoriesPayload struct {
|
|
Categories []categoryDTO `json:"categories"`
|
|
}
|
|
|
|
type channelsPayload struct {
|
|
Channels []channelDTO `json:"channels"`
|
|
}
|
|
|
|
// ---------- 用户管理 ----------
|
|
|
|
type createUserInput struct {
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
Role string `json:"role"`
|
|
Password string `json:"password"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
// updateUserInput 只带需要改的字段:nil 表示保持原值。
|
|
type updateUserInput struct {
|
|
DisplayName *string `json:"displayName"`
|
|
Role *string `json:"role"`
|
|
Active *bool `json:"active"`
|
|
RequestID string `json:"requestId"`
|
|
}
|
|
|
|
// resetUserPasswordInput 的 password 留空时由服务端随机生成。
|
|
type resetUserPasswordInput struct {
|
|
Password string `json:"password"`
|
|
RequestID string `json:"requestId"`
|
|
}
|