fix(calendar): persist settings on PUT/POST
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:
@@ -85,6 +85,7 @@ calendar_schema() ->
|
||||
type => #{type => string, enum => [<<"personal">>, <<"commercial">>]},
|
||||
confirmation => #{type => string, enum => [<<"auto">>, <<"manual">>]},
|
||||
tags => #{type => array, items => #{type => string}},
|
||||
settings => #{type => object},
|
||||
rating_avg => #{type => number, format => float},
|
||||
rating_count => #{type => integer},
|
||||
status => #{type => string},
|
||||
@@ -102,7 +103,12 @@ calendar_update_schema() ->
|
||||
description => #{type => string},
|
||||
type => #{type => string},
|
||||
confirmation => #{type => string},
|
||||
tags => #{type => array, items => #{type => string}}
|
||||
tags => #{type => array, items => #{type => string}},
|
||||
short_name => #{type => string},
|
||||
category => #{type => string},
|
||||
color => #{type => string},
|
||||
image_url => #{type => string},
|
||||
settings => #{type => object, nullable => true}
|
||||
}
|
||||
}.
|
||||
|
||||
@@ -195,4 +201,9 @@ convert_field({<<"confirmation">>, #{<<"timeout">> := N}}) when is_integer(N), N
|
||||
{confirmation, {timeout, N}};
|
||||
convert_field({<<"confirmation">>, Val}) -> {confirmation, Val};
|
||||
convert_field({<<"tags">>, Val}) -> {tags, Val};
|
||||
convert_field({<<"short_name">>, Val}) -> {short_name, Val};
|
||||
convert_field({<<"category">>, Val}) -> {category, Val};
|
||||
convert_field({<<"color">>, Val}) -> {color, Val};
|
||||
convert_field({<<"image_url">>, Val}) -> {image_url, Val};
|
||||
convert_field({<<"settings">>, Val}) when is_map(Val) -> {settings, Val};
|
||||
convert_field(Other) -> Other.
|
||||
Reference in New Issue
Block a user