Created
April 10, 2018 09:42
-
-
Save kirillrogovoy/e001f9d72818b45ab4f278e476bf303d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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