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:
Jonathan Bernard
2011-01-30 08:28:56 -06:00
parent b690326cf4
commit 309d6915fc
7 changed files with 240 additions and 20 deletions

View File

@ -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(