mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-28 05:52:49 +03:00
29 lines
753 B
JavaScript
29 lines
753 B
JavaScript
import * as Data from "~/node_common/data";
|
|
import * as Serializers from "~/node_common/serializers";
|
|
import * as Strings from "~/common/strings";
|
|
|
|
export default async (req, res) => {
|
|
let slate = await Data.getSlateById({ id: req.body.data.id });
|
|
if (!slate || slate.error) {
|
|
return res.status(404).send({
|
|
decorator: "SLATE_NOT_FOUND",
|
|
error: true,
|
|
});
|
|
}
|
|
slate = Serializers.slate(slate);
|
|
|
|
let user = await Data.getUserById({ id: slate.data.ownerId });
|
|
if (!user || user.error) {
|
|
return res.status(200).send({
|
|
decorator: "SLATE_OWNER_NOT_FOUND",
|
|
data: slate,
|
|
});
|
|
}
|
|
slate.user = Serializers.user(user);
|
|
|
|
return res.status(200).send({
|
|
decorator: "SERIALIZED_SLATE",
|
|
data: slate,
|
|
});
|
|
};
|