feat(notify): Web Push subscriptions and email/push prefs.
CI / test (push) Successful in 7m43s
CI / deploy-ift (push) Successful in 3m33s
CI / e2e-ift (push) Successful in 1m28s
CI / deploy-stage (push) Failing after 3m40s
CI / e2e-stage (push) Has been skipped

Prefs in user.preferences; push_subscription table; VAPID send on
reminder/waitlist. Refs EventHub/EventHubBack#75
This commit is contained in:
2026-08-15 20:19:44 +03:00
parent e86d603f30
commit 12274f9ed0
15 changed files with 729 additions and 9 deletions
@@ -0,0 +1,37 @@
%% @doc Create push_subscription table (Back#75).
-module('20260815200000_push_subscription').
-export([up/0, down/0]).
-include("records.hrl").
up() ->
ensure_table(push_subscription, record_info(fields, push_subscription)),
ensure_index(push_subscription, user_id),
ensure_index(push_subscription, endpoint),
ok.
down() ->
_ = mnesia:delete_table(push_subscription),
ok.
ensure_table(Table, Attrs) ->
case lists:member(Table, mnesia:system_info(tables)) of
true ->
ok;
false ->
case mnesia:create_table(Table, [{disc_copies, [node()]}, {attributes, Attrs}]) of
{atomic, ok} -> ok;
{aborted, {already_exists, Table}} -> ok;
{aborted, Reason} -> error({create_table_failed, Table, Reason})
end
end.
ensure_index(Table, Attr) ->
case mnesia:add_table_index(Table, Attr) of
{atomic, ok} -> ok;
{aborted, {already_exists, Table, _Pos}} -> ok;
{aborted, {already_exists, Table, Attr}} -> ok;
{aborted, {already_exists, _}} -> ok;
{aborted, Reason} -> error({add_index_failed, Table, Attr, Reason})
end.