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,
|
||||
|
||||
@@ -116,7 +116,7 @@ function RepertoireRow(props: RepertoireRow.Props) {
|
||||
piecesParts.push(<em>Brak</em>);
|
||||
} else {
|
||||
const CUTOFF = 10;
|
||||
let text = repertoire.entries.slice(0, CUTOFF).map(({ piece: { name } }) => name).join(", ");
|
||||
let text = repertoire.entries.slice(0, CUTOFF).map(({ name }) => name).join(", ");
|
||||
if (repertoire.entries.length > CUTOFF) {
|
||||
text += ", …";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user