feat(booking): studio journal and instance inbox. Refs EventHub/EventHubFront#60
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
-export([init/2]).
|
||||
-export([trails/0]).
|
||||
-export([item_to_json/1]).
|
||||
|
||||
-include("records.hrl").
|
||||
|
||||
@@ -76,7 +77,7 @@ list_requests(Req) ->
|
||||
{ok, UserId, Req1} ->
|
||||
case logic_booking:list_user_booking_requests(UserId) of
|
||||
{ok, Items} ->
|
||||
Response = [request_to_json(I) || I <- Items],
|
||||
Response = [item_to_json(I) || I <- Items],
|
||||
handler_utils:send_json(Req1, 200, Response);
|
||||
{error, _} ->
|
||||
handler_utils:send_error(Req1, 500, <<"Internal server error">>)
|
||||
@@ -85,8 +86,8 @@ list_requests(Req) ->
|
||||
handler_utils:send_error(Req1, Code, Message)
|
||||
end.
|
||||
|
||||
-spec request_to_json({#booking{}, #event{}, owner | specialist}) -> map().
|
||||
request_to_json({Booking, Event, Role}) ->
|
||||
-spec item_to_json({#booking{}, #event{}, owner | specialist}) -> map().
|
||||
item_to_json({Booking, Event, Role}) ->
|
||||
CalendarTitle = case core_calendar:get_by_id(Event#event.calendar_id) of
|
||||
{ok, Cal} -> Cal#calendar.title;
|
||||
_ -> null
|
||||
|
||||
Reference in New Issue
Block a user