| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- # Базовый класс для всех сущностей
- 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
- }
|