feat(api): guest CSAT rating by token#85
Merged
Merged
Conversation
Add POST /api/guest/tickets/{token}/rate so a guest can rate their own
resolved/closed ticket using its guest token. Extracts the shared rating
core (validation, rateable check, one-per-ticket guard, insert) from the
authenticated Rate handler into rateByTicketID; GuestRate resolves the
ticket by guest_token and reuses it. Routes registered in both routers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds guest CSAT — a guest can rate their own resolved/closed ticket via its guest token. (The satisfaction handler previously noted this as a follow-up pending a guest route group, which now exists from #81.)
What
POST /api/guest/tickets/{token}/rate— resolves the ticket byguest_token, then applies the same rating rules as the authenticated path (1–5 score, resolved/closed only, one rating per ticket).rateByTicketID;Rate(by id) andGuestRate(by token) both call it. Routes in both routers.Verification
go build ./...clean;golangci-lint run— 0 issues.TestGuestRateFlow(real SQLite + migrations + ticket service): open ticket → 422, resolve → rate 201, re-rate → 422, unknown token → 404.go test ./...passes.