switch to JSONAPI for suppliers
This commit is contained in:
@@ -6,6 +6,7 @@ module Qwaiter
|
||||
autoload :Serializer
|
||||
autoload :UserBaseSerializer
|
||||
autoload :SupplierBaseSerializer
|
||||
autoload :EmployeeBaseSerializer
|
||||
autoload :Counter
|
||||
autoload :Broadcaster
|
||||
autoload :Couchbase
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
module Qwaiter::EmployeeBaseSerializer
|
||||
extend ActiveSupport::Concern
|
||||
include JSONAPI::Serializer
|
||||
included do
|
||||
class_attribute :related_link_for_attributes
|
||||
attribute :created_at
|
||||
attribute :updated_at
|
||||
end
|
||||
|
||||
def base_url
|
||||
nil
|
||||
end
|
||||
|
||||
def format_name(attribute_name)
|
||||
#attribute_name.to_s.dasherize
|
||||
attribute_name.to_s
|
||||
end
|
||||
|
||||
def unformat_name(attribute_name)
|
||||
#attribute_name.to_s.underscore
|
||||
attribute_name.to_s
|
||||
end
|
||||
|
||||
#alias_method :default_relationship_related_link, :relationship_related_link
|
||||
def relationship_related_link(attribute_name)
|
||||
super if related_link_for_attributes.include?(attribute_name)
|
||||
end
|
||||
|
||||
def relationship_self_link(attribute_name)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def attributes(*attrs)
|
||||
attrs.each do |attr|
|
||||
attribute attr
|
||||
end
|
||||
end
|
||||
|
||||
def related_link_for(*attributes)
|
||||
self.related_link_for_attributes = attributes
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user