/var/www/p4ela.kz/server/delivery/api/responseModels/company
Edit: /var/www/p4ela.kz/server/delivery/api/responseModels/company/company.model.js (2075B)
let { BranchModel, ProductGroupModel, UserModel } = {}
module.exports = class CompanyModel {
constructor({
id,
uid,
planId,
enabled,
active,
image,
name,
tag,
rating,
description,
branches,
product_groups,
companyTypes,
companyImages,
users,
plan,
countClients,
countCompanyReviews,
countBranchReviews,
countProductReviews,
ordersCreated,
ordersCompleted,
ordersCanceled,
createdAt,
billingAt,
planExpiredAt,
clients
}) {
BranchModel = require('../branch/branch.model')
ProductGroupModel = require('../productGroup/productGroup.model')
UserModel = require('../user/user.model')
this.id = id || ''
this.uid = uid || ''
this.planId = planId || ''
this.enabled = enabled
this.active = active
this.name = name || ''
this.tag = tag || ''
this.image = image || ''
this.rating = rating || 0.0
this.description = description || ''
this.plan = plan || []
this.countClients = countClients || 0
this.countCompanyReviews = countCompanyReviews || 0
this.countBranchReviews = countBranchReviews || 0
this.countProductReviews = countProductReviews || 0
this.ordersCreated = ordersCreated || 0
this.ordersCompleted = ordersCompleted || 0
this.ordersCanceled = ordersCanceled || 0
this.createdAt = createdAt || ''
this.billingAt = billingAt || ''
this.planExpiredAt = planExpiredAt || ''
this.companyTypes = companyTypes
this.branches = branches
? branches.map((b) => {
return new BranchModel(b)
})
: []
this.product_groups = product_groups
? product_groups.map((b) => {
return new ProductGroupModel(b)
})
: []
this.companyImages = companyImages
? companyImages.map((i) => {
const { id, uid, image, icon, imageSmall, imageLarge, isDefault } = i
return { id, uid, image, icon, imageSmall, imageLarge, isDefault }
})
: []
this.clients = clients
? clients.map((user) => {
return new UserModel(user)
})
: []
this.users = users
? users.map((user) => {
return new UserModel(user)
})
: []
}
}