Add editable pages

This commit is contained in:
2023-11-18 11:01:14 +11:00
parent 484259fab1
commit 53434423fd
25 changed files with 369 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
require "time_math"
module Admin
module Repos
class PageRepo < Adamantium::Repo[:pages]
commands :create, update: :by_pk
def list
pages
.order(Sequel.lit("published_at desc"))
.to_a
end
def find(slug:)
pages.where(slug: slug).one!
end
def delete(slug:)
pages.where(slug: slug).delete
end
def publish(slug:)
pages.where(slug: slug).update(published_at: Time.now)
end
def archive(slug:)
pages.where(slug: slug).update(published_at: nil)
end
end
end
end