Skip to content

Commit

Permalink
ft(backend): fix the null vendor email
Browse files Browse the repository at this point in the history
Feat: Product Lifecycle Notification System #84
  • Loading branch information
niyibi250 committed Jun 12, 2024
1 parent 722cb1f commit 7602d81
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Notification.vendor/event.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ eventEmitter.on('order_status_change', async (orderId:number) => {

eventEmitter.on('productCreated', async(product:product)=>{
try{
if(!product || !product.vendor)
if(!product || !product.vendor || !product.vendor.email)
{
return
}
Expand All @@ -239,11 +239,11 @@ eventEmitter.on('productCreated', async(product:product)=>{
eventEmitter.on('product_updated', async(product:product)=>{

try{
if(!product || !product.vendor)
console.log('product_updated listed too')
if(!product || !product.vendor || !product.vendor.email)
{
return
}

const new_notification = new Notification_box();
new_notification.product_id =product.id ;
new_notification.vendor_id = product.vendor.id
Expand All @@ -267,7 +267,7 @@ eventEmitter.on('product_deleted', async(product_id:number)=>{
where:{id: product_id},
relations:['vendor']
})
if(!product || !product.vendor)
if(!product || !product.vendor || !product.vendor.email)
{
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/Notification.vendor/node.cron.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const dailyTasks = cron.schedule('0 0 * * *', async () => {
relations: ['vendor'],
});

if(!product)
if(!product || !product.vendor || !product.vendor.email)
{
return
}
Expand Down

0 comments on commit 7602d81

Please sign in to comment.