export class ItemsList extends S.TaggedRequest<ItemsList>()("ItemsList", {
failure: S.String,
success: S.Union(Crates, Skins, Stickers),
payload: { tableName: S.String, schema: S.Union(Crates, Skins, Stickers) },
}) {}
export const GetItemsMarketHashNames = Rpc.effect(
ItemsList,
({ tableName, schema }) =>
E.gen(function* () {
const db = yield* Surrealdb;
const items = yield* db.getItems(tableName, ["id", "market_hash_name"])
.pipe(
E.andThen(S.decodeUnknown(schema)),
);
return items;
}).pipe(E.either, E.andThen(Either.mapLeft((e) => String(e)))),
);
export class ItemsList extends S.TaggedRequest<ItemsList>()("ItemsList", {
failure: S.String,
success: S.Union(Crates, Skins, Stickers),
payload: { tableName: S.String, schema: S.Union(Crates, Skins, Stickers) },
}) {}
export const GetItemsMarketHashNames = Rpc.effect(
ItemsList,
({ tableName, schema }) =>
E.gen(function* () {
const db = yield* Surrealdb;
const items = yield* db.getItems(tableName, ["id", "market_hash_name"])
.pipe(
E.andThen(S.decodeUnknown(schema)),
);
return items;
}).pipe(E.either, E.andThen(Either.mapLeft((e) => String(e)))),
);