Handling Different Parameter Requirements for Prototype and Production Services

what's the right way to shape services with different paramaters. for example, im currently building out a prototype without any real implementation logic. for example, createUser just creates an arbitrary and returns it, doesn't require any inputs, but in production, i'll need an email address. for a prototype, the former is more than good enough, because i don't want to impelement a db for the prototyping phase, but i'm seeing an issue when defining services. My PatientLive service will fail because it requires a separate set of CreateUserParams than the prototype service. ALthough, obviously, the result should be the same, since I'll need to pipe it. What's the best way of handling this? Should I move the params schemas to the implmentation code and then do something like params: PrototypeCreateUserParams | LiveCreateUserParams?
import type { ArbitraryError } from "@/errors";
import { User } from "@/schemas/User";
import { Context, type Effect, type ParseResult, Schema } from "effect";

export const CreateUserParams = User.pipe(Schema.omit("id", "password"));
export type CreateUserParams = Schema.Schema.Type<typeof CreateUserParams>;

export const CreateUserResult = User;
export type CreateUserResult = Schema.Schema.Type<typeof CreateUserResult>;

export const GetUserByEmailParams = User.pipe(Schema.pick("email"));
export type GetUserByEmailParams = Schema.Schema.Type<
    typeof GetUserByEmailParams
>;

export const GetUserByEmailResult = User;
export type GetUserByEmailResult = Schema.Schema.Type<
    typeof GetUserByEmailResult
>;

export class Patient extends Context.Tag("Patient")<
    Patient,
    {
        readonly createUser: (
            params: CreateUserParams,
        ) => Effect.Effect<
            CreateUserResult,
            ParseResult.ParseError | ArbitraryError
        >;
        readonly getUserByEmail: (
            params: GetUserByEmailParams,
        ) => Effect.Effect<
            GetUserByEmailResult,
            ParseResult.ParseError | ArbitraryError
        >;
    }
>() {}
Was this page helpful?