Implemented ts_api:get_user/2, ts_api:put_user/1, and ts_api:post_user/1.
Created a utility function for OK results, ts_api:make_json_200/2 Created ts_common:new/1 and ts_common:update/1 to generalize record creation and update. Refactored ts_timeline:new/1 and ts_timeline:update/1 to use the ts_common functions. Implemented ts_json:record_to_ejson/1 and ts_json:ejson_to_record/1 for ts_user records. Implemented ts_user module.
This commit is contained in:
@ -42,7 +42,7 @@ when is_integer(Start) and is_integer(Length) ->
|
||||
MatchHead = #ts_entry{ref = {Username, Timeline, '_'}, _='_'},
|
||||
|
||||
% select all records that match
|
||||
mnesia:select(ts_entry, [{MatchHead, [], ['$_']}]
|
||||
mnesia:select(ts_entry, [{MatchHead, [], ['$_']}])
|
||||
end),
|
||||
|
||||
% sort
|
||||
@ -69,7 +69,7 @@ list({Username, Timeline}, StartDateTime, EndDateTime, OrderFun) ->
|
||||
EndGuard = {'<', '$1', EndSeconds},
|
||||
|
||||
mnesia:select(ts_entry, [{MatchHead, [StartGuard, EndGuard], ['$_']}])
|
||||
end,
|
||||
end),
|
||||
|
||||
% sort
|
||||
lists:sort(OrderFun, Entries).
|
||||
|
Reference in New Issue
Block a user