/var/www/qr4y.kz/server/delivery/api/responseModels/company
Edit: /var/www/qr4y.kz/server/delivery/api/responseModels/company/company.model.js (1376B)
let { BranchModel, ProductGroupModel, UserModel } = {}
module.exports = class CompanyModel {
constructor({
id,
uid,
enabled,
active,
image,
name,
tag,
rating,
description,
branches,
product_groups,
companyTypes,
companyImages,
users,
clients
}) {
BranchModel = require('../branch/branch.model')
ProductGroupModel = require('../productGroup/productGroup.model')
UserModel = require('../user/user.model')
this.id = id || ''
this.uid = uid || ''
this.enabled = enabled
this.active = active
this.name = name || ''
this.tag = tag || ''
this.image = image || ''
this.rating = rating || 0.0
this.description = description || ''
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)
})
: []
}
}