Commit Graph

48 Commits

Author SHA1 Message Date
Linus Kardell cd7ec988f2 Fix getId() on null in deleteConflictingEpisodeAction
Previously, it would take the guid and try to search for that in the
episode URL column, which may not find a match (or possibly even find
the wrong match).

testDoNotFailToUpdateEpisodeActionByGuidIfThereIsAnotherWithTheSameValueForEpisodeUrl
didn't catch this issue because it used the same value for episode and
guid when updating at line 84, so fix that as well. And for good
measure, give the save actions different position values, so the asserts
actually check that the saves have succeeded and they found the right
episode.
2024-01-12 20:43:01 +01:00
thrillfall e8bdb3d345 this exception will not be thrown anymore 2023-02-24 20:54:19 +01:00
thrillfall bf8fee14e3 delete conflicting episode action if current episode actions updates to same episode url 2023-02-24 20:48:53 +01:00
thrillfall a1893061ce fix #109 search for episode action by guid only (retry with episode url if nothing found) thus avoid multiple results 2023-02-24 17:11:59 +01:00
Patrizio Bekerle 4a787fd100 Make result nullable, because null can be returned 2023-02-24 12:28:21 +01:00
kalle (jag) 3a84b2506b Apply suggestions from code review
Co-authored-by: Jonathan Flueren <11487762+JonOfUs@users.noreply.github.com>
2022-10-28 09:50:44 +02:00
Kalle Fagerberg 5a52efea07 Removed trailing comma in __construct params 2022-10-28 09:50:44 +02:00
Kalle Fagerberg 4138250370 Added JsonSerializable on ActionCounts as well 2022-10-28 09:50:44 +02:00
Kalle Fagerberg a5a69fa3f7 Added image proxying/caching 2022-10-28 09:50:44 +02:00
Kalle Fagerberg 4771a52b63 Extracted PodcastData to its own endpoint 2022-10-28 09:50:44 +02:00
Kalle Fagerberg 403ead674d Changed to implement JsonSerializable 2022-10-28 09:50:44 +02:00
Kalle Fagerberg 2b82e9e9c9 Added PodcastData parsing/toArray tests 2022-10-28 09:50:44 +02:00
Kalle Fagerberg aaadcf17b6 Extracted fromArray into new function 2022-10-28 09:50:44 +02:00
Kalle Fagerberg 6b0550f14b Refactored code out to Core ns and data classes 2022-10-28 09:50:44 +02:00
thrillfall e119d41c86 do not add subscriptions that have no url (i.e. antennapod local folder subscriptions) 2021-12-09 20:55:05 +01:00
thrillfall 239b7773c2 abort updates once it fails 2021-11-03 13:51:48 +01:00
Matthias Gutjahr bac196e0b5 Throw exception if client sends invalid request data 2021-11-03 13:51:26 +01:00
Matthias Gutjahr 93bfcecf15 Revert removal of UniqueConstraintViolationException 2021-11-03 13:51:26 +01:00
Matthias Gutjahr 1d2056e025 Add check for EpisodeAction properties
- also add type hints and phpdocs
- add additional unit tests
- set integer types in EpisodeActionEntity
- correctly call static methods
- improve exception handling in EpisodeActionSaver
- remove unused method EpisodeActionWriter::purge()
2021-11-03 13:51:26 +01:00
Jonathan Flueren 77571feb40 Update tests to new upload format 2021-10-06 19:40:52 +02:00
Jonathan Flueren c6ee19a929 Ensure uppercase action in EpisodeAction upload
Background: action is lowercase in gpodder api description - gpoddersync always worked with uppercase action.
2021-10-06 19:40:52 +02:00
Jonathan Flueren d131b59348 Align episode upload format to gpodder-api
'started', 'position' and 'total' are optional and 'timestamp' is in 'Y-m-d\TH:i:s' format
2021-10-06 19:40:52 +02:00
Jonathan Flueren 3534c43976 Adjust expected DateTime format to gpodder - UTC ISO 8601 2021-10-06 19:40:52 +02:00
Jonathan Flueren 795a9253d2 Adjust EpisodeAction upload to gpodder api, remove String upload
Remove 3rd dimension of POST data by directly accessing request data - a simple EpisodeActions array has to be posted now. This way the api is closer to gpodder.
Additionally, removed EpisodeAction upload as String, so it's now incompatible with older versions
2021-10-06 19:40:52 +02:00
Jonathan Flueren 7813339a95 Allow EpisodeAction upload as array
Parsing EpisodeActions from String can lead to problems if the String is changed by only a little bits.
Additionally, the gpodder api describes the upload as Array.
Uploading EpisodeActions as String is still possible.
2021-10-06 19:40:52 +02:00
thrillfall 414ad1a024 do not show internal id in response 2021-10-06 14:08:33 +02:00
thrillfall 499d11d209 query episode actions by unix timestamp (instead of datetime object) 2021-10-06 14:06:45 +02:00
thrillfall ac1acf079b provide episode_action timestamps as UTC in api response 2021-10-06 14:06:45 +02:00
thrillfall aa024e55f8 add new timestamp database field. add migration step to convert timestamps to unix epoch 2021-10-06 14:06:45 +02:00
thrillfall fdc6a0db6d drop redundant phpdoc 2021-08-29 13:14:40 +02:00
thrillfall efa9280b91 we actively fix the guid so it is not asserting but ensuring 2021-08-29 13:14:40 +02:00
thrillfall ff4798f6da do not null EpisodeAction.guid when processing request without guid 2021-08-29 13:14:40 +02:00
thrillfall 3a3038711f make retrievel episode actions without guid more explanatory 2021-08-29 13:14:40 +02:00
thrillfall 352802ca69 update existing episode actions with guid 2021-08-29 13:14:40 +02:00
thrillfall 850dfd5eb4 add guid to episode action and make it findable by it 2021-08-29 13:14:40 +02:00
thrillfall ba0d4f4357 parse optional guid from EpisodeAction request 2021-08-29 13:14:40 +02:00
thrillfall 20a647906a do not pass same data twice 2021-08-27 12:51:29 +02:00
Jonathan Flueren e6637a0201 Use foreach for episode action strings, update variable names 2021-08-24 22:31:24 +02:00
Jonathan Flueren cd17ad5079 Increase code quality, use explode instead of strpos/substr
Makes code phpdoc conform and changes to a better readable EpisodeActions parsing.
2021-08-24 22:31:24 +02:00
Jonathan Flueren 48b78669e6 Enable processing of multiple EpisodeActions
EpisodeAction/create now can deal with multiple EpisodeActions inside a single EpisodeAction string, they will be processed one after another.
For this EpisodeActionReader->fromString() now returns an array of EpisodeActions.
2021-08-24 22:31:24 +02:00
thrillfall 0f6ab73cf2 narrow catch to nextcloud dbal exceptions 2021-08-22 23:23:02 +02:00
thrillfall ebe4757b5e drop phpdoc 2021-08-22 22:57:33 +02:00
thrillfall a29aa2ccd5 extract parsing and storing episode action to separate class 2021-08-22 22:45:34 +02:00
thrillfall 57f0691b4c nextcloud < v22.0 throws UniqueConstraintViolationException. This can be reverted after v21 reaches end of support 2021-08-21 20:20:24 +02:00
Jonathan Flueren 20920c5d84 Stop creating unnecessary log file in Nextcloud base folder
EpisodeActionReader created (or appended to) file actionreader.log in Nextcloud base folder (with index.php & occ). This concluded in a Nextcloud warning about "additional files in Nextcloud folder" in the self-check feature.
2021-08-16 14:20:21 +02:00
thrillfall 324aecd7b8 make subscription changes endpoint comply with gpodder.net api 2021-07-13 21:36:34 +02:00
thrillfall b09210655e unique key violation exception is thrown as \Exception thus we need to check the reason 2021-07-11 22:52:30 +02:00
thrillfall 72bf365285 parse EpisodeAction message from AntennaPod
persist and list with database

create episodeAction list reponse (with mocked timestamp, started and total)

create episodeActions with received values

update existing episodeActions by unique episode link

receive and store subscription changes

deal with multiple subscription changes in single request

split database into subdirectories

only return subscription changes younger then passed parameter since

parse passed timestamp

parse passed timestamp for episode_actions listing

only return list of urls for subscription changes

align list endpoint naming schema

store userId with episode actions and subscriptions

return json object on application root route
2021-06-27 13:24:17 +02:00