-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
431 additions
and
144 deletions.
There are no files selected for viewing
Submodule admin-panel
updated
from b67c59 to f76a7b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.54 | ||
1.0.55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/resolvers/DetachedProfileResolvers/RejectDetachedProfile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { User } from '../../models/UserModel'; | ||
import { | ||
GET_DETACHED_PROFILE_ERROR, | ||
GET_USER_ERROR, WRONG_USER_ERROR, | ||
} from '../ResolverErrorStrings'; | ||
import { DetachedProfile } from '../../models/DetachedProfile'; | ||
import { recordRejectFR } from '../../models/UserActionModel'; | ||
|
||
export const rejectDetachedProfileResolver = async ({ rejectDetachedProfileInput }) => { | ||
const user = await User.findById(rejectDetachedProfileInput.user_id) | ||
.exec() | ||
.catch(err => err); | ||
let detachedProfile = await DetachedProfile | ||
.findById(rejectDetachedProfileInput.detachedProfile_id) | ||
.exec() | ||
.catch(err => err); | ||
if (!user || user instanceof Error) { | ||
return { | ||
success: false, | ||
message: GET_USER_ERROR, | ||
}; | ||
} | ||
if (!detachedProfile || detachedProfile instanceof Error) { | ||
return { | ||
success: false, | ||
message: GET_DETACHED_PROFILE_ERROR, | ||
}; | ||
} | ||
if (detachedProfile.status === 'accepted') { | ||
// no-op if detached profile has already been approved | ||
return { | ||
success: true, | ||
detachedProfile, | ||
}; | ||
} | ||
if (user.phoneNumber !== detachedProfile.phoneNumber) { | ||
return { | ||
success: false, | ||
message: WRONG_USER_ERROR, | ||
}; | ||
} | ||
detachedProfile.status = 'declined'; | ||
detachedProfile = await detachedProfile.save(); | ||
recordRejectFR({ rejectDetachedProfileInput, detachedProfile }); | ||
return { | ||
success: true, | ||
detachedProfile, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.