Commit Graph
70 Commits
Author SHA1 Message Date
Brenda Wallace f2fa894ea3 Add packet_text attribute and authorization logic to SeedResource; implement request specs for packet text writing 2026-10-28 23:38:18 +13:00
Brenda Wallace 0f8942508e Refactor API request handling: introduce RequestShape concern, update query and request body validation, and enhance link handling in specs 2026-10-26 20:45:16 +13:00
Brenda Wallace a4a44389d4 Add query shape validation and related tests for API requests 2026-10-26 20:40:16 +13:00
Brenda Wallace 8d5bdbdfd4 Refactor API documentation for request bodies and filter parameters; add tests for nullable attributes and request body requirements 2026-10-26 20:22:48 +13:00
Brenda Wallace 61552c13d3 Refactor pagination logic to ensure offset is treated as an integer and update API base URL for Codespaces 2026-10-26 17:28:28 +13:00
Brenda Wallace d3f61775b4 Enhance job validation and resource authorization for gardens; add tests for job creation and linking 2026-10-25 19:04:05 +13:00
Brenda Wallace a79f24cf5e Refactor API controllers and specs for improved request handling and error responses 2026-10-25 18:44:05 +13:00
Brenda Wallace 086140205d fixing authorize in the APi 2026-10-25 11:44:02 +13:00
Brenda Wallace e7387a37e0 Add API tests for dashed keys, resource ownership, and write operations
- Implement tests for handling dashed attribute names in API responses and requests in `dashed_keys_request_spec.rb`.
- Enhance error handling tests in `errors_request_spec.rb` for invalid filters and attributes.
- Refactor garden, harvest, and seed request specs to use shared examples for resource write operations.
- Introduce shared examples in `api_writes.rb` to streamline testing of create, update, and delete actions across various resources.
- Update pagination and sorting tests to include new scenarios for offsets and computed attributes.
- Remove redundant code and improve test clarity by utilizing shared contexts and helper methods.
2026-10-24 18:19:11 +13:00
Brenda Wallace c87a164b0a Refactor code structure for improved readability and maintainability 2026-10-24 18:19:11 +13:00
Brenda Wallace 73f62d4983 Add API resources for photos, plantings, and seeds; update application configuration
- Introduced `PhotoResource`, `PlantingResource`, and `SeedResource` to manage respective models.
- Updated application configuration to include API base URL.
- Modified production and test environments to set API base URL dynamically.
- Removed outdated JSONAPI resources initializers and patches.
- Refactored routes to use resourceful routing for API endpoints.
- Updated request specs to reflect changes in API responses and relationships.
- Added helper methods for generating related links in request specs.
2026-10-24 18:19:11 +13:00
Brenda Wallace 07612ff385 Add API request specs for filtering, pagination, sorting, and relationships 2026-10-24 18:19:11 +13:00
Brenda Wallace d7d14cf65e Implement job linking functionality with crop suggestions and UI enhancements 2026-10-22 17:59:27 +13:00
Brenda Wallace a0b24381ac Refactor activities to jobs across the application
- Renamed all instances of 'Activity' to 'Job' in views, controllers, and models.
- Updated routes to reflect the change from activities to jobs.
- Modified database schema to rename the activities table to jobs and adjusted related columns.
- Updated locale files to change activity-related translations to jobs.
- Adjusted tests to ensure they reference jobs instead of activities.
- Removed the category field from jobs as they are now a plain list.
- Updated seed data and sample data generation to create jobs instead of activities.
2026-10-22 17:16:25 +13:00
Brenda Wallace 77bf9d5e92 Rename activities to jobs and update related files for consistency 2026-10-22 17:06:55 +13:00
Brenda Wallace 977a984c24 Remove Elasticsearch integration and related code
- Deleted Elasticsearch gems from Gemfile and Gemfile.lock.
- Updated README and TECH documentation to reflect the removal of Elasticsearch.
- Removed Elasticsearch-related code from models, controllers, services, and factories.
- Adjusted tests to eliminate dependencies on Elasticsearch.
- Cleaned up Docker configuration and environment variables related to Elasticsearch.
- Added a TODO file for future gem reviews and potential removals.
2026-10-22 15:37:03 +13:00
5ada7e7f77 Add crops search API endpoint (#4622)
* Add crops search API endpoint

- Added GET /api/v1/crops/search endpoint.
- Updated CropSearchService to support additional search options.
- Manually updated Swagger documentation in swagger/v1/swagger.json.
- Added request specs to verify the new endpoint.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* Add crops search API endpoint

- Added GET /api/v1/crops/search endpoint.
- Updated CropSearchService to support additional search options.
- Manually updated Swagger documentation in swagger/v1/swagger.json.
- Added request specs to verify the new endpoint.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-05-04 18:12:36 +09:30
Daniel O'Connor accab7f84c Merge pull request #4545 from Growstuff/RSpecRails/InferredSpecType
Rubocop: RSpecRails/InferredSpecType
2026-04-23 23:29:17 +09:30
Daniel O'Connor ba75afb3f5 Rubocop: RSpecRails/InferredSpecType 2026-04-23 13:39:46 +00:00
Daniel O'Connor 6736ae3142 Rubocop: RSpec/ContextMethod 2026-04-23 13:20:47 +00:00
Daniel O'Connor f1acb35520 Merge pull request #4537 from Growstuff/FactoryBot/SyntaxMethods
Rubocop: FactoryBot/SyntaxMethods
2026-04-23 22:29:24 +09:30
Daniel O'Connor ae5c125a96 Rubocop: Layout/IndentationWidth 2026-04-23 12:10:09 +00:00
google-labs-jules[bot] 63d65c4e6b Merge pull request #4277 from Growstuff/add-activity-update-coverage
Add test coverage for updating an activity via the API
2025-09-30 20:29:11 +09:30
Daniel O'Connor d9851231f2 Merge pull request #4274 from Growstuff/CloCkWeRX-patch-3
API > Render activities links under member
2025-09-29 01:11:24 +09:30
google-labs-jules[bot]andDaniel O'Connor 02db5b8130 Add API token generation, authentication, and CRUD for a number of the API resources (#4237)
* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* feat: Add API token generation and authentication

This commit introduces API token generation and authentication for write operations.

- Adds a section to the user's profile edit page to generate and display an API token.
- Reuses the `authentications` table to store the API token, avoiding the need for a database migration.
- Implements token-based authentication for the API using the `Authorization: Token token=...` header.
- Enables write operations for all API resources and ensures they are protected by the new authentication mechanism.
- Adds feature and request specs to test the new functionality.

* Mark as editable

* Refactor

* WIP - Authentication

* Implement more test coverage

* Split 401 and 403

* Before Create hooks

* Update harvest specs, defaulting to the first plant part - this may not be right

* Update coverage

* Update coverage

* Rubocop

* Rubocop

* Rubocop

* Fix coverage

* For now, mark photos immutable again

* Fix specs

* Fix specs

* Rubocop

* Fix specs

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2025-09-10 19:50:06 +09:30
google-labs-jules[bot] e5c71f1dc4 Merge pull request #4230 from Growstuff/feature/add-more-filters
feat: Add more filters to API resources
2025-09-09 21:34:49 +09:30
google-labs-jules[bot] ba6ec689c5 Merge pull request #4150 from Growstuff/feature/failed-plantings
Add failed status to plantings
2025-08-27 23:42:53 +09:30
Daniel O'Connor 81060cccf7 Ruby 3.2: Rubocop - Lint/* and Style/* (#3786)
* Rubocop - Layout/*
* Rubocop - Lint and Style
2024-07-13 15:38:37 +09:30
Daniel O'Connor f338274611 Rails 7.1 (#3590)
* Rails 7.1

* Update application.rb

* Bump searchkick

* Bump to 7.0.0

* Fix

* Fix crop search

* Sync translation

* Drop required from form group

* Loosen specs further

* Fix Gemfile

* Update seeds_request_spec.rb

* Update test.rb

* Rename
2024-01-27 10:06:47 +10:30
Daniel O'Connor d1f754a288 Rubocop 2022-11-08 00:23:38 +10:30
Daniel O'Connor b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
Daniel O'Connor 260f19e047 Add tests #3401 - wrong resources loaded (#3045)
* Prove broken

* Allow filter by owner id

* Specify FK

* Mark pending, and cover filter by member
2022-05-01 17:09:13 +09:30
codefactor-io 4ff95fbac9 [CodeFactor] Apply fixes 2020-01-21 22:26:08 +13:00
Brenda 7257b2ada1 Update with frozen literals 2020-01-10 16:50:52 +13:00
Brenda Wallace 04fd1a343a Rubocop update (#2334)
* Update rubocop config

* Rubocop update - for rubocop 0.77

* [CodeFactor] Apply fixes

* rubocop fixes

* [CodeFactor] Apply fixes to commit 2826c2e
2019-12-16 22:35:33 +13:00
Brenda Wallace fa1e70036a Fix name of spec 2019-11-18 16:06:57 +13:00
Brenda Wallace df5b0499e4 Update spec for api resource 2019-11-16 13:05:40 +13:00
Awesome Code 4ba5319ba8 Auto corrected by following Lint Ruby Capybara/FeatureMethods 2019-04-01 23:02:50 +13:00
Awesome Code e10c641702 Auto corrected by following Lint Ruby Layout/AlignHash 2019-03-22 07:55:05 +00:00
Brenda Wallace 77f936cb0f update spec 2019-03-20 09:43:01 +13:00
Awesome Code ad470ede1d Auto corrected by following Lint Ruby RSpec/AlignRightLetBrace 2019-03-13 17:23:33 +13:00
Awesome Code f90cc792bb Auto corrected by following Lint Ruby RSpec/AlignLeftLetBrace 2019-03-13 11:42:27 +13:00
Brenda Wallace 572af9d135 Merge branch 'dev' into photos/seeds 2019-02-09 17:00:58 +13:00
Awesome Code 284bb81bbf Auto corrected by following Lint Ruby RSpecEmptyLine 2019-02-09 03:05:40 +00:00
Brenda Wallace 9a4f1058e1 Adding more attributes and filters to the api 2019-02-09 08:43:59 +13:00
Brenda Wallace 51e6da7da6 Rubocop lint tidxy 2019-02-05 12:37:23 +13:00
Brenda Wallace f640e41b55 Add seeds to crops api spec 2019-02-05 10:23:10 +13:00
Brenda Wallace 7b01fcbd4b Align all the hashes 2018-12-30 15:22:29 +13:00
Brenda Wallace 550860178e Merge remote-tracking branch 'upstream/dev' into upgrade/rails-5 2018-09-11 16:07:30 +12:00
Awesome Code 90f4db4853 Auto corrected by following Ruby rspec layout 2018-09-10 22:20:12 +00:00