class ButtonComponent < ViewComponent::Base
VARIANTS = {
primary: "bg-blue-600 hover:bg-blue-700 text-white",
secondary: "bg-gray-200 hover:bg-gray-300 text-gray-900",
danger: "bg-red-600 hover:bg-red-700 text-white"
}.freeze
module Posts
class CreateService
def initialize(author:, params:)
@author = author
@params = params
end
-- Pattern: Single Table Inheritance (STI)
CREATE TABLE users (
id SERIAL PRIMARY KEY,
type VARCHAR(50) NOT NULL, -- 'admin', 'customer', 'vendor'
username VARCHAR(100) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
/* BEM - Block Element Modifier */
/* BLOCK - Independent component */
.card {
padding: 1rem;
border: 1px solid #ddd;
import { QueryResultRow } from 'pg';
import { pool, Queryable } from './db';
export abstract class BaseRepository<T extends QueryResultRow> {
protected abstract readonly table: string;