Skip to content

Feature 14: Character History & Undo #139

@aphexlog

Description

@aphexlog

Description

Track character state changes over time and allow undoing recent changes.

Priority

P3 (Low) - Future enhancement

Estimated Effort

4 days

Dependencies

Acceptance Criteria

  • History table stores all changes
  • Undo button reverts last change
  • History shows last 10 changes
  • Changes timestamped
  • Changes attributed to source (user/AI)

Implementation Details

Add to schema:

GameMasterCharacterHistory: a.model({
  id: a.id(),
  characterId: a.id(),
  adventureId: a.id(),
  questStepId: a.string(),
  
  changeType: a.string(), // 'stat' | 'inventory' | 'hp' | 'level'
  fieldChanged: a.string(),
  oldValue: a.json(),
  newValue: a.json(),
  
  reason: a.string(),
  triggeredBy: a.string(), // 'user' | 'ai' | 'system'
  
  createdAt: a.date(),
}).authorization(allow => [allow.owner(), allow.groups(['Admins'])])

Record changes:

const recordChange = async (change: CharacterChange) => {
  await dataClient.models.GameMasterCharacterHistory.create({
    characterId: characterState.id,
    adventureId: adventureState.id,
    changeType: change.type,
    fieldChanged: change.field,
    oldValue: change.oldValue,
    newValue: change.newValue,
    reason: change.reason,
    triggeredBy: change.source,
  });
};

Testing

  • Changes recorded to history
  • Undo reverts change
  • History displays correctly
  • Timestamps accurate

Related Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: LowLow priority - future enhancementscharacter-sheetCharacter sheet featuresdatabaseDatabase schema changesenhancementNew feature or requestgame-masterGame Master mode features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions