forked from mirrors/akkoma
clean sql query
This commit is contained in:
parent
ff6c727739
commit
ddbfc995ac
2 changed files with 1 additions and 3 deletions
|
@ -56,7 +56,7 @@ defmodule Pleroma.Marker do
|
||||||
|> Multi.insert(
|
|> Multi.insert(
|
||||||
:marker,
|
:marker,
|
||||||
fn %{counters: attrs} ->
|
fn %{counters: attrs} ->
|
||||||
Marker
|
%Marker{timeline: "notifications", user_id: user.id}
|
||||||
|> struct(attrs)
|
|> struct(attrs)
|
||||||
|> Ecto.Changeset.change()
|
|> Ecto.Changeset.change()
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -41,8 +41,6 @@ defmodule Pleroma.Notification do
|
||||||
from(q in Pleroma.Notification,
|
from(q in Pleroma.Notification,
|
||||||
where: q.user_id == ^user.id,
|
where: q.user_id == ^user.id,
|
||||||
select: %{
|
select: %{
|
||||||
timeline: "notifications",
|
|
||||||
user_id: type(^user.id, :string),
|
|
||||||
unread_count: fragment("SUM( CASE WHEN seen = false THEN 1 ELSE 0 END )"),
|
unread_count: fragment("SUM( CASE WHEN seen = false THEN 1 ELSE 0 END )"),
|
||||||
last_read_id:
|
last_read_id:
|
||||||
type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string)
|
type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string)
|
||||||
|
|
Loading…
Reference in a new issue