fix(calendar): persist settings on PUT/POST
CI / test (push) Successful in 7m4s
CI / deploy-ift (push) Successful in 3m21s
CI / e2e-ift (push) Failing after 52s
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped

Accept calendar.settings (e.g. week_patterns) in validate_update
and convert_field; apply on create like tags. Unblocks Front#42
pattern save which previously got 200 with empty settings.
This commit is contained in:
2026-07-29 15:00:55 +03:00
parent 7e14dbcf8b
commit faf251b11d
5 changed files with 93 additions and 3 deletions
+11 -2
View File
@@ -117,12 +117,21 @@ create_calendar(Req) ->
Confirmation = parse_confirmation(maps:get(<<"confirmation">>, Decoded, <<"manual">>)),
Tags = maps:get(<<"tags">>, Decoded, []),
Type = parse_type(maps:get(<<"type">>, Decoded, <<"personal">>)),
Settings = maps:get(<<"settings">>, Decoded, undefined),
case logic_calendar:create_calendar(UserId, Title, Description, Confirmation, Type) of
{ok, Calendar} ->
Updated = case Tags of
Extra0 = case Tags of
[] -> [];
_ -> [{tags, Tags}]
end,
Extra = case Settings of
S when is_map(S) -> [{settings, S} | Extra0];
_ -> Extra0
end,
Updated = case Extra of
[] -> Calendar;
_ ->
case logic_calendar:update_calendar(UserId, Calendar#calendar.id, [{tags, Tags}]) of
case logic_calendar:update_calendar(UserId, Calendar#calendar.id, Extra) of
{ok, C2} -> C2;
_ -> Calendar
end