Table of Contents

Class AdminCharactersController

Namespace
FishMMO.ControlPanel.Controllers
Assembly
FishMMO-ControlPanel.dll

Operator actions on an existing character.

[ApiController]
[Route("api/admin/characters")]
public sealed class AdminCharactersController : ControllerBase
Inheritance
AdminCharactersController
Inherited Members

Remarks

Restore and rename, and nothing that decides whether a character exists. Creation and deletion are in-game only: deletion spans fourteen sub-entity tables inside one unit of work in the login server's character-select system, and a second implementation of that is how a shard loses data.

Restore is on the right side of that line because it un-deletes a row that is still there, and rename changes one field. Neither reaches the teardown.

Constructors

AdminCharactersController(ICharacterService, AuditScope, ILogger<AdminCharactersController>)

public AdminCharactersController(ICharacterService characters, AuditScope audit, ILogger<AdminCharactersController> log)

Parameters

characters ICharacterService
audit AuditScope
log ILogger<AdminCharactersController>

Methods

EditLock(long)

The character's current edit lock, for polling after a kick.

[HttpGet("{id:long}/edit-lock")]
[Authorize(Policy = "Operator")]
public Task<IActionResult> EditLock(long id)

Parameters

id long

Returns

Task<IActionResult>

Patch(long, EditRequest)

Applies an edit to a character's stored row.

[HttpPatch("{id:long}")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("character.edit", TargetType = "character", TargetRouteValue = "id")]
public Task<IActionResult> Patch(long id, AdminCharactersController.EditRequest request)

Parameters

id long
request AdminCharactersController.EditRequest

Returns

Task<IActionResult>

Remarks

Position, scene and the character's own access level. The service re-checks the session lease inside the write, so a character claimed between the operator's read and this call is refused rather than written over.

Rename(long, RenameRequest)

Renames a character.

[HttpPost("{id:long}/rename")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("character.rename", TargetType = "character", TargetRouteValue = "id")]
public Task<IActionResult> Rename(long id, AdminCharactersController.RenameRequest request)

Parameters

id long
request AdminCharactersController.RenameRequest

Returns

Task<IActionResult>

Restore(long, ReasonRequest)

Restores a soft-deleted character.

[HttpPost("{id:long}/restore")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("character.restore", TargetType = "character", TargetRouteValue = "id")]
public Task<IActionResult> Restore(long id, AdminCharactersController.ReasonRequest request)

Parameters

id long
request AdminCharactersController.ReasonRequest

Returns

Task<IActionResult>

Remarks

Deletion renames the row, appending a marker and a GUID so the unique index releases the name; restoring puts the original name back. That fails when somebody has taken the name since, and the operator needs to be told which name rather than shown a generic error.