todod/altsrc/main.cr
2019-12-13 05:47:45 +01:00

29 lines
551 B
Crystal

require "option_parser"
require "uuid"
require "uuid/json"
require "dodb"
class TodoD::Storage
getter root : String
getter lists : DODB::DataBase(String, List)
getter tasks : DODB::DataBase(String, Task)
getter lists_per_user : DODB::Tags(List)
def initialize(@root)
@lists = DODB::DataBase(String, List).new("#{@root}/lists")
@lists_per_user = @lists.new_tags "user", &.users_with_read_permissions.map(&.to_s)
@tasks = DODB::DataBase(String, Task).new("#{@root}/tasks")
end
def new_list(list)
@lists[list.id] = list
end
end