Skip to content

Commit

Permalink
migrate non-mop smses to use postman sms service
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed May 29, 2024
1 parent 6a68b77 commit 5a2e6eb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
17 changes: 8 additions & 9 deletions src/app/modules/bounce/bounce.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { EMAIL_HEADERS, EmailType } from '../../services/mail/mail.constants'
import MailService from '../../services/mail/mail.service'
import PostmanSmsService from '../../services/postman-sms/postman-sms.service'
import { SmsFactory } from '../../services/sms/sms.factory'
import { transformMongoError } from '../../utils/handle-mongo-error'
import { PossibleDatabaseError } from '../core/core.errors'
import { getCollabEmailsWithPermission } from '../form/form.utils'
Expand Down Expand Up @@ -369,14 +368,14 @@ export const notifyAdminsOfDeactivation = (
// Best-effort attempt to send SMSes, don't propagate error upwards
): ResultAsync<true, never> => {
const smsResults = possibleSmsRecipients.map((recipient) =>
SmsFactory.sendFormDeactivatedSms({
adminEmail: form.admin.email,
adminId: String(form.admin._id),
formId: form._id,
formTitle: form.title,
recipient: recipient.contact,
recipientEmail: recipient.email,
}),
PostmanSmsService.sendFormDeactivatedSms(
form.admin.email,
String(form.admin._id),
form._id,
form.title,
recipient.contact,
recipient.email,
),
)
return ResultAsync.combineWithAllErrors(smsResults)
.map(() => true as const)
Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../../../../shared/types'
import { IPopulatedUser } from '../../../types'
import { createLoggerWithLabel } from '../../config/logger'
import { SmsFactory } from '../../services/sms/sms.factory'
import PostmanSmsService from '../../services/postman-sms/postman-sms.service'
import { getRequestIp } from '../../utils/request'
import { getUserIdFromSession } from '../auth/auth.utils'
import { ControllerHandler } from '../core/core.types'
Expand Down Expand Up @@ -68,7 +68,7 @@ export const _handleContactSendOtp: ControllerHandler<

// Step 2: No error, send verification OTP to contact.
const otp = createResult.value
const sendOtpResult = await SmsFactory.sendAdminContactOtp(
const sendOtpResult = await PostmanSmsService.sendAdminContactOtp(
contact,
otp,
userId,
Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/user/user.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StatusCodes } from 'http-status-codes'

import { UserContactView } from '../../../types'
import { createLoggerWithLabel } from '../../config/logger'
import * as SmsErrors from '../../services/sms/sms.errors'
import * as SmsErrors from '../../services/postman-sms/postman-sms.errors'
import { HashingError } from '../../utils/hash'
import * as CoreErrors from '../core/core.errors'
import { ErrorResponseData } from '../core/core.types'
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/verification/verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
SmsSendError,
} from '../../services/postman-sms/postman-sms.errors'
import PostmanSmsService from '../../services/postman-sms/postman-sms.service'
import { SmsFactory } from '../../services/sms/sms.factory'
import { transformMongoError } from '../../utils/handle-mongo-error'
import { compareHash, HashingError } from '../../utils/hash'
import {
Expand Down

0 comments on commit 5a2e6eb

Please sign in to comment.