Compare commits

...

2 Commits

1 changed files with 13 additions and 5 deletions

View File

@ -135,16 +135,24 @@ defmodule FrenzyWeb.Fervor.ItemsController do
|> Repo.all()
last_sync =
Map.get(params, "last_sync")
|> case do
s when is_binary(s) -> Timex.parse!(s, "{ISO:Extended:Z}")
_ -> nil
with s when is_binary(s) <- Map.get(params, "last_sync"),
{:ok, datetime} <- Timex.parse(s) do
datetime
else
_ ->
nil
end
{deleted_ids, upserted} =
case last_sync do
nil ->
items = Repo.all(from i in Item, where: not i.tombstone and i.feed_id in ^feed_ids)
items =
Item
|> where([i], not i.tombstone and i.feed_id in ^feed_ids)
|> order_by([i], desc: i.inserted_at)
|> limit(1000)
|> Repo.all()
{[], items}
_ ->