Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
Added tags and more fields to offers
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicDataInfo committed Jul 16, 2020
1 parent 9f6c495 commit 51322b8
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 26 deletions.
81 changes: 55 additions & 26 deletions queries/FetchStoreOffersQuery.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,79 @@ query catalogQuery($locale:String, $count:Int, $start:Int, $country: String!, $s
sortDir: $sortDir
) {
elements {
isFeatured
collectionOfferIds
effectiveDate
creationDate
lastModifiedDate
viewableDate
productSlug
developer
ignoreOrder
freeDays

title
id
namespace
title
description
longDescription
status
keyImages {
type
url
}
productSlug
urlSlug
creationDate
lastModifiedDate
effectiveDate
viewableDate

developer
seller {
id
name
}
items {
linkedOfferId
isFeatured
ignoreOrder
freeDays
collectionOfferIds
technicalDetails
recurrence

categories {
path
}

tags {
id
name
namespace
developer
aliases
operator
created
updated
status
referenceCount
comment
}

customAttributes {
key
value
}
categories {
path

keyImages {
type
url
md5
size
uploadedDate
width
height
}
linkedOfferId
linkedOffer {
customAttributes {
key
value
}

items {
id
}

catalogNs {
name
}

# linkedOffer {
# customAttributes {
# key
# value
# }
# }

}
paging {
count
Expand Down
3 changes: 3 additions & 0 deletions update.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class Main {
const namespaces = {};
const titles = {};
const list = [];
const tags = {};

const offersPath = `${this.databasePath}/offers`;
Fs.readdirSync(offersPath).forEach((fileName) => {
Expand All @@ -84,6 +85,7 @@ class Main {
}
}
titles[offer.id] = offer.title;
(offer.tags || []).forEach(tag => tags[tag.id] = tag);
const thumbnailImage = Array.isArray(offer.keyImages) && offer.keyImages.find(img => img.type === 'Thumbnail');
list.push([
offer.id,
Expand All @@ -104,6 +106,7 @@ class Main {
Fs.writeFileSync(`${this.databasePath}/namespaces.json`, JSON.stringify(namespaces, null, 2));
Fs.writeFileSync(`${this.databasePath}/titles.json`, JSON.stringify(titles, null, 2));
Fs.writeFileSync(`${this.databasePath}/list.json`, JSON.stringify(list, null, 2));
Fs.writeFileSync(`${this.databasePath}/tags.json`, JSON.stringify(tags, null, 2));
}

async sync () {
Expand Down

0 comments on commit 51322b8

Please sign in to comment.