feat(waitlist): optional event waitlist with FIFO promote.
CI / test (push) Successful in 7m12s
CI / deploy-ift (push) Successful in 2m44s
CI / e2e-ift (push) Successful in 1m28s
CI / deploy-stage (push) Successful in 2m3s
CI / e2e-stage (push) Successful in 1m24s

Commercial calendars opt in via settings.waitlist_enabled; join when full;
auto-promote on cancel/decline/expire with email and in-app notify.

Refs EventHub/EventHubBack#72
This commit is contained in:
2026-08-14 21:44:42 +03:00
parent 29111cd514
commit fb8869fa86
15 changed files with 730 additions and 9 deletions
@@ -0,0 +1,38 @@
%% @doc Create waitlist_entry table and indexes (Back#72).
-module('20260814193000_waitlist_entry').
-export([up/0, down/0]).
-include("records.hrl").
up() ->
ensure_table(waitlist_entry, record_info(fields, waitlist_entry)),
ensure_index(waitlist_entry, event_id),
ensure_index(waitlist_entry, user_id),
ensure_index(waitlist_entry, status),
ok.
down() ->
_ = mnesia:delete_table(waitlist_entry),
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.