mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-26 10:34:09 +03:00
feat(getSocial): remove following and followers
This commit is contained in:
parent
36243cd3bd
commit
0b8c1b0d63
@ -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,
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user