# Базовый класс для всех сущностей class DomainEntity constructor: -> @_id = '' @_rev = '' @type = '' @domains = [] @createdAt = new Date().toISOString() @updatedAt = new Date().toISOString() @active = true @createdBy = '' @updatedBy = '' # Товар class Product extends DomainEntity constructor: -> super() @type = 'product' @name = '' @sku = '' @price = 0 @oldPrice = null @category = '' @brand = '' @description = '' @shortDescription = '' @attributes = {} @images = [] @richContent = null @inStock = true @stockQuantity = 0 @weight = 0 @volume = 0 @dimensions = {} @seo = {} @tags = [] @relatedProducts = [] # Категория class Category extends DomainEntity constructor: -> super() @type = 'category' @name = '' @slug = '' @parent = null @order = 0 @image = '' @description = '' @seo = {} @attributesConfig = {} # Конфигурация атрибутов для категории # Слайд главной страницы class HeroSlide extends DomainEntity constructor: -> super() @type = 'hero_slide' @title = '' @subtitle = '' @image = '' @buttonText = 'В каталог' @buttonLink = '/catalog' @order = 0 @active = true # Настройки домена class DomainSettings extends DomainEntity constructor: -> super() @type = 'domain_settings' @domain = '' @companyName = '' @companyLogo = '' @languages = ['ru'] @defaultLanguage = 'ru' @theme = 'light' @contacts = {} @seo = {} @social = {} @paymentMethods = [] @shippingMethods = [] # Пользователь class User extends DomainEntity constructor: -> super() @type = 'user' @username = '' @email = '' @role = 'user' # user, admin, manager @firstName = '' @lastName = '' @phone = '' @address = {} @orders = [] @favorites = [] @cart = [] # Заказ class Order extends DomainEntity constructor: -> super() @type = 'order' @userId = '' @items = [] @total = 0 @status = 'pending' # pending, confirmed, shipped, delivered, cancelled @paymentStatus = 'pending' @shippingAddress = {} @billingAddress = {} @paymentMethod = '' @shippingMethod = '' @trackingNumber = '' @notes = '' module.exports = { DomainEntity, Product, Category, HeroSlide, DomainSettings, User, Order }