* getting started: model setup * basic controller action & spec * somewhat working click events * pick up on impressions * there was an attempt at batching without duplicates * (better) bulk upsert service * fix specs? * touch up feed events JS * end-to-end specs?? * workers wip * fix failing user delete spec
26 lines
533 B
Ruby
26 lines
533 B
Ruby
class FeedEventsController < ApplicationMetalController
|
|
include ActionController::Head
|
|
|
|
FEED_EVENT_ALLOWED_PARAMS = %i[
|
|
article_id
|
|
article_position
|
|
category
|
|
context_type
|
|
].freeze
|
|
|
|
def create
|
|
if session_current_user_id
|
|
FeedEvents::BulkUpsert.call(feed_events_params)
|
|
end
|
|
|
|
head :ok
|
|
end
|
|
|
|
private
|
|
|
|
def feed_events_params
|
|
@feed_events_params ||= params[:feed_events].map do |event|
|
|
event.slice(*FEED_EVENT_ALLOWED_PARAMS).merge(user_id: session_current_user_id)
|
|
end
|
|
end
|
|
end
|