struct

FruitJokes::JokeRepository

Inherits Struct < Value < Object

Constructors

new(db : DB::Database)
Source

Instance methods

count_current_month

Get the count of jokes created in the current month

Source
count_previous_month

Get the count of jokes created in the previous month

Source
create(setup : String, punchline : String, fruit : String, comedian_id : Int64) : Int64

Create a new joke

Source
delete(id : Int64) : Nil

Delete a joke

Source
find(id : Int64) : JokeDetailRow | Nil

Find a joke by ID

Source
latest(limit : Int32 = 10) : Array(JokeRecentRow)

Get the most recent jokes

Source
list(page : Int32 = 1, per_page : Int32 = 10) : Tuple(Array(JokeRow), PaginationData)

Get a paginated list of jokes with comedian names

Source
month_over_month_delta

Get the delta between current month and previous month

Source
total_count

Get the total count of jokes

Source
unique_fruits

Get all unique fruits from jokes

Source
update(id : Int64, setup : String, punchline : String, fruit : String, comedian_id : Int64) : Nil

Update an existing joke

Source

Nested types