Commit graph

496 commits

Author SHA1 Message Date
ea0bbc542e Alias table name to object to maintain API consistency 2025-02-07 03:34:10 -08:00
b89e83df97 Refactor parties#index and parties#favorites
These are mostly the same methods, so we remove common code into build_parties_query and render_paginated_parties
2025-02-07 03:27:39 -08:00
234d337af7 Update parties_controller.rb
Adds the rest of the changes, too tired to write them all out. Some preview generation, some filtering
2025-02-07 03:22:47 -08:00
38f6c043bf Update parties_controller.rb
Updates apply_includes and apply_excludes, along with modifying id_to_table and build_query
2025-02-07 03:18:30 -08:00
fde9b08edc Update parties#index 2025-02-07 03:17:36 -08:00
fdda833337 Update parties_controller.rbs 2025-02-07 03:17:04 -08:00
59be9d80d2 Remove redundant return 2025-02-07 02:22:47 -08:00
09dc344e35 Refactor parties#create 2025-02-07 02:21:52 -08:00
b526ce2138 Fix old view name in PartyBlueprint 2025-02-07 02:21:38 -08:00
5ecfeb6684 Update filter condition helpers
Just minor refactoring
2025-02-07 02:17:04 -08:00
59564df5ab Adds a helper method for party privacy 2025-02-07 02:15:48 -08:00
5d8ec96172 Updates excluded methods and calculate_count
* Use `includes` instead of `joins`
* Use a less-insane way of counting
2025-02-07 02:11:50 -08:00
8194844d28 Update logic and logs 2025-02-07 02:06:40 -08:00
ab1fd78530 Create parties_controller.rbs 2025-02-07 02:06:14 -08:00
1bc7d5fac9 Add method comments 2025-02-07 02:02:44 -08:00
9f86f3bf29 Remove preview expiry constants
These are defined in the Coordinator instead
2025-02-07 01:59:53 -08:00
adbb048867 Refactored PartyBlueprint to minimize N+1s 2025-02-07 01:58:52 -08:00
cca4427a75 Add cache to is_favorited(user) 2025-02-07 01:58:29 -08:00
dc24f4e600 Add preview generation helpers
The Party model can respond to queries about its preview state with the following models:
- `schedule_preview_generation`
- `preview_content_changed?`
- `preview_expired?`
- `should_generate_preview?`
- `ready_for_preview?`
- `needs_preview_generation?`
- `preview_relevant_attributes`

Removes the following methods:
- `schedule_preview_regeneration`
- `preview_relevant_changes?`
2025-02-07 01:58:17 -08:00
bd53af4339 Add counter caches to party 2025-02-07 01:54:27 -08:00
b86f3a90f6 Remove N+1 from grid object models
Reimplementing `character` `summon` and `weapon` was making N+1s which made queries really slow
2025-02-07 01:53:21 -08:00
4afccabaaf Refactor grid object blueprints 2025-02-07 01:51:34 -08:00
b71ca8e458 Refactor canonical object blueprints 2025-02-07 01:51:24 -08:00
e7db082d8b Update api_controller.rb
Add N+1 detectioin via Prosopite in development/test environments
2025-02-07 01:50:58 -08:00
0ad2db92fa Enable query logging 2025-02-07 01:35:30 -08:00
6dcb15f10d Configure Prosopite and remove CacheFreeLogger 2025-02-07 01:35:14 -08:00
2979ffb1e5 Configure Sidekiq
Create job for cleaning up party previews
2025-02-07 01:34:55 -08:00
8da912a2e4 Update Gemfile
Production:
- `newrelic_rpm`

Development:
- `pg_query`
- `prosopite`
2025-02-07 01:34:11 -08:00
58fd5db844 Update .gitignore 2025-02-07 01:31:11 -08:00
f914c1f16e Add migrations
* Update preview state default to pending
* Adds indexes
* Adds PgHero and PgStatements
2025-02-07 01:30:08 -08:00
8409fcabcf Update gitignore
There is a mystery postgres folder and we are going to ignore it
2025-02-07 01:29:17 -08:00
11d324efe9
Fix image embeds 3 (#176)
* Add default preview images

* Update application.rb

* Adds app assets path in API mode
* Cleans up file

* Create assets.rb

An initializer for font assets (for image generation)

* Updates to Canvas and Coordinator

* Update parties_controller.rb

* Adds retry header if generation is still in progress
* Streams S3 content instead of redirecting to prevent 302

* Update coordinator.rbs

* Create previews.rake

A rake task for generating images offline

* Add commands to build phase
2025-01-20 03:55:22 -08:00
ad2e2cc028
More embed image bandaids (#175)
* Only re-index search when records are updated

* Add logs and fixes

* Add preview_s3_key to Parties

* Add some extra packages to Nixfile

* Add logging around custom font use
2025-01-18 22:32:13 -08:00
1c1ed0dd9d
Work towards fixing embed images (#174)
* Add Redis and Sidekiq

* Rename PreviewGenerationMonitor

* Update production.rb

require master key

* Initialize AWS at application start

* Add fallbacks for credentials

* Add logging

* Create railway.toml
2025-01-18 11:46:41 -08:00
e3a44ca0d5
Implement embed images (#173)
* Add mini_magick and rufus-scheduler

* Expose attributes and add sigs to AwsService

* Get Party ready for preview state

* Added new fields for preview state and generated_at timestamp
* Add preview state enum to model
* Add preview_relevant_changes? after_commit hook

* Add jobs for generating and cleaning up party previews

* Add new endpoints to PartiesController

* `preview` shows the preview and queues it up for generation if it doesn't exist yet
* `regenerate_preview` allows the party owner to force regeneration of previews

* Schedule jobs

* Stalled jobs are checked every 5 minutes
* Failed jobs are retried every hour
* Old preview jobs are cleaned up daily

* Add the preview service

This is where the bulk of the work is. This service renders out the preview images bit by bit. Currently we render the party name, creator, job icon, and weapon grid.

This includes signatures and some fonts.
2025-01-18 09:08:15 -08:00
7ac5501da5
Update README.md (#171) 2025-01-18 03:25:40 -08:00
a5ad22b9c1
Create LICENSE (#172) 2025-01-18 03:25:32 -08:00
8708343b65
Create ENDPOINTS.md (#169) 2025-01-18 03:22:55 -08:00
d8cea9fd94
Update README.md (#170) 2025-01-18 03:22:34 -08:00
7d164b540c
Adds documentation to some lib functions (#168)
* Add sigs and docs to transformers

* Add sigs and docs to downloaders

* Adds sigs and docs to importers
2025-01-18 03:09:29 -08:00
0d5d4d5f59
Jedmund/import (#167)
* Move app/helpers/granblue_wiki to lib/parsers/wiki

This clears up the namespace beginning with "Granblue"

* Removed some top-level Granblue libs

DataImporter and DownloadManager exist inside of the PostDeployment namespace now so these files are redundant

* Fix Downloaders namespace

Our namespace was singular Downloader, now it is plural Downloaders to match the folder name

* Fix import paths

* DownloadManager was moved to downloaders/
* import_data task now uses the PostDeployment version of DataImporter

* Update application.rb

Eager-Load/Autoload the lib/ folder

* Update cors.rb

Add Granblue website and Extension ID to CORS

* Add transformers

Transformers take raw data from Granblue Fantasy and transforms them into hensei-compatible JSON. Transformers heavily borrow from vazkii/hensei-transfer.

* Add ImportController and route

This adds the controller that handles creating a full party from transformed Granblue Fantasy data
2025-01-17 12:02:12 -08:00
97d811cc29
Update PULL_REQUEST_TEMPLATE.md (#166)
Remove double quotes
2025-01-16 00:34:58 -08:00
6a60b605b6
Fix issue with migrations in Rails 8 (#165) 2025-01-16 00:34:13 -08:00
bde8dffaa2
Update PR templates again (#164) 2025-01-15 21:52:20 -08:00
7b74105e63
Updates to Ruby 3.3.7 (#163)
* Update .ruby-version and Gemfile

* Update .ruby-gemset

* Update Gemfile.lock
2025-01-15 21:31:49 -08:00
d75e4a8448
Downloader fixes (#162)
* Fix summon data

* Update logic for downloaders

These are responsible for downloading variants (01, 02, etc)

* Update puts statement

* Simplify ImageDownloader

* Simplify DownloadManager
2025-01-15 19:15:58 -08:00
fa386511e1
Some final post-deploy fixes (#161)
* Fix track_record error

* Add newlines

* Update PR templates
2025-01-15 18:06:20 -08:00
52f213d4cb
Update importer (#160)
* Importer now displays validation errors

This will help people debug errors before submitting their PR.

* Fix errors in the outstanding updates
2025-01-15 17:46:14 -08:00
0fd3f0f801
Importer should no longer look for recruits_id (#159) 2025-01-15 16:21:10 -08:00
aac629debc
Update recruits_id to recruits (#158) 2025-01-15 16:13:05 -08:00