upgrade yarn #3

Merged
werewolfkid merged 5 commits from cron-logging into main 2026-05-03 10:18:12 -04:00
Showing only changes of commit c17ecaaa7a - Show all commits
+29
View File
@@ -81,10 +81,13 @@ export const resolvers = {
if (env !== "development") { if (env !== "development") {
if (!mutationKey) { if (!mutationKey) {
console.info("INIT: REFUSED - no mutation key was provided.");
return null; return null;
} }
if (mutationKey !== envMutationKey) { if (mutationKey !== envMutationKey) {
console.info("INIT: REFUSED - mutation key provided was incorrect.");
return null; return null;
} }
} }
@@ -101,6 +104,7 @@ export const resolvers = {
count++; count++;
} }
console.info(`INIT: ${count} tables have been initialized with data.`);
return `${count} tables have been initialized with data.`; return `${count} tables have been initialized with data.`;
}, },
cronJob: async ( cronJob: async (
@@ -112,10 +116,14 @@ export const resolvers = {
if (env !== "development") { if (env !== "development") {
if (!mutationKey) { if (!mutationKey) {
console.info("CRONJOB: REFUSED - no mutation key was provided.");
return null; return null;
} }
if (mutationKey !== envMutationKey) { if (mutationKey !== envMutationKey) {
console.info(
"CRONJOB: REFUSED - mutation key provided was incorrect."
);
return null; return null;
} }
} }
@@ -124,6 +132,7 @@ export const resolvers = {
if (latestDailyStats !== null) { if (latestDailyStats !== null) {
if (isDailyStatToday(String(latestDailyStats.createdAt))) { if (isDailyStatToday(String(latestDailyStats.createdAt))) {
console.info("Cron job refused: latest document is current date.");
return null; return null;
} }
} }
@@ -159,6 +168,7 @@ export const resolvers = {
} }
}); });
console.info("CRONJOB: Creating new document.");
return await prisma.totalStats.update({ return await prisma.totalStats.update({
where: { where: {
createdAt: totalStats?.createdAt createdAt: totalStats?.createdAt
@@ -183,10 +193,15 @@ export const resolvers = {
if (env !== "development") { if (env !== "development") {
if (!mutationKey) { if (!mutationKey) {
console.info("ADD GROUP: REFUSED - no mutation key was provided.");
return null; return null;
} }
if (mutationKey !== envMutationKey) { if (mutationKey !== envMutationKey) {
console.info(
"ADD GROUP: REFUSED - mutation key provided was incorrect."
);
return null; return null;
} }
} }
@@ -208,6 +223,7 @@ export const resolvers = {
}); });
} }
console.info("ADD GROUP: Created new document.");
return existingGroup; return existingGroup;
} }
@@ -227,14 +243,21 @@ export const resolvers = {
if (env !== "development") { if (env !== "development") {
if (!mutationKey) { if (!mutationKey) {
console.info(
"INCREMENT GROUP: REFUSED - no mutation key was provided."
);
return null; return null;
} }
if (mutationKey !== envMutationKey) { if (mutationKey !== envMutationKey) {
console.info(
"INCREMENT GROUP: REFUSED - mutation key provided was incorrect."
);
return null; return null;
} }
} }
console.info("INCREMENT GROUP: Incremented group document.");
return await prisma.groups.update({ return await prisma.groups.update({
where: { telegramID: BigInt(groupID) }, where: { telegramID: BigInt(groupID) },
data: { linksDeleted: { increment: linksDeleted } } data: { linksDeleted: { increment: linksDeleted } }
@@ -254,10 +277,14 @@ export const resolvers = {
if (env !== "development") { if (env !== "development") {
if (!mutationKey) { if (!mutationKey) {
console.info("INCREMENT: REFUSED - no mutation key was provided.");
return null; return null;
} }
if (mutationKey !== envMutationKey) { if (mutationKey !== envMutationKey) {
console.info(
"INCREMENT: REFUSED - mutation key provided was incorrect."
);
return null; return null;
} }
} }
@@ -279,6 +306,8 @@ export const resolvers = {
}); });
} }
console.info("INCREMENT: Incremented information on today's document.");
return await prisma.dailyStats.update({ return await prisma.dailyStats.update({
where: { createdAt: latestDailyStats.createdAt }, where: { createdAt: latestDailyStats.createdAt },
data: { data: {