The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Domain from "@alchemy.run/domain"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | import { CustomerId } from "../Customer/Customer.id.ts"; |
| 4 | import { AccountId } from "./Account.id.ts"; |
| 5 | |
| 6 | export class AlreadyOpen extends Domain.Rejection("AlreadyOpen") {} |
| 7 | |
| 8 | export class AccountOpened extends Domain.Event("AccountOpened", { |
| 9 | customerId: CustomerId, |
| 10 | owner: Schema.String, |
| 11 | }) {} |
| 12 | |
| 13 | /** Open an account for a customer. Sent by `MainAccountProvisioning`. */ |
| 14 | export class OpenAccount extends Domain.Command("OpenAccount", { |
| 15 | target: AccountId, |
| 16 | input: { customerId: CustomerId, owner: Schema.String }, |
| 17 | events: [AccountOpened], |
| 18 | rejects: [AlreadyOpen], |
| 19 | }) {} |