Implementatino fixes
This commit is contained in:
@@ -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_state, key: [:supplier_id, :state], reduce_function: '_sum'
|
||||
view :by_list_id, key: :list_id
|
||||
|
||||
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}))
|
||||
|
||||
@@ -12,6 +12,7 @@ class SectionArea
|
||||
belongs_to :supplier
|
||||
|
||||
view :by_supplier_id, key: :supplier_id
|
||||
view :by_section_id, key: :section_id
|
||||
|
||||
def self.for_supplier(supplier)
|
||||
find_all_by_supplier_id(supplier.id)
|
||||
|
||||
@@ -10,6 +10,7 @@ class SectionElement
|
||||
belongs_to :svg_element
|
||||
|
||||
view :by_supplier_id, key: :supplier_id
|
||||
view :by_section_id, key: :section_id
|
||||
|
||||
def self.for_supplier(supplier)
|
||||
find_all_by_supplier_id(supplier.id)
|
||||
|
||||
@@ -22,6 +22,7 @@ class Table
|
||||
validates :number, numericality: true #{greater_than: 0}
|
||||
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
|
||||
view :by_supplier_id_and_number, key: [:supplier_id, :number]
|
||||
view :by_section_id, key: :section_id
|
||||
|
||||
#validates_uniqueness_of :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
|
||||
include Qwaiter::EmployeeBaseSerializer
|
||||
attributes :start_from, :end_on, :description
|
||||
has_one :supplier
|
||||
has_one :employee
|
||||
has_one :supplier, serializer: Employees::SupplierSerializer
|
||||
has_one :employee, serializer: Employees::EmployeeSerializer
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user