This commit is contained in:
2026-05-13 22:35:24 +02:00
parent 1ae4734e81
commit c2e6466022
18 changed files with 311 additions and 317 deletions

View File

@@ -0,0 +1,17 @@
# frozen_string_literal: true
class BoardService
def initialize(repo) = @repo = repo
def boards = @repo.boards
def board(id) = @repo.boards.find { |b| b.id == id }
def messages(id, n = 30) = @repo.last(id, n)
def count(id) = @repo.count(id)
def total_count = @repo.total_count
def post(board_id, username, text)
return :empty if text.to_s.strip.empty?
@repo.append(board_id, username, text.strip[0...1000])
:ok
end
end