Update export.js

This commit is contained in:
Aleksandr Statciuk 2022-08-13 20:43:40 +03:00
parent b7dfed21cd
commit 864183dbe1
1 changed files with 2 additions and 1 deletions

View File

@ -13,7 +13,7 @@ async function main() {
let streams = await db.streams.find({}) let streams = await db.streams.find({})
streams = _.sortBy(streams, 'channel') streams = _.sortBy(streams, 'channel')
streams = streams.map(stream => { streams = streams.map(stream => {
const data = { let data = {
channel: stream.channel, channel: stream.channel,
url: stream.url, url: stream.url,
http_referrer: stream.http_referrer, http_referrer: stream.http_referrer,
@ -29,6 +29,7 @@ async function main() {
let updatedAt = now let updatedAt = now
let found = api.streams.find({ url: stream.url }) let found = api.streams.find({ url: stream.url })
if (found) { if (found) {
data = JSON.parse(JSON.stringify(data))
normalized = _.omit(found, ['added_at', 'updated_at', 'checked_at']) normalized = _.omit(found, ['added_at', 'updated_at', 'checked_at'])
if (_.isEqual(data, normalized)) { if (_.isEqual(data, normalized)) {
addedAt = found.added_at || now addedAt = found.added_at || now