Implementatino fixes

This commit is contained in:
2016-06-02 11:13:56 +02:00
parent 54e0dd1a3e
commit 1acd200408
11 changed files with 38 additions and 34 deletions
+2 -7
View File
@@ -11,11 +11,6 @@ gem 'exception_notification'
gem 'slim-rails' gem 'slim-rails'
# Gems used only for assets and not required # Gems used only for assets and not required
# in production environments by default.
#gem 'active_model_serializers', '~> 0.10.0.rc2' # explicitly outside assets
#gem 'active_model_serializers', github: 'rails-api/active_model_serializers' # explicitly outside assets
#gem 'active_model_serializers', '0.9.3' # explicitly outside assets
#gem 'jsonapi-serializers', github: 'bterkuile/jsonapi-serializers'
#gem 'jsonapi-serializers', path: '/home/benjamin/development/rails/components/jsonapi-serializers' #gem 'jsonapi-serializers', path: '/home/benjamin/development/rails/components/jsonapi-serializers'
gem 'jsonapi-serializers', github: 'bterkuile/jsonapi-serializers' gem 'jsonapi-serializers', github: 'bterkuile/jsonapi-serializers'
group :assets do group :assets do
@@ -62,8 +57,8 @@ end
# gem 'couchbase-structures', github: 'bterkuile/couchbase-structures' # gem 'couchbase-structures', github: 'bterkuile/couchbase-structures'
gem 'couch_potato', '~> 1.4.0' #, github: 'bterkuile/couch_potato' gem 'couch_potato', '~> 1.4.0' #, github: 'bterkuile/couch_potato'
gem 'simply_stored', path: '~/development/rails/components/simply_stored' #, github: 'bterkuile/simply_stored' #gem 'simply_stored', path: '~/development/rails/components/simply_stored' #, github: 'bterkuile/simply_stored'
#gem 'simply_stored', github: 'bterkuile/simply_stored' gem 'simply_stored', github: 'bterkuile/simply_stored'
#gem 'orm_adapter', github: 'bterkuile/orm_adapter' #gem 'orm_adapter', github: 'bterkuile/orm_adapter'
gem 'devise' #, github: 'plataformatec/devise', branch: 'lm-rails-4-2' #, '3.1.0' #, '2.0.4' gem 'devise' #, github: 'plataformatec/devise', branch: 'lm-rails-4-2' #, '3.1.0' #, '2.0.4'
gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored' gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored'
+4 -3
View File
@@ -28,12 +28,13 @@ GIT
jsonapi-serializers (0.2.6) jsonapi-serializers (0.2.6)
activesupport activesupport
PATH GIT
remote: ~/development/rails/components/simply_stored remote: git://github.com/bterkuile/simply_stored.git
revision: 91652b8228c368b12acb80c77439a35059ecaaa8
specs: specs:
simply_stored (1.0.0) simply_stored (1.0.0)
activesupport activesupport
couch_potato (>= 0.2.15) couch_potato (>= 1.4.0)
rest-client (>= 1.4.2) rest-client (>= 1.4.2)
GEM GEM
+1
View File
@@ -29,6 +29,7 @@ class Order
view :by_supplier_id_and_id, key: [:supplier_id, :_id] # Do not comment me out this is for security, TODO: make the security server side for speed and space optimization view :by_supplier_id_and_id, key: [:supplier_id, :_id] # Do not comment me out this is for security, TODO: make the security server side for speed and space optimization
view :by_supplier_id_and_state, key: [:supplier_id, :state], reduce_function: '_sum' view :by_supplier_id_and_state, key: [:supplier_id, :state], reduce_function: '_sum'
view :by_list_id, key: :list_id
def self.for_supplier(supplier, options = {}) def self.for_supplier(supplier, options = {})
total_entries = database.view(by_supplier_id_and_id({startkey: ["#{supplier.id}\u9999"], endkey: [supplier.id], include_docs: false, reduce: true, descending: true})) total_entries = database.view(by_supplier_id_and_id({startkey: ["#{supplier.id}\u9999"], endkey: [supplier.id], include_docs: false, reduce: true, descending: true}))
+1
View File
@@ -12,6 +12,7 @@ class SectionArea
belongs_to :supplier belongs_to :supplier
view :by_supplier_id, key: :supplier_id view :by_supplier_id, key: :supplier_id
view :by_section_id, key: :section_id
def self.for_supplier(supplier) def self.for_supplier(supplier)
find_all_by_supplier_id(supplier.id) find_all_by_supplier_id(supplier.id)
+1
View File
@@ -10,6 +10,7 @@ class SectionElement
belongs_to :svg_element belongs_to :svg_element
view :by_supplier_id, key: :supplier_id view :by_supplier_id, key: :supplier_id
view :by_section_id, key: :section_id
def self.for_supplier(supplier) def self.for_supplier(supplier)
find_all_by_supplier_id(supplier.id) find_all_by_supplier_id(supplier.id)
+1
View File
@@ -22,6 +22,7 @@ class Table
validates :number, numericality: true #{greater_than: 0} validates :number, numericality: true #{greater_than: 0}
view :by_supplier_id_and_id, key: [:supplier_id, :_id] view :by_supplier_id_and_id, key: [:supplier_id, :_id]
view :by_supplier_id_and_number, key: [:supplier_id, :number] view :by_supplier_id_and_number, key: [:supplier_id, :number]
view :by_section_id, key: :section_id
#validates_uniqueness_of :number #validates_uniqueness_of :number
view :by_number, key: :number view :by_number, key: :number
@@ -0,0 +1,4 @@
class Employees::EmployeeSerializer
include Qwaiter::EmployeeBaseSerializer
attributes :name, :email, :manager, :active, :color
end
@@ -1,6 +1,6 @@
class Employees::EmployeeShiftSerializer class Employees::EmployeeShiftSerializer
include Qwaiter::EmployeeBaseSerializer include Qwaiter::EmployeeBaseSerializer
attributes :start_from, :end_on, :description attributes :start_from, :end_on, :description
has_one :supplier has_one :supplier, serializer: Employees::SupplierSerializer
has_one :employee has_one :employee, serializer: Employees::EmployeeSerializer
end end
+8 -8
View File
@@ -11,15 +11,15 @@ module Qwaiter::EmployeeBaseSerializer
nil nil
end end
def format_name(attribute_name) #def format_name(attribute_name)
#attribute_name.to_s.dasherize # #attribute_name.to_s.dasherize
attribute_name.to_s # attribute_name.to_s
end #end
def unformat_name(attribute_name) #def unformat_name(attribute_name)
#attribute_name.to_s.underscore # #attribute_name.to_s.underscore
attribute_name.to_s # attribute_name.to_s
end #end
#alias_method :default_relationship_related_link, :relationship_related_link #alias_method :default_relationship_related_link, :relationship_related_link
def relationship_related_link(attribute_name) def relationship_related_link(attribute_name)
+6 -6
View File
@@ -11,13 +11,13 @@ module Qwaiter::SupplierBaseSerializer
nil nil
end end
def format_name(attribute_name) #def format_name(attribute_name)
attribute_name.to_s.dasherize # attribute_name.to_s.dasherize
end #end
def unformat_name(attribute_name) #def unformat_name(attribute_name)
attribute_name.to_s.underscore # attribute_name.to_s.underscore
end #end
#alias_method :default_relationship_related_link, :relationship_related_link #alias_method :default_relationship_related_link, :relationship_related_link
def relationship_related_link(attribute_name) def relationship_related_link(attribute_name)
+8 -8
View File
@@ -12,15 +12,15 @@ module Qwaiter::UserBaseSerializer
nil nil
end end
def format_name(attribute_name) #def format_name(attribute_name)
#attribute_name.to_s.dasherize # #attribute_name.to_s.dasherize
attribute_name.to_s # attribute_name.to_s
end #end
def unformat_name(attribute_name) #def unformat_name(attribute_name)
#attribute_name.to_s.underscore # #attribute_name.to_s.underscore
attribute_name.to_s # attribute_name.to_s
end #end
#alias_method :default_relationship_related_link, :relationship_related_link #alias_method :default_relationship_related_link, :relationship_related_link
def relationship_related_link(attribute_name) def relationship_related_link(attribute_name)