36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'app/services/lesli_audit/account/activity_services.rb', line 36
def index
search_string = nil
activities = current_user.account.activities
activities = activities.select(
:id,
:title,
:description,
:system_process,
:system_module,
"payload ->'to'->>0 as send_to",
Date2.new.date_time.db_timestamps()
)
unless search_string.blank?
activities = activities.where(["
system_module like :search_string
or system_process like :search_string
or description like :search_string
or title like :search_string
or payload->'to'->>0 like :search_string",
].join(" or "), {
search_string: "%#{search_string}%"
})
end
activities.page(query[:pagination][:page])
.per(query[:pagination][:perPage])
.order(created_at: :desc)
end
|