Flesh-out model on the backend
This commit is contained in:
@@ -87,25 +87,12 @@ export const denormalizePiece = ({
|
||||
Effect.flatMap(denormalizeSystemInformation),
|
||||
);
|
||||
|
||||
export const denormalizeRepertoireEntry = ({
|
||||
pieceId,
|
||||
...rest
|
||||
}: Db.RepertoireEntry) => pipe(
|
||||
Effect.all({
|
||||
piece: Effect.uninterruptible(pieceCache.get(pieceId)),
|
||||
}, { concurrency: "unbounded" }),
|
||||
Effect.map((entry) => Object.freeze({
|
||||
...rest,
|
||||
...entry,
|
||||
})),
|
||||
);
|
||||
|
||||
export const denormalizeRepertoire = ({
|
||||
entries,
|
||||
...rest
|
||||
}: Db.Repertoire & { entries: Db.RepertoireEntry[] }) => pipe(
|
||||
}: Db.Repertoire & { entries: PieceId[] }) => pipe(
|
||||
Effect.all({
|
||||
entries: Effect.all(entries.map(denormalizeRepertoireEntry), { concurrency: "unbounded" }),
|
||||
entries: Effect.all(entries.map((entry) => Effect.uninterruptible(pieceCache.get(entry))), { concurrency: "unbounded" }),
|
||||
}, { concurrency: "unbounded" }),
|
||||
Effect.map((repertoire) => Object.freeze({
|
||||
...rest,
|
||||
|
||||
Reference in New Issue
Block a user