Move supplier full pull to being an api for the ember app and handle login and authorization a little bit better (should be even a lot better in the future)

This commit is contained in:
2020-03-03 17:11:57 -05:00
parent a7e771557d
commit 51748d5783
15 changed files with 55 additions and 22 deletions
+2
View File
@@ -5,6 +5,7 @@ class EmployeeShift
property :start_from
property :end_on
property :description
property :full_day, type: :boolean, default: false
belongs_to :supplier
belongs_to :employee
@@ -12,6 +13,7 @@ class EmployeeShift
validates :start_from, presence: true
validates :end_on, presence: true
view :by_supplier_id_and_id, key: [:supplier_id, :_id] # supplier safe find
view :for_supplier_view, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'EmployeeShift' && doc.start_from && doc.end_on){
emit([doc.supplier_id, doc.end_on], 1)