# Gemfile
gem 'draper'
# app/decorators/user_decorator.rb
class UserDecorator < Draper::Decorator
delegate_all
import time
import threading
from collections import deque, defaultdict
class SlidingWindowLimiter:
import abc
from typing import IO
class Exporter(abc.ABC):
name: str = ""
from dataclasses import dataclass, field
from datetime import datetime, timezone
from decimal import Decimal
def _now():
import errno
import fcntl
import os
import time
import functools
import threading
def debounce(wait):
def decorator(func):
import { SetMetadata } from '@nestjs/common';
export enum Role {
User = 'user',
Editor = 'editor',
Admin = 'admin',
import { SetMetadata } from '@nestjs/common';
export const CACHEABLE_KEY = 'cacheable:options';
export type VaryDimension = 'user' | 'tenant' | 'query';
class ReportsController < ApplicationController
def monthly_sales
year = params.fetch(:year, Date.current.year).to_i
rows = Order.monthly_sales(year: year)
@report = MonthlySalesReport.new(rows, year: year)
import { Injectable, NestMiddleware, UnauthorizedException } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { TenantService } from './tenant.service';
@Injectable()
export class TenantContextMiddleware implements NestMiddleware {
from functools import wraps
from django.http import JsonResponse
from django.core.cache import cache
def ajax_required(view_func):
import functools
import threading
import time
from collections import OrderedDict