Skip to content

refactor(domain): replace Position enum with LoL Role enum #50

Description

@NicoRuedaA

Problem or opportunity

domain/src/player.rs defines a Position enum with 18 football variants (Goalkeeper, Defender, Midfielder, Forward, RightBack, CenterBack, etc.). This is completely wrong for a League of Legends manager. The core data model does not reflect the game.

Current workaround: src/lib/lolIdentity.ts maps Position → Role in the frontend. This is technical debt and confusing.

Proposed solution

  1. Create new Role enum in domain/src/player.rs:
    ust pub enum Role { Top, Jungle, Mid, ADC, Support, }

  2. Keep Position enum temporarily with #[serde(alias)] for backwards compatibility.

  3. Add conversion method:
    ust impl Position { pub fn to_lol_role(&self) -> Role { ... } }

  4. Update Player struct to use Role for primary position, while keeping Position as a fallback/deprecated field.

UX impact

  • Frontend can drop lolIdentity.ts mapping workaround once Rust types are correct.

oleIcons.ts and components already expect LoL roles — they will align naturally.

  • Scripts (generate-lec-world.mjs) must output LoL roles directly.

Acceptance criteria

  • Role enum exists with 5 LoL variants
  • Position enum preserved with serde aliases for backwards compatibility
  • Player struct updated to include
    ole: Role
  • o_lol_role() conversion covers all 18 football positions
  • Frontend lolIdentity.ts can be simplified or removed
  • generate-lec-world.mjs outputs Role instead of Position

Scope

Data / provenance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions