Commit Graph

57 Commits

Author SHA1 Message Date
Claudio Ortolina 1ddef07bcc fix(api): handle non-integer error ids, clamp negative pagination params
- show/2: use case instead of bare Integer.parse match so
  /api/v1/errors/not-an-id returns 404 instead of crashing
- index/2: clamp limit to >= 1 and offset to >= 0 to prevent
  SQLite from treating negative values as unlimited
- Add 3 tests: non-integer id 404, negative limit/offset clamping
2026-05-04 14:17:45 +01:00
Claudio Ortolina 51bd24d5b4 ML-162: enable /api/v1/errors endpoint 2026-05-04 13:14:40 +01:00
Claudio Ortolina c489fde1cc ML-152: add /api/v1/ version prefix to all API routes 2026-04-30 11:57:43 +01:00
Claudio Ortolina 92a36b915a Harden public asset endpoint against invalid payloads
Closes #143
2026-03-30 14:56:40 +01:00
Claudio Ortolina 45fd414f1b Use friendly error messages in Last.fm callback
Closes #145
2026-03-30 14:42:20 +01:00
Claudio Ortolina 96836ae715 Improve tests: better assertions, meaningful tests
Track resulting principles in project conventions
2026-03-27 15:46:31 +00:00
Claudio Ortolina 1301f888f3 Remove "it" from the test descriptions 2026-03-27 08:38:41 +00:00
Claudio Ortolina 170a52b3e4 Fix test descriptions for consistency 2026-03-26 11:54:47 +00:00
Claudio Ortolina 69983d9dac Fix incorrect tests 2026-03-26 11:53:49 +00:00
Claudio Ortolina f82e764c94 Add tests for Last.fm controller 2026-02-09 11:12:38 +00:00
Claudio Ortolina fc307a0aba Add tests for health controller 2026-02-09 11:12:02 +00:00
Claudio Ortolina 356efb1c65 Add tests for archive controller 2026-02-09 11:11:41 +00:00
Claudio Ortolina 59eb603b3f Return more record information in the API 2025-10-25 11:52:50 +01:00
Claudio Ortolina f02564fa30 Add /api/collection/on_this_day endpoint 2025-10-24 20:06:23 +01:00
Claudio Ortolina e158345674 Change /covers to /assets 2025-09-18 21:26:16 +03:00
Claudio Ortolina aa72692eaf Cache transformations 2025-09-17 16:54:47 +03:00
Claudio Ortolina b0f4e18ef7 Fix API collection record cover URLs 2025-09-17 11:24:14 +03:00
Claudio Ortolina 0996b78c7b Use Transforms to serve covers at the right size 2025-09-17 10:26:38 +03:00
Claudio Ortolina dc77d337c0 Migrate from embedded covers to assets 2025-09-01 16:20:41 +03:00
Claudio Ortolina bd12454884 Serve covers from assets 2025-09-01 14:44:17 +03:00
Claudio Ortolina 49c3a5cba2 Serve images from assets table 2025-09-01 13:46:32 +03:00
Claudio Ortolina 07d9db6011 Speed up tests by caching cover data
Suggested and executed by Claude
2025-06-14 21:15:06 +03:00
Claudio Ortolina 676c2e4290 Enable quokka with :module_directives rule 2025-05-28 19:41:57 +01:00
Claudio Ortolina 3d0eec3bff Add /api/collection endpoint 2025-03-10 11:17:51 +00:00
Claudio Ortolina 513ce6363f Rename RecordsFixtures -> Fixtures.Records 2025-02-17 16:08:19 +00:00
Claudio Ortolina f21729ac00 Cache covers for 1 year 2025-01-31 07:43:06 +00:00
Claudio Ortolina ed6ef2c7ef Rename record_fixture* to record* 2025-01-06 14:20:36 +00:00
Claudio Ortolina 229445ffc9 Add missing logged_out tag 2025-01-05 11:28:45 +00:00
Claudio Ortolina 65899b8077 Add tests for /api/collection/random endpoint 2025-01-01 20:57:01 +00:00
Claudio Ortolina 97533416f7 Support arbitrary resizing in cover controller 2024-12-31 11:58:30 +00:00
Claudio Ortolina 68b2d48228 Return thumb_url in latest record response 2024-12-31 11:39:36 +00:00
Claudio Ortolina 97f26e0cd2 Serve covers under API namespace as well 2024-12-22 22:15:24 +00:00
Claudio Ortolina f1af38606a Protect API behind a bearer token 2024-12-22 18:32:04 +00:00
Claudio Ortolina 341d276db5 Include artists and cover in latest record JSON 2024-12-22 15:55:41 +00:00
Claudio Ortolina 53e8d88b6a Rename auth_password -> login_password 2024-12-21 14:57:44 +00:00
Claudio Ortolina 4f456322fc Bootstrap the /api namespace 2024-12-21 14:38:39 +00:00
Claudio Ortolina e4fe4e7f4b Cache images for 24 hours 2024-12-15 12:09:29 +03:00
Claudio Ortolina d9773bf45d Improve test description 2024-11-29 17:21:42 +00:00
Claudio Ortolina 7d574c7fd9 Convert stats page to a live view 2024-10-29 16:32:34 +00:00
Claudio Ortolina 79edd6eade Add missing index to records table
Updates a relevant test to remove flakyness
2024-10-22 22:15:13 +01:00
Claudio Ortolina 65a6bbbea9 Increase tests counts
Makes distribution of counts more interesting, reducing false positives
in the assertions (which are very simple)
2024-10-22 18:36:13 +01:00
Claudio Ortolina bb74057c31 Include wishlist count in stats page 2024-10-22 18:29:51 +01:00
Claudio Ortolina 913694b380 Rename "Sign in" to "Login" 2024-10-22 13:37:48 +01:00
Claudio Ortolina be314e3916 Reset session when hitting /login 2024-10-21 09:59:29 +01:00
Claudio Ortolina 28609dcf87 Display latest purchase in stats page 2024-10-19 19:46:39 +01:00
Claudio Ortolina 2661c9f60d Display type stats 2024-10-14 22:33:05 +01:00
Claudio Ortolina 9f383dfc5b Make db-dependent tests sync
As explained at
https://hexdocs.pm/ecto_sqlite3/Ecto.Adapters.SQLite3.html#module-async-sandbox-testing:

The Ecto SQLite3 adapter does not support async tests when used with
Ecto.Adapters.SQL.Sandbox. This is due to SQLite only allowing up one
write transaction at a time, which often does not work with the Sandbox
approach of wrapping each test in a transaction.
2024-10-10 15:54:22 +01:00
Claudio Ortolina 1fdf36ea8a Include artists in record test fixture 2024-10-10 10:02:03 +01:00
Claudio Ortolina 52c1be1e32 Restructure stats
Split out count by format
2024-10-08 20:36:39 +01:00
Claudio Ortolina 76907a4a6f Make all tests async
Doesn't make a difference at this stage, but it's a good foundation as
the application grows.
2024-10-08 16:53:47 +01:00