Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit ec9f399

Browse files
authored
Merge pull request #55 from FlowzPlatform/invite-issue-resolve
invite issue resolved
2 parents 84f350a + 47b4d04 commit ec9f399

1 file changed

Lines changed: 31 additions & 4 deletions

File tree

service/src/services/invite/invite.class.js

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ class Service {
112112
.then(async (result) => {
113113
if (result.data.code == 201) {
114114
let subscription_invite = await self.subscription_invitation(data , res )
115-
}
116-
self.sendEmail(data , res);
115+
self.sendEmail(data, res);
116+
}
117117
resolve(result.data)
118118
}).catch(function (err){
119119
let errorObj = {};
@@ -144,10 +144,37 @@ class Service {
144144
}
145145

146146
async subscription_invitation(data , res) {
147-
this.app.service("subscription-invitation").create(data).then(function (response){
148-
}).catch(function(err){
147+
let self = this;
148+
this.app.service("subscription-invitation").find({query : { "toEmail": data.toEmail, "subscriptionId": data.subscriptionId, "isDeleted": false }})
149+
.then(function (response) {
150+
if (response.data.length == 0) {
151+
self.app.service("subscription-invitation").create(data).then(function (response){
152+
}).catch(function(err){
153+
return err
154+
})
155+
}else{
156+
console.log(response.data)
157+
response.data[0].isDeleted = true
158+
self.app.service("subscription-invitation").patch(response.data[0].id, response.data[0] , '').then(function (response2) {
159+
console.log("response2-----" ,response2)
160+
self.app.service("subscription-invitation").create(data).then(function (response) {
161+
}).catch(function (err) {
162+
return err
163+
})
164+
}).catch(function (err) {
165+
return err
166+
})
167+
168+
}
169+
}).catch(function (err) {
149170
return err
150171
})
172+
173+
174+
// this.app.service("subscription-invitation").create(data).then(function (response){
175+
// }).catch(function(err){
176+
// return err
177+
// })
151178
}
152179

153180
sendEmail(data , res){

0 commit comments

Comments
 (0)