Most of the API annotations are directly converted. The changes in meaning are:
- Parameters "in body" is not supported anymore. These are changed to "in query" or to a request body (depending on the code).
Mostly using autowiring to inject deps.
The only tricky part was for import because all producer use the same class and have a different alias. So we must write them down in the service definition, autowiring doesn't work in that case.
Usually:
- if a controller has a constructor, it means injected services are at least re-used once in actions
- otherwise, service are injected per action
Looks like parameter for the `->dispatch(` have been flipped (event first then event name).
Define events should now extends `Symfony\Contracts\EventDispatcher\Event`
- disable autowiring for Event (because the Entry entity was injected)
- rename `getClient()` for test to `getTestClient()` to avoid error while overriding (from `BrowserKitAssertionsTrait`)
I've noticed that the endpoint `/api/entries/exists` used by the "Sweep
articles" feature on the Android app failed almost all the time on my
instance.
After checking the corresponding method I found that
`EntryRestController::getEntriesExistsAction()` could be improved.
Here is the former way the method worked:
```
for id in [list of ids]
get full entry by id
if null
get full entry by given id
return array of ids or array of hashes
```
With this behavior on my instance I could expect up to 13k SQL requests
when sweeping articles from the Android app. Morever the repository
fetches all fields (content included) while the method only returns ids
or hashes.
The new behavior is described as follow:
```
get ids, hashes by [list of ids]
merge with provided [list of ids] // this part will complete the final
// array with not found ids
return array of ids or array of hashes
```
In my case this change reduces the number of SQL requests to only 135
(_considering one request for 50 articles_)
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Simplify the logic from #3158 by hashing all the urls from the request,
and only doing a search by hash. This allows to get performance benefits
from the new indexed hash column even when using older clients that do
not hash the URL in the request.
Fixes: #3158, #3919
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
detail=metadata will nullify the content field of entries in order to
make smaller responses.
detail=full keeps the former behavior, it sends the content of entries.
It's the default, for backward compatibility.
Fixes#2817
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
The expect parameter enables an application to request the whole entry
or only the id when requesting its deletion.
`expects` defaults to `entry` to prevent any API breakage.
Fixes#3711
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Add a new helper to set a default title when it's empty:
1/ use basename part of entry's path, if any
2/ or use domain name
Fixes#2053
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This date is used to sort starred entries.
Can not use Entry::timestamps method otherwise starred_at will be updated each time entry is updated.
Add an updateStar method into Entry class
A migration script has been added in order to set starred_at field.
When exporting an entry, use the domain name as author name for epub,
mobi and pdf formats, instead of 'wallabag'.
Change the author from array to string, because for now, there is always
only one author.
The PATCH method for the entry should only update what user sent to us and not the whole entry as it was before.
Also, sending tags when patching an entry will now remove all current tags & assocatied new ones.