Compare commits
2 Commits
0e90ee527c
...
52c6f1ff6c
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 52c6f1ff6c | |
Shadowfacts | 3129142274 |
|
@ -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}
|
||||
|
||||
_ ->
|
||||
|
|
Loading…
Reference in New Issue