feat(cosmetics): add COMPANION cosmetic type with animation descriptor - #56
Merged
Conversation
Mirror PLAYMAT's multi-file glTF model for a new COMPANION type and add an optional structured `animation` descriptor (clips/rigFile/targetHeight/ orientationOffsetY) persisted as nullable jsonb. The descriptor is threaded to both the catalog DTO and the loadout slot, so the public loadout — the opponent/spectator visibility gate — carries it without a catalog re-fetch. - Add COMPANION to CosmeticType and a migration (enum value + jsonb column) - Guard CosmeticPostgresRepository.findById against non-uuid ids to avoid a Postgres 500 on the client's bundled "skeleton-mage" default - Enforce the animation-only-on-COMPANION invariant in Cosmetic.create - Seed the four KayKit companions (warrior/rogue/minion/mage)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
COMPANIONcosmetic type that mirrorsPLAYMAT(a multi-file glTF asset served via signed R2 URLs under a folder prefix) plus an optional structuredanimationdescriptor.Why
Backend prerequisite so opponents/spectators can see a player's equipped companion. The descriptor (
clips/rigFile/targetHeight/orientationOffsetY) drives the client's animation strategy; getting any field wrong fails silently on the client, so the field shapes match the client contract exactly.Changes
CosmeticType.COMPANION+ migration:ALTER TYPE ... ADD VALUEand a nullableanimationjsonb column (additive, non-destructive; isolatedcosmetics_migrationshistory).animationthreaded through the domain (Cosmetic), repository, the catalog DTO, and the loadout slot. The public loadout (GetPublicLoadout) delegates toGetMyLoadout, so the opponent/spectator gate carries the descriptor without a catalog re-fetch.CosmeticPostgresRepository.findByIdguards non-uuid ids to avoid a Postgres 500 on the client's bundledskeleton-magedefault (returns a graceful NotFound).animationis only allowed on COMPANION cosmetics (Cosmetic.create).assetRef.Validation
tscclean ·biome checkclean.GetMyLoadout, and through the public loadout; non-uuid id -> NotFound (no 500); domain invariant; seed shape.Deploy notes
ALTER TYPE ... ADD VALUEruns inside TypeORM's transaction).bun run migration:cosmetics:runbeforebun run seed:cosmetics..glbasContent-Type: model/gltf-binaryand allow the web origin via CORS/CORP (COEP: require-corp).