<commit_before>module Spree
  module Api
    module V1
      class WebinarRegistrationsController < Spree::Api::BaseController
        before_action :find_registration, only: :show
        before_action :find_registrations, only: [:index, :all]

        def all
          authorize! :all, @webinar_registrations
          respond_with(@webinars)
        end

        def index
          authorize! :all, @webinar_registrations
          respond_with(@webinars)
        end


        def show
          authorize! :show, @webinar_registration
          respond_with(@webinar)
        end


        def create
          authorize! :create, WebinarRegistration
          product = Spree::Product.find_by(id: params[:webinar_registration][:product_id])
          user = Spree::User.find_by(id: params[:webinar_registration][:user_id])
          @webinar_registration = Spree::WebinarRegistration.register!(
            user:user,
            product:product
          )
<commit_msg>404 if user or product is doesnt exist<commit_after>module Spree
  module Api
    module V1
      class WebinarRegistrationsController < Spree::Api::BaseController
        before_action :find_registration, only: :show
        before_action :find_registrations, only: [:index, :all]

        def all
          authorize! :all, @webinar_registrations
          respond_with(@webinars)
        end

        def index
          authorize! :all, @webinar_registrations
          respond_with(@webinars)
        end


        def show
          authorize! :show, @webinar_registration
          respond_with(@webinar)
        end


        def create
          authorize! :create, WebinarRegistration
          product = Spree::Product.find_by!(id: params[:webinar_registration][:product_id])
          user = Spree::User.find_by!(id: params[:webinar_registration][:user_id])
          @webinar_registration = Spree::WebinarRegistration.register!(
            user:user,
            product:product
          )

{'fraction_non_alphanumeric': 0.0827029752899647, 'fraction_numerical': 0.0025214321734745334, 'mean_word_length': 2.420689655172414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1462588', 'n_tokens_mistral': 569, 'n_tokens_neox': 561, 'n_words': 115}