remove product attribute

This commit is contained in:
2026-02-01 15:50:17 +03:30
parent 01324b12fa
commit 2cead723cf
5 changed files with 62 additions and 63 deletions
+21 -23
View File
@@ -1,30 +1,28 @@
import type { EntityManager } from '@mikro-orm/core';
import { Attribute } from 'src/modules/product/entities/attribute.entity';
import { attributeValueData } from './data/attribute-value.data';
import { AttributeValue } from 'src/modules/product/entities/attribute-value.entity';
// import type { EntityManager } from '@mikro-orm/core';
// import { attributeValueData } from './data/attribute-value.data';
// export class AttributeValueSeeder {
// async run(
// em: EntityManager,
export class AttributeValueSeeder {
async run(
em: EntityManager,
// ): Promise<void> {
// const attributes = await em.findAll(Attribute)
// for (const attr of attributes) {
): Promise<void> {
const attributes = await em.findAll(Attribute)
for (const attr of attributes) {
// const attrValues = attributeValueData.filter(a => a.attributeName === attr.name)
const attrValues = attributeValueData.filter(a => a.attributeName === attr.name)
for (const av of attrValues) {
// for (const av of attrValues) {
const a= em.create(AttributeValue, {
value: av.value,
attribute: attr
});
// const a= em.create(AttributeValue, {
// value: av.value,
// attribute: attr
// });
em.persist(a)
}
// em.persist(a)
// }
}
// }
await em.flush();
}
}
// await em.flush();
// }
// }