fetch phone number data even if user is not on a paid plan

This commit is contained in:
m5r
2021-10-20 23:57:32 +02:00
parent 5df0634060
commit 7a4c583ea5
2 changed files with 20 additions and 53 deletions

View File

@ -7,8 +7,6 @@ import appLogger from "integrations/logger";
import { sendEmail } from "integrations/aws-ses";
import type { Metadata } from "integrations/paddle";
import { translateSubscriptionStatus } from "integrations/paddle";
import fetchMessagesQueue from "../../../messages/api/queue/fetch-messages";
import fetchCallsQueue from "../../../phone-calls/api/queue/fetch-calls";
const logger = appLogger.child({ queue: "subscription-created" });
@ -51,29 +49,6 @@ export const subscriptionCreatedQueue = Queue<Payload>("api/queue/subscription-c
},
});
const phoneNumber = organization.phoneNumbers[0];
if (phoneNumber) {
const phoneNumberId = phoneNumber.id;
await Promise.all([
db.processingPhoneNumber.create({
data: {
organizationId,
phoneNumberId,
hasFetchedMessages: false,
hasFetchedCalls: false,
},
}),
fetchMessagesQueue.enqueue(
{ organizationId, phoneNumberId },
{ id: `fetch-messages-${organizationId}-${phoneNumberId}` },
),
fetchCallsQueue.enqueue(
{ organizationId, phoneNumberId },
{ id: `fetch-messages-${organizationId}-${phoneNumberId}` },
),
]);
}
if (isReturningSubscriber) {
sendEmail({
subject: "Welcome back to Shellphone",