Skip to content

Commit

Permalink
CDC #27 - Adding "start_date" and "end_date" fuzzy dates to events
Browse files Browse the repository at this point in the history
  • Loading branch information
dleadbetter committed Apr 17, 2024
1 parent ef17142 commit 5842018
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'faker', '~> 3.2.1'
# gem 'fuzzy_dates', git: 'https://github.com/performant-software/fuzzy-dates.git', tag: 'v0.1.0'
gem 'fuzzy_dates', path: '../fuzzy-dates'
gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.2'
gem 'resource_api', git: 'https://github.com/performant-software/resource-api.git', tag: 'v0.5.7'
gem 'user_defined_fields', git: 'https://github.com/performant-software/user-defined-fields.git', tag: 'v0.1.8'
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ GIT
rails (>= 6.0.3.2, < 8)
resource_api

PATH
remote: ../fuzzy-dates
specs:
fuzzy_dates (0.1.0)
rails (>= 6.0.3.2, < 8)
resource_api

PATH
remote: .
specs:
core_data_connector (0.1.0)
activerecord-postgis-adapter (~> 8.0)
faker
fuzzy_dates
jwt (~> 2.7.1)
jwt_auth
rack-cors (~> 2.0.1)
Expand Down Expand Up @@ -244,6 +252,7 @@ PLATFORMS
DEPENDENCIES
core_data_connector!
faker (~> 3.2.1)
fuzzy_dates!
jwt_auth!
resource_api!
sqlite3
Expand Down
6 changes: 5 additions & 1 deletion app/models/core_data_connector/event.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module CoreDataConnector
class Event < ApplicationRecord
# Includes
include FuzzyDates::FuzzyDateable
include Identifiable
include Ownable
include Relateable
include UserDefinedFields::FieldableSerializer
include UserDefinedFields::Fieldable

# Fuzzy dates
has_fuzzy_dates :start_date, :end_date
end
end
1 change: 1 addition & 0 deletions app/policies/core_data_connector/event_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def initialize(current_user, event)
# Allowed create/update attributes.
def permitted_attributes
[ *ownable_attributes,
*Event.permitted_params,
:name,
:description,
user_defined: {}
Expand Down
4 changes: 2 additions & 2 deletions app/serializers/core_data_connector/events_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class EventsSerializer < BaseSerializer
include OwnableSerializer
include UserDefinedFields::FieldableSerializer

index_attributes :id, :name, :description
show_attributes :id, :name, :description
index_attributes :id, :name, :description, start_date: FuzzyDates::FuzzyDateSerializer, end_date: FuzzyDates::FuzzyDateSerializer
show_attributes :id, :name, :description, start_date: FuzzyDates::FuzzyDateSerializer, end_date: FuzzyDates::FuzzyDateSerializer
end
end
1 change: 1 addition & 0 deletions core_data_connector.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'faker'
spec.add_dependency 'rails', '>= 6.0.3.2', '< 8'
spec.add_dependency 'activerecord-postgis-adapter', '~> 8.0'
spec.add_dependency 'fuzzy_dates'
spec.add_dependency 'jwt', '~> 2.7.1'
spec.add_dependency 'jwt_auth'
spec.add_dependency 'rack-cors', '~> 2.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class InstallGenerator < Rails::Generators::Base
desc "CoreDataConnector migrations"
def copy_initializer
rake 'core_data_connector:install:migrations'
rake 'fuzzy_dates:install:migrations'
rake "triple_eye_effable:install:migrations"
rake "user_defined_fields:install:migrations"
end
Expand Down

0 comments on commit 5842018

Please sign in to comment.