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() |> Repo.all()
last_sync = last_sync =
Map.get(params, "last_sync") with s when is_binary(s) <- Map.get(params, "last_sync"),
|> case do {:ok, datetime} <- Timex.parse(s) do
s when is_binary(s) -> Timex.parse!(s, "{ISO:Extended:Z}") datetime
_ -> nil else
_ ->
nil
end end
{deleted_ids, upserted} = {deleted_ids, upserted} =
case last_sync do case last_sync do
nil -> 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} {[], items}
_ -> _ ->