Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

senter-optout-service

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

senter-optout-service - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

36

optoutService.js

@@ -1,11 +0,9 @@

class OptoutService
{
constructor(optoutRepository)
{
class OptoutService {
constructor(optoutRepository) {
this.optoutRepository = optoutRepository
}
async getOptouts(userId) {
console.log(`Getting optout numbers for user '${userId}'`)
let optoutRecord = await this.optoutRepository.getById(userId, userId)
async getOptouts(organisationId) {
console.log(`Getting optout numbers for organisation '${organisationId}'`)
let optoutRecord = await this.optoutRepository.getById(organisationId, organisationId)
if (optoutRecord && optoutRecord.numbers && optoutRecord.numbers.length > 0) {

@@ -17,10 +15,10 @@ return optoutRecord.numbers.map(x => x.number)

async getOptoutRecord(userId) {
console.log(`Getting optout record for user '${userId}'`)
return await this.optoutRepository.getById(userId, userId)
async getOptoutRecord(organisationId) {
console.log(`Getting optout record for organisation '${organisationId}'`)
return await this.optoutRepository.getById(organisationId, organisationId)
}
async optoutNumber(userId, number, details) {
console.log(`Optout number '${number.code}${number.number}' from user '${userId}'`)
let optoutRecord = await this.optoutRepository.getById(userId, userId)
async optoutNumber(organisationId, number, details) {
console.log(`Optout number '${number.code}${number.number}' from organisation '${organisationId}'`)
let optoutRecord = await this.optoutRepository.getById(organisationId, organisationId)
const optoutNumber = {

@@ -30,12 +28,12 @@ number: number,

}
console.log('optoutRecord', optoutRecord)
if (optoutRecord == null) {
optoutRecord = {
id: userId,
id: organisationId,
numbers: [optoutNumber]
}
console.log(`Creating new optout record`, optoutRecord)
optoutRecord.id = userId
await this.optoutRepository.create(userId, optoutRecord)
optoutRecord.id = organisationId
await this.optoutRepository.create(organisationId, optoutRecord)
return optoutRecord

@@ -50,4 +48,4 @@ }

}
await this.optoutRepository.update(userId, userId, optoutRecord)
await this.optoutRepository.update(organisationId, organisationId, optoutRecord)
console.log(`Added number '${number.code}${number.number}' into existing optout record`, optoutRecord)

@@ -54,0 +52,0 @@ return optoutRecord

{
"name": "senter-optout-service",
"version": "3.1.0",
"version": "3.2.0",
"description": "Contain methods to work with otpouts",

@@ -5,0 +5,0 @@ "main": "optoutService.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc