Interface ISupportTicketService
- Namespace
- FishMMO.Database.Npgsql.Services.Interfaces
- Assembly
- FishMMO-DB.dll
Support tickets: filed by players in the game, worked by staff in the Control Panel.
public interface ISupportTicketService
Remarks
Whether internal notes are returned is decided here, not by the caller. Every read
takes an explicit includeInternal, and a player-facing caller passes false. Making
it the caller's job to filter afterwards is the shape in which internal notes eventually
leak: it only takes one endpoint that forgets, and the failure is silent until a player
quotes a game master's private note back at them.
Nothing here checks who is asking. Authorization is the panel's, because it depends on the caller's access level, which this layer cannot see — but every read that can reach a player forces the decision to be made.
Methods
AppendMessageAsync(long, string, bool, bool, string, byte, CancellationToken)
Appends a message and moves the activity timestamp.
Task<DatabaseResult<long>> AppendMessageAsync(long ticketId, string authorAccount, bool authorIsStaff, bool internalNote, string body, byte actorAccessLevel, CancellationToken cancellationToken = default)
Parameters
ticketIdlongThe ticket.
authorAccountstringWho wrote it.
authorIsStaffboolWhether they were acting as staff.
internalNoteboolWhether the player must never see it.
bodystringThe text.
actorAccessLevelbyteThe staff author's access level, checked against the ticket's tier. Ignored for a player's reply, which is never tier-gated.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
One method for a player's reply and a staff note alike, because they are the same row with different flags — and because two methods would be two places for the internal flag to be got wrong.
AssignAsync(long, string, byte, CancellationToken)
Assigns a ticket, or clears the assignment when staffAccount is null.
Task<DatabaseResult> AssignAsync(long ticketId, string staffAccount, byte actorAccessLevel, CancellationToken cancellationToken = default)
Parameters
ticketIdlongThe ticket.
staffAccountstringThe new assignee, or null to return it to the queue.
actorAccessLevelbyteThe acting staff member's level, checked against the ticket's tier.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
Moves an Open ticket to InProgress as a side effect, because taking a ticket and saying you are working on it are the same act, and a queue where those are two clicks is a queue full of assigned tickets still marked open.
CountOpenForAccountAsync(string, CancellationToken)
Counts a player's unfinished tickets, for showing them why they cannot file another.
Task<DatabaseResult<int>> CountOpenForAccountAsync(string accountName, CancellationToken cancellationToken = default)
Parameters
accountNamestringcancellationTokenCancellationToken
Returns
CreateAsync(SupportTicketCreate, CancellationToken)
Files a ticket.
Task<DatabaseResult<long>> CreateAsync(SupportTicketCreate ticket, CancellationToken cancellationToken = default)
Parameters
ticketSupportTicketCreateThe ticket as filed.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<DatabaseResult<long>>
The new ticket's id.
Remarks
Refuses when the account already holds too many unfinished tickets, or filed one moments ago. A support queue with no such limit is one a single annoyed player can make unusable for everybody, and the limit belongs here rather than in one caller because the game and the panel can both file.
FetchAsync(long, bool, CancellationToken)
Fetches one ticket and its conversation.
Task<DatabaseResult<SupportTicketData>> FetchAsync(long ticketId, bool includeInternal, CancellationToken cancellationToken = default)
Parameters
ticketIdlongThe ticket.
includeInternalboolWhether staff-only notes are included. False for anything a player can reach.
cancellationTokenCancellationTokenCancellation token.
Returns
SearchAsync(SupportTicketQuery, CancellationToken)
Searches tickets.
Task<DatabaseResult<SupportTicketPage>> SearchAsync(SupportTicketQuery query, CancellationToken cancellationToken = default)
Parameters
querySupportTicketQueryFilters. Every field is optional.
cancellationTokenCancellationTokenCancellation token.
Returns
SetPriorityAsync(long, int, byte, CancellationToken)
Sets the staff priority.
Task<DatabaseResult> SetPriorityAsync(long ticketId, int priority, byte actorAccessLevel, CancellationToken cancellationToken = default)
Parameters
ticketIdlongpriorityintactorAccessLevelbytecancellationTokenCancellationToken
Returns
SetStatusAsync(long, SupportTicketStatus, string, string, byte, CancellationToken)
Sets the status, and the resolution when finishing.
Task<DatabaseResult> SetStatusAsync(long ticketId, SupportTicketStatus status, string staffAccount, string resolution, byte actorAccessLevel, CancellationToken cancellationToken = default)
Parameters
ticketIdlongstatusSupportTicketStatusstaffAccountstringresolutionstringactorAccessLevelbytecancellationTokenCancellationToken
Returns
Remarks
A ticket moved to Resolved or Closed must carry a resolution: the whole value of a closed ticket is being able to answer "what was decided" a month later.
SetTierAsync(long, byte, string, string, byte, CancellationToken)
Moves a ticket to another support tier, clearing its assignee.
Task<DatabaseResult> SetTierAsync(long ticketId, byte requiredAccessLevel, string staffAccount, string reason, byte actorAccessLevel, CancellationToken cancellationToken = default)
Parameters
ticketIdlongThe ticket.
requiredAccessLevelbyteThe new tier, as an access level.
staffAccountstringWho is moving it.
reasonstringWhy. Required, and written onto the ticket as an internal note in the same transaction.
actorAccessLevelbyteTheir access level.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
A tier is the lowest access level that may see and work the ticket: GameMaster or
Admin. Every staff write on this service refuses an actor below the ticket's tier
with Forbidden, so a promoted ticket cannot be worked through a typed ticket number.
The actor must be allowed to work the ticket at its current tier. A game master may therefore promote a first-tier ticket, and only an administrator may hand one back down. The assignee is cleared and an in-progress ticket returns to open, because whoever held it is handing it on. The activity clock is not moved.