Add trips
This commit is contained in:
@@ -46,6 +46,12 @@ module Admin
|
||||
def archive(id:)
|
||||
posts.where(id: id).update(published_at: nil)
|
||||
end
|
||||
|
||||
def created_between(start_date, end_date)
|
||||
posts
|
||||
.combine(:trips)
|
||||
.published_between(start_date, end_date)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
7
slices/admin/repos/post_trip_repo.rb
Normal file
7
slices/admin/repos/post_trip_repo.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class PostTripRepo < Adamantium::Repo[:post_trips]
|
||||
commands :create
|
||||
end
|
||||
end
|
||||
end
|
15
slices/admin/repos/trip_repo.rb
Normal file
15
slices/admin/repos/trip_repo.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module Admin
|
||||
module Repos
|
||||
class TripRepo < Adamantium::Repo[:trips]
|
||||
commands :create
|
||||
|
||||
def list
|
||||
trips.order(:start_date).to_a
|
||||
end
|
||||
|
||||
def fetch(id)
|
||||
trips.where(id: id).one
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user