Add admin area
This commit is contained in:
11
slices/admin/repos/post_tag_repo.rb
Normal file
11
slices/admin/repos/post_tag_repo.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class PostTagRepo < Adamantium::Repo[:post_tags]
|
||||
|
||||
def delete(tag_id:)
|
||||
post_tags.where(tag_id: tag_id).delete
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
16
slices/admin/repos/tag_repo.rb
Normal file
16
slices/admin/repos/tag_repo.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class TagRepo < Adamantium::Repo[:tags]
|
||||
def list
|
||||
tags
|
||||
.combine(:posts)
|
||||
.order(Sequel.function(:lower, :label))
|
||||
.to_a
|
||||
end
|
||||
|
||||
def delete(tag_id:)
|
||||
tags.by_pk(tag_id).delete
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user