Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain Modeling - Design Workflow: turn start #86

Open
kayac-chang opened this issue May 18, 2023 · 6 comments
Open

Domain Modeling - Design Workflow: turn start #86

kayac-chang opened this issue May 18, 2023 · 6 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@kayac-chang
Copy link
Collaborator

implement design of https://hackmd.io/KvV2Ou3HS9uN11OUpsAUzA?both#Workflow-turn-start

@kayac-chang kayac-chang added the help wanted Extra attention is needed label May 18, 2023
@JohnsonMao JohnsonMao self-assigned this Jun 1, 2023
@JohnsonMao
Copy link
Contributor

JohnsonMao commented Jun 1, 2023

Command

type TurnStartCommand = {
    playerId: string;
}

Event

type TurnStartEvent = {
    playerId: string;
}

Error

type TurnStartError = EventSourceWriteError

Type

type TurnStart = (eventsource: EventSource, command: TurnStartCommand) => ResultAsync<TurnStartEvent, TurnStartError>

Workflow

workflow: turn start
    input:
        event source
        turn start command
    output:
        async result of 
            ok -> turn start event
            err -> turn start error
    step:
        append event to event source
            if error occured:
                return event source write error
            otherwise:
                return turn start event

@kayac-chang
Copy link
Collaborator Author

@JohnsonMao
We don't have to check in turn start

  • assign role cards to all players,
  • place start and goal cards
  • deal cards to all players

every workflow just need to consider itself, validation could be separated out and integrate by composition.

@JohnsonMao
Copy link
Contributor

ok~

@kayac-chang
Copy link
Collaborator Author

@JohnsonMao
The design look good to me, could you create a PR to add types into @package/domain, thank you.

@kayac-chang
Copy link
Collaborator Author

Another thing I just wonder, why TurnStartCommand need to support array?

@JohnsonMao
Copy link
Contributor

I apologize for the misunderstanding.
I mistakenly thought "turn start" referred to "round start,"
but I have now adjusted the workflow and types accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants