Additional parts of the API, DB layer.
Implemented additional API functions: * dispatch_timeline/4 * dispatch_event_by_id/4 * get_timeline/3 * put_timeline/3 * post_timeline/3 * make_json_404/2, make_json_405/2, make_json_500/1 Implemented ts_timeline:lookup/2 Implemented ts_entry:lookup/2
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
-module(ts_entry).
|
||||
-export([create_table/1, new/1, update/1, list/3]).
|
||||
-export([create_table/1, new/1, update/1, lookup/3, list/3]).
|
||||
|
||||
-include("ts_db_records.hrl").
|
||||
-include_lib("stdlib/include/qlc.hrl").
|
||||
@ -28,6 +28,12 @@ update(ER = #ts_entry()) ->
|
||||
[_Record] -> mnesia:dirty_write(ER)
|
||||
end.
|
||||
|
||||
lookup(Username, TimelineId, EntryId) ->
|
||||
case mnesia:dirty_read(ts_entry, {Username, TimelineId, EntryId}) of
|
||||
[] -> no_record;
|
||||
[Entry] -> Entry
|
||||
end.
|
||||
|
||||
list({Username, Timeline}, Start, Length)
|
||||
when is_integer(Start) and is_integer(Length) ->
|
||||
ts_common:list(
|
||||
|
Reference in New Issue
Block a user