Skip to content

Commit 18c1ae5

Browse files
committed
Update custom reward redemptions response
1 parent dc6e431 commit 18c1ae5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

internal/database/channel_points_redemptions.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type ChannelPointsRedemption struct {
1515
UserLogin string `db:"user_login" dbi:"false" json:"user_login"`
1616
UserName string `db:"user_name" dbi:"false" json:"user_name"`
1717
UserInput sql.NullString `db:"user_input" json:"-"`
18-
RealUserInput *string `json:"user_input"`
18+
RealUserInput string `json:"user_input"`
1919
RedemptionStatus string `db:"redemption_status" json:"status"`
2020
RedeemedAt string `db:"redeemed_at" json:"redeemed_at"`
2121
RewardID string `db:"reward_id" json:"-"`
@@ -25,7 +25,7 @@ type ChannelPointsRedemption struct {
2525
type ChannelPointsRedemptionRewardInfo struct {
2626
ID string `dbi:"false" db:"red_id" json:"id" dbs:"red.id"`
2727
Title string `dbi:"false" db:"title" json:"title"`
28-
RewardPrompt string `dbi:"false" db:"reward_prompt" json:"reward_prompt"`
28+
RewardPrompt string `dbi:"false" db:"reward_prompt" json:"prompt"`
2929
Cost int `dbi:"false" db:"cost" json:"cost"`
3030
}
3131

@@ -50,9 +50,9 @@ func (q *Query) GetChannelPointsRedemption(cpr ChannelPointsRedemption, sort str
5050
if err != nil {
5151
return nil, err
5252
}
53-
red.RealUserInput = &red.UserInput.String
53+
red.RealUserInput = red.UserInput.String
5454
if !red.UserInput.Valid {
55-
red.RealUserInput = nil
55+
red.RealUserInput = ""
5656
}
5757
r = append(r, red)
5858
}

internal/mock_api/endpoints/channel_points/redemptions.go

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ func getRedemptions(w http.ResponseWriter, r *http.Request) {
6868
status := r.URL.Query().Get("status")
6969
sort := r.URL.Query().Get("sort")
7070

71+
if id == "" && status == "" {
72+
mock_errors.WriteBadRequest(w, "The status query parameter is required if you don't specify the id query parameter.")
73+
return
74+
}
75+
7176
if !userCtx.MatchesBroadcasterIDParam(r) {
7277
mock_errors.WriteUnauthorized(w, "Broadcaster ID mismatch")
7378
return

0 commit comments

Comments
 (0)