todod/altsrc/main.cr

26 lines
511 B
Crystal

require "option_parser"
require "uuid"
require "uuid/json"
require "fs"
class TodoD::Storage
getter root : String
getter lists : FS::Hash(String, List)
getter tasks : FS::Hash(String, Task)
def initialize(@root)
@lists = FS::Hash(String, List).new("#{@root}/lists").tap do |lists|
lists.new_nn_partition "user", &.users_with_read_permissions.map(&.to_s)
end
@tasks = FS::Hash(String, Task).new("#{@root}/tasks").tap do |tasks|
end
end
def new_list(list)
@lists[list.id] = list
end
end