The store-URL support extracted the app ID into a local but never wrote
it back, so steamScraper still received the full URL, keyed the Steam API
response by the URL string, threw, and its caught Error object flowed into
Game.create() — surfacing as misleading 'Path lastModifiedBy / createdBy /
frontImage / title is required' validation errors.
- add utils/normalizeSteamId: digits pass through, /app/<id>/ (plus
/agecheck/app/<id>/ and query strings) extracts the ID, empty -> '',
anything else -> null (no .match()[0] / .includes crash on bad input)
- create(): 400 cleanly on unrecognized input, write the normalized ID
back to req.body.steamId so dup checks, scraper, and stored doc agree
- guard the scrape result (missing title/frontImage, false, or Error) and
400 'Steam lookup failed' instead of leaking it into Game.create
Allow callers to pass either a raw Steam app ID or a full store URL (e.g. https://store.steampowered.com/app/730/...) in req.body.steamId.
In create() in controllers/games.js:
- normalize input into a local steamId variable: if the value includes store.steampowered.com, extract the numeric ID via match(/\d+/)[0], otherwise use the value as-is
- use the normalized steamId for both duplicate checks: user-scoped lookup (steamId + accessedBy.user) and global lookup
This lets users paste a copied store link directly without manually stripping the app ID, while keeping existing raw-ID behavior unchanged.
Apply Prettier default formatting across the games controller with no logic changes:
- single -> double quotes, add missing semicolons
- 2-space indentation and consistent line wrapping
- expand dense ternary/decode blocks in create() and update() for readability
This isolates the upcoming create() Steam URL feature so its functional diff stays small and reviewable.