Added console logs on mutation resolvers.
Main / build-and-push-docker-image (20.x) (pull_request) Successful in 5m27s
Main / build-and-push-docker-image (20.x) (pull_request) Successful in 5m27s
This commit is contained in:
@@ -81,10 +81,13 @@ export const resolvers = {
|
||||
|
||||
if (env !== "development") {
|
||||
if (!mutationKey) {
|
||||
console.info("INIT: REFUSED - no mutation key was provided.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mutationKey !== envMutationKey) {
|
||||
console.info("INIT: REFUSED - mutation key provided was incorrect.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -101,6 +104,7 @@ export const resolvers = {
|
||||
count++;
|
||||
}
|
||||
|
||||
console.info(`INIT: ${count} tables have been initialized with data.`);
|
||||
return `${count} tables have been initialized with data.`;
|
||||
},
|
||||
cronJob: async (
|
||||
@@ -112,10 +116,14 @@ export const resolvers = {
|
||||
|
||||
if (env !== "development") {
|
||||
if (!mutationKey) {
|
||||
console.info("CRONJOB: REFUSED - no mutation key was provided.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mutationKey !== envMutationKey) {
|
||||
console.info(
|
||||
"CRONJOB: REFUSED - mutation key provided was incorrect."
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -124,6 +132,7 @@ export const resolvers = {
|
||||
|
||||
if (latestDailyStats !== null) {
|
||||
if (isDailyStatToday(String(latestDailyStats.createdAt))) {
|
||||
console.info("Cron job refused: latest document is current date.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -159,6 +168,7 @@ export const resolvers = {
|
||||
}
|
||||
});
|
||||
|
||||
console.info("CRONJOB: Creating new document.");
|
||||
return await prisma.totalStats.update({
|
||||
where: {
|
||||
createdAt: totalStats?.createdAt
|
||||
@@ -183,10 +193,15 @@ export const resolvers = {
|
||||
|
||||
if (env !== "development") {
|
||||
if (!mutationKey) {
|
||||
console.info("ADD GROUP: REFUSED - no mutation key was provided.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mutationKey !== envMutationKey) {
|
||||
console.info(
|
||||
"ADD GROUP: REFUSED - mutation key provided was incorrect."
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -208,6 +223,7 @@ export const resolvers = {
|
||||
});
|
||||
}
|
||||
|
||||
console.info("ADD GROUP: Created new document.");
|
||||
return existingGroup;
|
||||
}
|
||||
|
||||
@@ -227,14 +243,21 @@ export const resolvers = {
|
||||
|
||||
if (env !== "development") {
|
||||
if (!mutationKey) {
|
||||
console.info(
|
||||
"INCREMENT GROUP: REFUSED - no mutation key was provided."
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mutationKey !== envMutationKey) {
|
||||
console.info(
|
||||
"INCREMENT GROUP: REFUSED - mutation key provided was incorrect."
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
console.info("INCREMENT GROUP: Incremented group document.");
|
||||
return await prisma.groups.update({
|
||||
where: { telegramID: BigInt(groupID) },
|
||||
data: { linksDeleted: { increment: linksDeleted } }
|
||||
@@ -254,10 +277,14 @@ export const resolvers = {
|
||||
|
||||
if (env !== "development") {
|
||||
if (!mutationKey) {
|
||||
console.info("INCREMENT: REFUSED - no mutation key was provided.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mutationKey !== envMutationKey) {
|
||||
console.info(
|
||||
"INCREMENT: REFUSED - mutation key provided was incorrect."
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -279,6 +306,8 @@ export const resolvers = {
|
||||
});
|
||||
}
|
||||
|
||||
console.info("INCREMENT: Incremented information on today's document.");
|
||||
|
||||
return await prisma.dailyStats.update({
|
||||
where: { createdAt: latestDailyStats.createdAt },
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user