2020-08-28 01:05:20 +03:00
|
|
|
import * as Data from "~/node_common/data";
|
2020-08-30 12:07:21 +03:00
|
|
|
import * as Serializers from "~/node_common/serializers";
|
2020-08-28 01:05:20 +03:00
|
|
|
|
|
|
|
export default async (req, res) => {
|
|
|
|
const users = await Data.getEveryUser();
|
|
|
|
const slates = await Data.getEverySlate();
|
|
|
|
|
2020-09-01 02:47:53 +03:00
|
|
|
const { serializedSlates, userToSlatesMap } = await Serializers.doSlates({
|
|
|
|
serializedUsers: users,
|
|
|
|
slates,
|
|
|
|
});
|
2020-08-30 12:07:21 +03:00
|
|
|
|
|
|
|
for (let i = 0; i < users.length; i++) {
|
|
|
|
users[i].slates = userToSlatesMap[users[i].id];
|
|
|
|
}
|
|
|
|
|
2020-08-28 01:05:20 +03:00
|
|
|
return res.status(200).send({
|
|
|
|
decorator: "SERVER_DIRECTORY",
|
2020-08-30 12:07:21 +03:00
|
|
|
data: { users, slates: serializedSlates },
|
2020-08-28 01:05:20 +03:00
|
|
|
});
|
|
|
|
};
|