const express = require('express');
const { enqueueEmail } = require('./emailQueue');
const router = express.Router();
router.post('/users/:id/welcome-email', async (req, res, next) => {
module ConnectionHealth
extend ActiveSupport::Concern
def with_fresh_connection
conn = ActiveRecord::Base.connection
conn.verify! # pings and reconnects if the socket is dead
class ReportsController < ApplicationController
def create
@report = current_user.reports.create!(
title: report_params[:title],
status: :pending,
progress: 0
module DefensiveDeserialization
extend ActiveSupport::Concern
MissingRecord = Struct.new(:gid) do
def missing?
true
module Notifications
class RecipientSerializer < ActiveJob::Serializers::ObjectSerializer
def serialize?(argument)
argument.is_a?(Notifications::Recipient)
end
class Order < ApplicationRecord
include TransactionalEnqueue
belongs_to :customer
has_many :line_items, dependent: :destroy
module DomainEvents
class Registry
def initialize
@subscribers = Hash.new { |h, k| h[k] = [] }
end
class DownloadsController < ApplicationController
before_action :authenticate_user!
def show
report = current_account.reports.find(params[:report_id])
authorize! :download, report
package scheduler
import (
"context"
"log"
"sync"
cleanup_expired_sessions:
cron: '0 2 * * *' # Daily at 2 AM
class: CleanupExpiredSessionsWorker
queue: low
description: Remove expired sessions from Redis
class LeaderboardCache
TOP_KEY = "leaderboard:top".freeze
STATS_KEY = "leaderboard:stats".freeze
def top_players
Rails.cache.fetch(TOP_KEY, expires_in: 5.minutes, race_condition_ttl: 15.seconds) do
class CreateOutboxEvents < ActiveRecord::Migration[7.1]
def change
create_table :outbox_events do |t|
t.string :event_type, null: false
t.string :aggregate_type, null: false
t.string :aggregate_id, null: false