Skip to content

Commit

Permalink
Removed console log from create-article.ts, commented out treatment t…
Browse files Browse the repository at this point in the history
…ag condition in create-collection.spec.ts and create-collection.ts, added location tagging logic in update-article.ts.
  • Loading branch information
jamalsoueidan committed May 29, 2024
1 parent 0d4a8e7 commit f97eca4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,6 @@ export const createArticle = async ({

tags.push(`gender-${user.gender}`);

console.log(
JSON.stringify(
{
data: {
article: {
blog_id: 105364226375,
title: user.username,
author: "System",
tags: tags.join(", "),
body_html: user.aboutMeHtml,
metafields: [
{
key: "user",
value: user.userMetaobjectId,
namespace: "booking",
},
{
key: "collection",
value: user.collectionMetaobjectId,
namespace: "booking",
},
],
summary_html: user.shortDescription,
published_at: user.active ? user.createdAt : null,
},
},
},
null,
2
)
);

const response = await shopifyRest().post("blogs/105364226375/articles", {
data: {
article: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ describe("CustomerCreateOrchestration", () => {
relation: "EQUALS" as any,
condition: `user-${user.username}`,
},
{
/*{
column: "TAG" as any,
relation: "EQUALS" as any,
condition: `treatments`,
},
},*/
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export const createCollection = async ({
relation: "EQUALS" as any,
condition: `user-${user.username}`,
},
{
/*{
column: "TAG" as any,
relation: "EQUALS" as any,
condition: `treatments`,
},
},*/
],
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CustomerServiceGet } from "~/functions/customer/services/customer/get";
import { CustomerLocationServiceList } from "~/functions/customer/services/location/list";
import { LocationOriginTypes, LocationTypes } from "~/functions/location";
import { ScheduleModel } from "~/functions/schedule";
import { shopifyRest } from "~/library/shopify/rest";

Expand Down Expand Up @@ -49,6 +50,25 @@ export const updateArticle = async ({
tags.push(
`city-${locations.map((l) => l.city.toLowerCase()).join(", city-")}`
);
const destination = locations.find(
(l) => l.locationType === LocationTypes.DESTINATION
);
if (destination) {
tags.push("location-destination");
}
const originTypeHome = locations.find(
(l) => l.originType === LocationOriginTypes.HOME
);
if (originTypeHome) {
tags.push("location-home");
}

const originTypeSalon = locations.find(
(l) => l.originType === LocationOriginTypes.COMMERCIAL
);
if (originTypeSalon) {
tags.push("location-salon");
}
}

tags.push(`gender-${user.gender}`);
Expand Down

0 comments on commit f97eca4

Please sign in to comment.