class List

Defined in:

todo_api/models/list.cr

Constant Summary

MAX_LISTS_PER_USER = 20

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Model

now(timezone = "UTC") now

Constructor methods inherited from class Model

new(pull : JSON::PullParser) new

Constructor Detail

def self.new(id : Int32, user_email : String, user_name : Nil | String, name : String, todos : JSON::Any, additional_users : JSON::Any, created_on : Time, updated_on : Time) #

[View source]
def self.new(user_email : String, user_name : Nil | String, name : String, todos : JSON::Any, additional_users : JSON::Any) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]
def self.new(rs : DB::ResultSet) #

[View source]

Class Method Detail

def self.all(user_email : String) : Array(List) #

Get all lists that the user has access to.


[View source]
def self.get(id : String) : List | Nil #

Get a single list by ID.


[View source]

Instance Method Detail

def additional_users : JSON::Any #

[View source]
def additional_users=(additional_users : JSON::Any) #

[View source]
def created_on : Time #

[View source]
def delete #

Delete this list.


[View source]
def has_access?(current_user_email) : Bool #

Returns wether the user has access to this list.


[View source]
def id : Int32 #

[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def save #

Upsert this list.


[View source]
def to_h(summarise_todos = false) #

Returns this list as a Hash with/without the todos (for performance).


[View source]
def todo_summary #

Returns a Hash containing a summary of the todos as statistics.


[View source]
def todos : JSON::Any #

[View source]
def todos=(todos : JSON::Any) #

[View source]
def updated_on : Time #

[View source]
def user_email : String #

[View source]
def user_name : String | Nil #

[View source]