feat(getSocial): remove following and followers

This commit is contained in:
Aminejv 2021-08-03 18:08:26 +01:00 committed by Martina
parent 36243cd3bd
commit 0b8c1b0d63

View File

@ -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,
});
};