Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

move script

Steven Tey04b5bb7101b0
diff --git a/apps/web/scripts/backfill-youtube-stats.ts b/apps/web/scripts/partners/backfill-youtube-stats.ts
similarity index 87%
rename from apps/web/scripts/backfill-youtube-stats.ts
rename to apps/web/scripts/partners/backfill-youtube-stats.ts
index f2904a62df..90aa13f827 100644
--- a/apps/web/scripts/backfill-youtube-stats.ts
+++ b/apps/web/scripts/partners/backfill-youtube-stats.ts
@@ -72,22 +72,19 @@ async function main() {
const { viewCount, subscriberCount, videoCount } = stat.statistics;
- await prisma.partner.update({
- where: { id: partner.id },
- data: {
- youtubeChannelId: stat.id,
- youtubeSubscriberCount: parseInt(subscriberCount || "0", 10),
- youtubeVideoCount: parseInt(videoCount || "0", 10),
- youtubeViewCount: parseInt(viewCount || "0", 10),
- },
- });
-
- console.log(`Updated ${partner.youtube} with stats`, {
+ const newStats = {
youtubeChannelId: stat.id,
youtubeSubscriberCount: parseInt(subscriberCount || "0", 10),
youtubeVideoCount: parseInt(videoCount || "0", 10),
youtubeViewCount: parseInt(viewCount || "0", 10),
+ };
+
+ await prisma.partner.update({
+ where: { id: partner.id },
+ data: newStats,
});
+
+ console.log(`Updated ${partner.youtube} with stats`, newStats);
}
} catch (error) {
console.error("Error fetching channel data:", error);