5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/sku_translation.rb', line 5
def where(
product_id:,
limit: 10,
search_value: '',
offset: 0,
column_name: 'sku_code',
column_direction: 'asc',
groupping: ''
)
raw_data = ActiveRecord::Base.execute_procedure(
'pr_get_sku_translation_by_page_kendo',
product_id,
limit,
search_value,
offset,
column_name,
column_direction,
groupping
)
data = raw_data.map do |product|
product.select { |key, _| fields.include?(key) }
end
metadata = {
total: raw_data.length > 0 ? raw_data.first['TotalRecords'] : 0,
limit: limit,
offset: offset
}
{
data: data,
metadata: metadata
}
end
|