Commit graph

315 commits

Author SHA1 Message Date
689aa96645 always include awakening field in collection character response 2025-12-02 17:19:11 -08:00
e97b0ade55 add default awakening, sorting, filtering scopes to CollectionCharacter 2025-12-02 17:19:07 -08:00
5bc179afa8 unify collection api: single endpoint for all users
- restructure routes: read via /users/:id/collection/*, write via /collection/*
- add user lookup + privacy check to collection_characters_controller
- add race, proficiency, gender scopes to model
- delete old collection_controller
2025-12-02 15:31:39 -08:00
32bc9f5872 fix /users/me endpoint to use current_user 2025-12-02 06:54:12 -08:00
9c5c859da6 add season/series/promotions filters to search endpoints 2025-12-02 05:54:52 -08:00
208d1f4836 add formal promotion to enums 2025-12-02 05:25:04 -08:00
cb016580bd add recruited_by field to character blueprint 2025-12-02 05:25:01 -08:00
05dd8996a4 weapons/summons controllers: permit promotions param 2025-12-02 04:40:22 -08:00
0dba56c55d weapon/summon blueprints: serialize promotions 2025-12-02 04:39:49 -08:00
e81c55905c weapons/summons: add promotion scopes and helpers 2025-12-02 04:39:30 -08:00
6f646101f2 add promotions integer array to weapons and summons 2025-12-02 04:39:15 -08:00
db048dc4e9 characters: permit season, series, gacha_available params 2025-12-02 04:18:37 -08:00
a3c33ce06a add season/series fields to CharacterBlueprint 2025-12-02 04:13:43 -08:00
afa1c5154f add season/series validations, scopes, helpers to Character 2025-12-02 04:09:55 -08:00
24d8d20ff8 add CHARACTER_SEASONS and CHARACTER_SERIES enums 2025-12-02 04:07:38 -08:00
6254bfde6f add nicknames, links to entity blueprints; recruits returns character info 2025-12-02 02:14:52 -08:00
f5760b1833 add batch_preview endpoint for entity import 2025-12-01 23:39:49 -08:00
707c0436c5 api: add update endpoints for characters, weapons, and summons
Add PATCH/PUT update actions to all three entity controllers with
editor role authorization. Routes updated to include :update action.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 03:23:24 -08:00
29cb276a2a weapons: add validate, create, download endpoints
Add weapon entity creation API following the established pattern from
characters and summons controllers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 03:04:15 -08:00
d70683ea1f character validator: skip CRL in dev 2025-12-01 02:41:21 -08:00
a27bdecde0 summons: add validate, create, download endpoints 2025-12-01 02:41:16 -08:00
deb5cfddb2 add character creation + image download API
- validate granblue_id via HEAD request to GBF CDN
- create characters with editor role check (role >= 7)
- async image download job with Redis status polling
- download_status endpoint for progress tracking
2025-12-01 00:48:40 -08:00
916b72d58d fix grid_characters: don't overwrite resolved IDs in assign_raw_attributes 2025-11-30 20:17:07 -08:00
af202716a2 add related characters endpoint 2025-11-30 20:16:46 -08:00
be5be0c3fe fix blueprints: use correct association names instead of 'object' 2025-11-29 17:41:29 -08:00
144b5cab58 Return proper REST response for deleting a party for more endpoints 2025-09-22 02:51:50 -07:00
4eee998cea Return proper REST response for deleting a party 2025-09-22 00:50:30 -07:00
5c6865ce0d Add dates view to search endpoint responses 2025-09-19 23:38:06 -07:00
f0e44249b7 Use full view for individual resource show endpoints 2025-09-19 23:37:38 -07:00
7a1e2fc8f9 Update uncap level endpoints to use uncap view
- Change response view from :nested/:full to :uncap for update_uncap_level
- Add default value of 0 for transcendence_step when not provided
- Fix max_uncap_level method call in GridSummonsController
2025-09-19 23:36:43 -07:00
f66e4d5a48 Add transcendence_step to uncap view in grid blueprints 2025-09-19 23:36:24 -07:00
4e5bb350d1 Make transcendence_step optional in grid models
- Change transcendence_step validation from required to optional
- Allow nil values but maintain numeric validation when present
- Add nil check in GridCharacter transcendence validation
2025-09-19 23:36:04 -07:00
2860552c94 Fix total_pages calculation to respect X-Per-Page header
The total_pages method was using the hardcoded SEARCH_PER_PAGE constant
instead of the dynamic search_page_size value from the X-Per-Page header.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 05:59:41 -07:00
42c811c112 Make search parameter optional for search endpoints
Allow search endpoints to work without the 'search' key in the request body.
When no search key is provided, return an empty hash to show all items.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 05:54:40 -07:00
8225340eec Fix error handling for ActionController::ParameterMissing
The render_unprocessable_entity_response method was calling to_hash
on all exceptions, but ActionController::ParameterMissing doesn't
have that method. Updated to handle different exception types properly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-17 05:51:58 -07:00
07e5488e0b Add custom page size support via X-Per-Page header
- Add page_size helper method to read from X-Per-Page header
- Set min (1) and max (100) bounds for page sizes
- Update all paginated endpoints to use dynamic page size
- Maintain backward compatibility with default sizes
2025-09-17 05:44:14 -07:00
8c05cd838c Add batch grid update endpoint
- POST /parties/:id/grid_update for atomic multi-operations
- Support move, swap, and remove operations
- Validate all operations before executing
- Use transaction for atomicity
- Optional character sequence maintenance
2025-09-16 03:33:02 -07:00
311e8254d0 Add summon position update and swap endpoints
- PUT /parties/:party_id/grid_summons/:id/position
- POST /parties/:party_id/grid_summons/swap
- Restrict main and friend summon positions
- Validate sub/subaura slot transitions
2025-09-16 03:32:45 -07:00
5ed8a68ab6 Add character position update and swap endpoints
- PUT /parties/:party_id/grid_characters/:id/position
- POST /parties/:party_id/grid_characters/swap
- Auto-compact main slots to maintain sequential filling
- Handle main/extra slot transitions
2025-09-16 03:28:26 -07:00
197577d951 Add weapon position update and swap endpoints
- PUT /parties/:party_id/grid_weapons/:id/position
- POST /parties/:party_id/grid_weapons/swap
- Validate positions and handle mainhand/extra slots
- Use transactions for atomic swaps
2025-09-16 03:28:02 -07:00
7ab6355f17 Add error classes for drag-drop validation
- InvalidPositionError for out-of-bounds positions
- PositionOccupiedError for occupied slot conflicts
2025-09-16 03:27:19 -07:00
f7015d04dd Add UUID and granblue_id resolution support
- Create IdResolvable concern for flexible ID lookups
- Update character/summon/weapon controllers to use concern
- Support both UUID and granblue_id in API calls
2025-09-16 03:26:15 -07:00
2f04a7d3a7
Add a data miner for downloading data from GBF (#196)
* First pass at dataminer service

* Got output printing from dataminer

* Fetches summons, characters and weapons

* Can loop over objects

* Finish dataminer

Adds logger and continuing downloads
2025-03-06 19:12:44 -08:00
7880ac76cc
Add data ingestion endpoints (#195)
* Update schema.rb

* Add endpoints for importing game data

This lets privileged users import canonical data for characters, weapons and summons directly from the game
2025-03-02 17:48:35 -08:00
4d3c1a800b
Update config files (#189)
* Update weapon series migration

This update fixes MigrateWeaponSeries from 20250218 such that it can be run on an empty database without throwing errors.

* Update .gitignore

Hide backups and logs directories, since we’ll be storing these in the project folder. Also hide mise’s .local directory.

* Change NewRelic log directory

Moved from log/ to logs/

* Add rake task for backing up/restoring prod db

* Rubocop fixes

* Fix error where :preview_state didn’t have an attribute

* Add supervisord ini

This uses my local paths, so we should try to abstract that away later.

* Ignore mise.toml
2025-02-27 23:13:57 -08:00
9827658771
Render the correct view when updating jobs (#186)
We were referencing an old view in `PartiesController#update_job`. This has been corrected.
2025-02-25 09:11:13 -05:00
3cdd925162
Fix filters and add processors (#181)
* Update test csvs

* Fix count filters and refactor apply_filters

* Update party_querying_concern.rb

* +tests/-debug logs

* Make party association optional in Job

* Updates for weapon series

- Change to new series numbers
- Add static method for querying whether the weapon's element is changeable
- Add a new method to return a text slug for the weapon's series

* Add and update test data

- Updates canonical.rb for loading multiple types of data with multiple types of associations
- Adds test data for Guidebooks, Job Accessories, Job Skills, and Jobs
- Updates test data for Weapons and Summons

* Migrations

- Adds series of migrations for changing the weapon's series to the values used by Cygames
- Shuffled around some foreign keys

* Implement BaseProcessor

Processors are in charge of processing deck data straight from Granblue.

* Implement CharacterProcessor

Process character data from deck

* Implement WeaponProcessor

Process weapon data from deck

* Implement JobProcessor

Process job, job skill, and job accessory data from deck

* Implement SummonProcessor

Process summon data from deck

* Update SummonProcessor to work like the others

* ImportController should use processors

* Process element for changeable weapons
2025-02-17 23:51:50 -08:00
60f153a169
Users#info endpoint uses username instead of ID (#180) 2025-02-13 02:43:16 -08:00
a042847aab
Migrate to Query Builder (#179)
* Moved queries into PartyQueryBuilder service

PartyQueryBuilder supersedes PartyQueryingConcern as it is also used for UsersController (and is our fix for profiles being broken)

* Implement PartyQueryBuilder in controllers

* Update summon_transformer.rb

This should fix the transformer so that we properly capture summons and subaura summons

* Update parties_controller_spec.rb

* Add NewRelic license key

* Add Sentry

Why not?
2025-02-12 23:43:02 -08:00
d6300f7aeb
Add first round of tests (#178)
* Install Rspec

* Create .aidigestignore

* Update rails_helper

- Added sections and comments
- Add support for loading via canonical.rb
- Add FactoryBot syntax methods
- Disable SQL logging in test environment

* Move gems around

* Add canonical.rb and test env CSVs

We load these CSVs via canonical.rb when we run tests as a data source for canonical objects.

* Remove RBS for now

This is too much and we need to find the right solution

* Refactor GridSummonsController and add tests

* Create GridSummon factory

* Refactor GridSummon and add documentation and tests

* Create have_error_on.rb

* Update .aidigestignore

* Fix warnings

* Add GridWeapons and Parties factories

* Refactor GridWeapon and add documentation and tests

* Create .rubocop.yml

* Create no_weapon_provided_error.rb

* Refactor GridWeaponsController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Refactor GridSummonsController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Enable shoulda/matchers

* Update User factory

* Update party.rb

We moved updating the party's element and extra flag to inside the party. We use an after_commit hook to minimize the amount of queries we're running to do this.

* Update party.rb

We change setting the edit key to use the conditional assignment operator so that it doesn't get overridden when we're running tests. This shouldn't have an effect in production.

* Update api_controller.rb

Change render_unprocessable_entity_response to render the errors hash instead of the exception so that we get more helpful errors.

* Add new errors

Added NoCharacterProvidedError and NoSummonProvidedError

* Add tests and docs to GridCharacter

We added a factory, spec and documentation to the GridCharacter model

* Ensure numericality

* Move enums into GranblueEnums

We don't use these yet, but it gives us a structured place to pull them from.

* Refactor GridCharactersController

- Refactors controller
- Adds YARD documentation
- Adds Rspec tests

* Add debug hook and other small changes

* Update grid_characters_controller.rb

Removes logs

* Update .gitignore

* Update .aidigestignore

* Refactored PartiesController

- Split PartiesController into three concerns
- Implemented testing for PartiesController and two concerns
- Implemented fixes across other files to ensure PartiesController tests pass
- Added Favorites factory

* Implement SimpleCov

* Refactor Party model

- Refactors Party model
- Adds tests
- Adds documentation

* Update granblue_enums.rb

Remove included block
2025-02-12 02:42:30 -08:00