Skip to content

Commit

Permalink
Merge pull request #383 from ioki-mobility/add-task-list-service-time
Browse files Browse the repository at this point in the history
Add `service_starts_at` and `service_ends_at` to TaskList model
  • Loading branch information
tom-ioki committed May 16, 2024
2 parents 8bbad0f + ee01455 commit 144757c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ioki/model/operator/task_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ class TaskList < Base
omit_if_nil_on: [:create, :update],
type: :boolean

attribute :service_ends_at,
on: [:create, :read, :update],
type: :date_time

attribute :service_starts_at,
on: [:create, :read, :update],
type: :date_time

attribute :start_location,
on: :read,
type: :object,
Expand Down
2 changes: 2 additions & 0 deletions lib/ioki/model/platform/task_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class TaskList < Base
attribute :planned_starts_at, on: :read, type: :date_time
attribute :prebookable, on: [:read, :create], type: :boolean
attribute :product_id, on: :read, type: :string
attribute :service_ends_at, on: [:create, :read, :update], type: :date_time
attribute :service_starts_at, on: [:create, :read, :update], type: :date_time
attribute :starts_at, on: [:create, :update], type: :date_time, unvalidated: true
attribute :start_place, on: :read, type: :object, class_name: 'Place'
attribute :start_place_id, on: [:create, :update], type: :object, class_name: 'Place', unvalidated: true
Expand Down
2 changes: 2 additions & 0 deletions spec/ioki/model/operator/task_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
it { is_expected.to define_attribute(:planned_ends_at).as(:date_time) }
it { is_expected.to define_attribute(:planned_starts_at).as(:date_time) }
it { is_expected.to define_attribute(:prebookable).as(:boolean) }
it { is_expected.to define_attribute(:service_ends_at).as(:date_time) }
it { is_expected.to define_attribute(:service_starts_at).as(:date_time) }
it { is_expected.to define_attribute(:start_location).as(:object).with(class_name: %w[Place Station]) }
it { is_expected.to define_attribute(:start_location_id).as(:string) }
it { is_expected.to define_attribute(:start_location_type).as(:string) }
Expand Down

0 comments on commit 144757c

Please sign in to comment.