Skip to content

Commit

Permalink
Remove channel twitter linkedin (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
hichri-louay committed Apr 15, 2024
2 parents b550c02 + 4a5eb35 commit 78547e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controllers/external.controller.js
Expand Up @@ -335,11 +335,11 @@ exports.externalDeleteLinkedinChannels = async (req, res) => {
exports.externalDeleteLinkedinChannel = async (req, res) => {
try {
const user = await UserExternalWallet.findOne({ _id: req.user._id })
let { organization, linkedinId } = req.params
let linkedinProfile = await LinkedinProfile.findOne(
{ userId: user.UserId, linkedinId },
{ pages: 1 }
).lean()
let { linkedinId, organization } = req.params
let linkedinProfile = await LinkedinProfile.findOne({
userId: user.UserId,
linkedinId,
}).lean()
if (!linkedinProfile) return makeResponseError(res, 401, 'unauthorized')
if (linkedinProfile.pages.length === 1) {
await LinkedinProfile.deleteOne({
Expand Down Expand Up @@ -390,7 +390,7 @@ exports.externalDeleteTwitterChannel = async (req, res) => {
if (twitterProfile?.UserId !== user.UserId)
return makeResponseError(res, 401, 'unauthorized')
else {
await TwitterProfile.deleteOne({ UserId: user.UserId })
await TwitterProfile.deleteOne({ _id: twitterProfile._id })
return makeResponseData(res, 200, 'deleted successfully')
}
} catch (err) {
Expand Down

0 comments on commit 78547e9

Please sign in to comment.