43 Commits

Author SHA1 Message Date
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
Daniel O'Connor
81b80d9bb7 Update activity_resource.rb 2025-09-29 00:12:51 +09:30
Daniel O'Connor
f080a8a566 Update crop_resource.rb 2025-09-29 00:12:39 +09:30
Daniel O'Connor
5a436f9d7f Update garden_resource.rb 2025-09-29 00:12:32 +09:30
Daniel O'Connor
a4fd1c4a8e Update harvest_resource.rb 2025-09-29 00:12:27 +09:30
Daniel O'Connor
7277cb3523 Update seed_resource.rb 2025-09-29 00:12:07 +09:30
Daniel O'Connor
522d10e053 Update photo_resource.rb 2025-09-29 00:11:41 +09:30
Daniel O'Connor
f3a9b26c8e Update planting_resource.rb 2025-09-29 00:10:05 +09:30
google-labs-jules[bot]
d8f5580ef9 Extend planting API to render garden id in relationships 2025-09-28 14:39:33 +00:00
Daniel O'Connor
54acc369ab Rubocop 2025-09-20 09:43:22 +00:00
google-labs-jules[bot]
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
Daniel O'Connor
a21a9e7a09 Update garden_resource to filter by owner 2025-09-08 17:38:03 +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
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
Brenda Wallace
3604acdb67 Added crop.parent back into api 2020-06-15 10:34:35 +12:00
Brenda Wallace
e10e4285ce Comment our crop parent on api resource until we can specify the model 2020-06-03 15:30:13 +12:00
Brenda
7257b2ada1 Update with frozen literals 2020-01-10 16:50:52 +13:00
Brenda Wallace
76ee0c1cd8 rubocop lint 2019-11-19 13:58:16 +13:00
Brenda Wallace
0c3149205b Put resources back into namespaces 2019-11-19 13:53:12 +13:00
Brenda Wallace
8fb4725f46 Merge remote-tracking branch 'upstream/dev' into api-docs
Conflicts:
	app/resources/api/v1/planting_resource.rb
2019-11-18 10:26:05 +13:00
Brenda Wallace
4f8830676e Swagger docs 2019-11-18 10:15:06 +13:00
Brenda Wallace
818a980f6d Move jsonapi resources files 2019-11-18 10:11:53 +13:00
Brenda Wallace
df5b0499e4 Update spec for api resource 2019-11-16 13:05:40 +13:00
Brenda Wallace
535ddcdcff Added plantings to places map 2019-11-16 12:16:18 +13:00
Miles Gould
ba1512a85a Delete duplicate percentage_grown attribute
Fixes #2031
2019-07-05 10:49:29 +00:00
Brenda Wallace
62f2fa134d Set planting.finished as a boolean 2019-03-20 15:01:33 +13:00
Brenda Wallace
d07c97b6a6 Add filters for the members api 2019-03-20 15:01:33 +13:00
Brenda Wallace
572af9d135 Merge branch 'dev' into photos/seeds 2019-02-09 17:00:58 +13:00
Brenda Wallace
9a4f1058e1 Adding more attributes and filters to the api 2019-02-09 08:43:59 +13:00
Brenda Wallace
6167af700d Rubocop lint tidy 2019-02-05 12:37:09 +13:00
Brenda Wallace
18ab0c8697 Add photos back into crop resources 2019-02-05 10:22:58 +13:00
Brenda Wallace
dbf707d80e Crops have seeds 2019-02-04 20:32:23 +13:00
Brenda Wallace
c4a1806a87 Request spec for photos api 2017-11-17 22:01:37 +13:00
Brenda Wallace
5fec826c41 Add more attributes to crops 2017-11-13 19:19:18 +13:00
Brenda Wallace
d8f5876518 Added predictions to planting api, and added specs 2017-11-13 19:19:18 +13:00
Brenda Wallace
c9d5c42814 Plantings have many harvests 2017-11-13 19:19:18 +13:00
Brenda Wallace
b60f47f502 Add more relationships to members on the api 2017-11-13 19:19:18 +13:00
Brenda Wallace
41110f96d1 Put immutable on every resource 2017-11-13 19:19:18 +13:00
Brenda Wallace
33822abf93 crops have harvests 2017-11-13 19:19:18 +13:00
Brenda Wallace
5877da95a6 Added a base resource, a little more DRY 2017-11-13 19:19:18 +13:00
Brenda Wallace
d07fd1a277 Added seeds and harvests to api, and tidied up resources 2017-11-13 19:19:18 +13:00
Brenda Wallace
c96695258b Basic read only api 2017-11-13 19:19:18 +13:00