feat: Product filtering (#439)

This commit is contained in:
pKorsholm
2021-10-13 16:01:59 +02:00
committed by GitHub
parent c0e947f47a
commit 5ef2a3fbcb
11 changed files with 707 additions and 31 deletions

View File

@@ -108,6 +108,28 @@ module.exports = async (connection, data = {}) => {
tenPercent.rule = tenPercentRule
await manager.save(tenPercent)
const dUsageLimit = await manager.create(Discount, {
id: "test-discount-usage-limit",
code: "SPENT",
is_dynamic: false,
is_disabled: false,
usage_limit: 10,
usage_count: 10,
})
const drUsage = await manager.create(DiscountRule, {
id: "test-discount-rule-usage-limit",
description: "Created",
type: "fixed",
value: 10000,
allocation: "total",
})
dUsageLimit.rule = drUsage
dUsageLimit.regions = [r]
await manager.save(dUsageLimit)
const d = await manager.create(Discount, {
id: "test-discount",
code: "CREATED",

View File

@@ -25,6 +25,22 @@ module.exports = async (connection, data = {}) => {
await manager.save(coll)
const coll1 = manager.create(ProductCollection, {
id: "test-collection1",
handle: "test-collection1",
title: "Test collection 1",
})
await manager.save(coll1)
const coll2 = manager.create(ProductCollection, {
id: "test-collection2",
handle: "test-collection2",
title: "Test collection 2",
})
await manager.save(coll2)
const tag = manager.create(ProductTag, {
id: "tag1",
value: "123",
@@ -32,6 +48,20 @@ module.exports = async (connection, data = {}) => {
await manager.save(tag)
const tag3 = manager.create(ProductTag, {
id: "tag3",
value: "123",
})
await manager.save(tag3)
const tag4 = manager.create(ProductTag, {
id: "tag4",
value: "123",
})
await manager.save(tag4)
const type = manager.create(ProductType, {
id: "test-type",
value: "test-type",
@@ -199,4 +229,46 @@ module.exports = async (connection, data = {}) => {
})
await manager.save(variant5)
const product1 = manager.create(Product, {
id: "test-product_filtering_1",
handle: "test-product_filtering_1",
title: "Test product filtering 1",
profile_id: defaultProfile.id,
description: "test-product-description",
type: { id: "test-type", value: "test-type" },
collection_id: "test-collection1",
status: "proposed",
tags: [{ id: "tag3", value: "123" }],
})
await manager.save(product1)
const product2 = manager.create(Product, {
id: "test-product_filtering_2",
handle: "test-product_filtering_2",
title: "Test product filtering 2",
profile_id: defaultProfile.id,
description: "test-product-description",
type: { id: "test-type", value: "test-type" },
collection_id: "test-collection2",
status: "published",
tags: [{ id: "tag3", value: "123" }],
})
await manager.save(product2)
const product3 = manager.create(Product, {
id: "test-product_filtering_3",
handle: "test-product_filtering_3",
title: "Test product filtering 3",
profile_id: defaultProfile.id,
description: "test-product-description",
type: { id: "test-type", value: "test-type" },
collection_id: "test-collection1",
status: "draft",
tags: [{ id: "tag4", value: "1234" }],
})
await manager.save(product3)
}