Skip to content

Instantly share code, notes, and snippets.

@kirillrogovoy
Created April 10, 2018 09:42
Show Gist options
  • Save kirillrogovoy/e001f9d72818b45ab4f278e476bf303d to your computer and use it in GitHub Desktop.
Save kirillrogovoy/e001f9d72818b45ab4f278e476bf303d to your computer and use it in GitHub Desktop.
type ID = number
type Developer = {
id: ID
githubLogin: string
}
type Posting = {
id: ID
host: Developer
createdAt: Date
technologies: string[]
meansOfCommunication: string
description: string
state: PostingState
}
enum PostingState {
'active',
'partner_found',
'expired',
'cancelled'
}
type JoinRequest = {
id: ID
posting: Posting
requestee: Developer
state: JoinRequestState
}
enum JoinRequestState {
'pending',
'accepted',
'rejected',
'expired'
}
type PairProgrammingSession = {
id: ID
posting: Posting
partner: Developer
state: PairProgrammingSessionState
}
enum PairProgrammingSessionState {
'active',
'finished'
}
type Actions = {
posting: {
getAllActive (id: ID): Posting[]
create (posting: Posting): Posting
cancel (posting: Posting): Posting
expire (posting: Posting): Posting
prolong (posting: Posting): Posting
}
joinRequest: {
send (posting: Posting, requestee: Developer): JoinRequest
accept (request: JoinRequest): PairProgrammingSession
reject (request: JoinRequest): JoinRequest
}
pairProgrammingSession: {
finish (session: PairProgrammingSession): PairProgrammingSession
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment