제품 커밋
This commit is contained in:
parent
d9731d03b1
commit
d834359577
@ -68,6 +68,8 @@ class Company extends Model {
|
||||
this.hasMany(models.MaintenanceLog, { foreignKey: "companyId" });
|
||||
this.hasMany(models.ApiKey, { foreignKey: "companyId" });
|
||||
this.hasMany(models.OemMng, { foreignKey: "companyId" });
|
||||
this.hasMany(models.ProductGroup, { foreignKey: "companyId" });
|
||||
this.hasMany(models.Product, { foreignKey: "companyId" });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ class ProductGroup extends Model {
|
||||
static associate(models) {
|
||||
// OemMng이 Company에 속함
|
||||
this.belongsTo(models.Company, { foreignKey: "companyId" });
|
||||
this.hasMany(models.Product, { foreignKey: "product_group_id" });
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
const {
|
||||
Product,
|
||||
ProductGroup,
|
||||
Company,
|
||||
Role,
|
||||
} = require("../models");
|
||||
@ -31,6 +32,10 @@ class productService {
|
||||
model: Company,
|
||||
attributes: ["id", "name"],
|
||||
},
|
||||
{
|
||||
model: ProductGroup,
|
||||
attributes: ["id", "product_group_name"], // 필요한 속성들을 추가하세요
|
||||
},
|
||||
],
|
||||
order: [["createdAt", "DESC"]],
|
||||
offset,
|
||||
|
Loading…
Reference in New Issue
Block a user