You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
477 B
JavaScript
15 lines
477 B
JavaScript
2 years ago
|
import { getUserResource } from "./user.mjs";
|
||
|
import { UserStore } from "../db/schemas.mjs";
|
||
|
|
||
|
export const getSessionResource = async sessionStore => {
|
||
|
return {
|
||
|
id: sessionStore._id,
|
||
|
host: await getUserResource(
|
||
|
await UserStore.findOne().bySpotifyId(sessionStore.host.spotify.userId)
|
||
|
),
|
||
|
clients: await Promise.all([...sessionStore.clients]
|
||
|
.map(async client => await getUserResource(
|
||
|
await UserStore.findById(client._id)
|
||
|
))),
|
||
|
};
|
||
|
};
|