# README
Use case

- An engagement is initiated by an employer to reach out to a jobSeeker(via email/SMS/etc)
- The jobSeeker could respond with decline or accept
- If jobSeeker doesn't respond, it will get reminder
- An engagement can change from declined to accepted, but cannot change from accepted to declined
API requirements
- Start an engagement
- Describe an engagement
- Opt-out email reminder for an engagement
- Decline engagement
- Accept engagement
- Notify external systems about the engagement changes, with eventual consistency guarantee
- List engagements in different/any patterns (which would require a lot of indexes if using traditional DB)
- By employerId, status order by updateTime
- By jobSeekerId, status order by updateTime
- By employerId + jobSeekerId
- By status, order by updateTime
Design

Implementation Details
InitState
ReminderState
RPC
NotifyExtState
Controller
And controller is a very thin layer of calling iWF client APIs and workflow RPC stub APIs. See engagement_controller.
How to run
First of all, you need to register the required Search attributes
Search attribute requirement
If using Temporal:
- New CLI
tctl search-attribute create -name EmployerId -type Keyword -y
tctl search-attribute create -name JobSeekerId -type Keyword -y
tctl search-attribute create -name EngagementStatus -type Keyword -y
tctl search-attribute create -name LastUpdateTimeMillis -type Int -y
- Old CLI
tctl adm cl asa -n EmployerId -t Keyword
tctl adm cl asa -n JobSeekerId -t Keyword
tctl adm cl asa -n Status -t Keyword
tctl adm cl asa -n LastUpdateTimeMillis -t Int
If using Cadence
cadence adm cl asa --search_attr_key EmployerId --search_attr_type 1
cadence adm cl asa --search_attr_key JobSeekerId --search_attr_type 1
cadence adm cl asa --search_attr_key Status --search_attr_type 1
cadence adm cl asa --search_attr_key LastUpdateTimeMillis --search_attr_type 2
How to test the APIs in browser
- start API: http://localhost:8803/engagement/start
- It will return the workflowId which can be used in subsequence API calls.
- describe API: http://localhost:8803/engagement/describe?workflowId=
- opt-out email API: http://localhost:8803/engagement/optout?workflowId=
- decline API: http://localhost:8803/engagement/decline?workflowId=¬es=%22not%20interested%22
- accept API: http://localhost:8803/engagement/accept?workflowId=¬es=%27accept%27
- search API, use queries like:
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author