diff --git a/pages/api/users/get-social.js b/pages/api/users/get-social.js index 51108b9d..2b349cdd 100644 --- a/pages/api/users/get-social.js +++ b/pages/api/users/get-social.js @@ -1,8 +1,7 @@ import * as Data from "~/node_common/data"; -import * as Serializers from "~/node_common/serializers"; export default async (req, res) => { - let id = req.body.data.id; + let { id } = req.body.data; if (!id) { return res.status(404).send({ decorator: "SERVER_USER_SOCIAL_NO_USER_ID", error: true }); } @@ -21,38 +20,8 @@ export default async (req, res) => { .send({ decorator: "SERVER_USER_SOCIAL_SUBSCRIPTIONS_NOT_FOUND", error: true }); } - const following = await Data.getFollowingByUserId({ ownerId: id }); - - if (!following) { - return res - .status(404) - .send({ decorator: "SERVER_USER_SOCIAL_FOLLOWING_NOT_FOUND", error: true }); - } - - if (following.error) { - return res - .status(500) - .send({ decorator: "SERVER_USER_SOCIAL_FOLLOWING_NOT_FOUND", error: true }); - } - - const followers = await Data.getFollowersByUserId({ userId: id }); - - if (!followers) { - return res - .status(404) - .send({ decorator: "SERVER_USER_SOCIAL_FOLLOWERS_NOT_FOUND", error: true }); - } - - if (followers.error) { - return res - .status(500) - .send({ decorator: "SERVER_USER_SOCIAL_FOLLOWERS_NOT_FOUND", error: true }); - } - return res.status(200).send({ decorator: "SERVER_USER_SOCIAL", - following, - followers, subscriptions, }); };