export class Dataset extends Effect.Service<Dataset>()("app/Dataset", {
dependencies: [Harvest.Default, FetchHttpClient.layer], // <- These don't seem to do anything as I still need to pass the layer to the runtime
effect: Effect.Do.pipe(
Effect.bind("currentEntries", () => Harvest.allEntries(new Date().getFullYear())), // <- here I can define the scope when I call the runtime
Effect.let(
"entriesForYear",
() => (year: number) => Harvest.allEntries(year).pipe(Effect.scoped), // <- have to define scoped here since its on the return of the function?
),
Effect.let(
"educationReport",
() => (year: number) =>
Harvest.allEntries(year).pipe(
Effect.andThen(rollupEntries),
Effect.scoped,
),
),
),
accessors: true,
}) {}
export class Dataset extends Effect.Service<Dataset>()("app/Dataset", {
dependencies: [Harvest.Default, FetchHttpClient.layer], // <- These don't seem to do anything as I still need to pass the layer to the runtime
effect: Effect.Do.pipe(
Effect.bind("currentEntries", () => Harvest.allEntries(new Date().getFullYear())), // <- here I can define the scope when I call the runtime
Effect.let(
"entriesForYear",
() => (year: number) => Harvest.allEntries(year).pipe(Effect.scoped), // <- have to define scoped here since its on the return of the function?
),
Effect.let(
"educationReport",
() => (year: number) =>
Harvest.allEntries(year).pipe(
Effect.andThen(rollupEntries),
Effect.scoped,
),
),
),
accessors: true,
}) {}