class User < ApplicationRecord
has_one_attached :avatar do |attachable|
attachable.variant :thumb,
resize_to_limit: [256, 256],
convert: :webp,
saver: { quality: 80 }
import base64
import json
from datetime import datetime
from typing import NamedTuple
from fastapi import HTTPException
package com.shop.api.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
<?php
namespace App\Http\Controllers;
use App\Jobs\ImportProductChunk;
use App\Models\Import;
package api
import "fmt"
type Resource struct {
Type string `json:"type"`
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CancelReason {
pub reason: String,
pub feedback: Option<String>,
const express = require('express');
const AppError = require('./AppError');
const asyncHandler = require('./asyncHandler');
const errorMiddleware = require('./errorMiddleware');
const UserRepo = require('./UserRepo');
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
import hashlib
from datetime import datetime, timezone
from sqlalchemy import BigInteger, Column, DateTime, String, UniqueConstraint
from sqlalchemy.orm import declarative_base
import { z } from "zod";
export const rowSchema = z.object({
email: z.string().email(),
name: z.string().min(1, "name is required"),
age: z.coerce.number().int().min(0, "age must be >= 0"),
class InvoicesController < ApplicationController
def index
invoices = InvoicesQuery.new(current_account.invoices, filter_params).call
@invoices = invoices.page(params[:page]).per(25)
render :index
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models, transaction
from .middleware import get_current_user