bad7366bdb
- create challange window - challanges view page - decline and accept - notif tab (wip) - active game window (wip) --------- Co-authored-by: shahdlala66 <shahd.lala66@gmail.com> Co-authored-by: Lala, Shahd <Shahd.Lala@sybit.de> Reviewed-on: #3
50 lines
1.0 KiB
TypeScript
50 lines
1.0 KiB
TypeScript
export type ChallengeStatus = 'created' | 'pending' | 'accepted' | 'declined' | 'cancelled' | 'expired';
|
|
|
|
export type PlayerColor = 'white' | 'black' | 'random';
|
|
|
|
export interface Player {
|
|
id: string;
|
|
name: string;
|
|
rating: number;
|
|
}
|
|
|
|
export interface TimeControl {
|
|
type: string | null;
|
|
limit: number | null;
|
|
increment: number | null;
|
|
}
|
|
|
|
export interface Challenge {
|
|
id: string;
|
|
challenger: Player;
|
|
destUser: Player;
|
|
variant: string;
|
|
color: PlayerColor;
|
|
timeControl: TimeControl;
|
|
status: ChallengeStatus;
|
|
declineReason: string | null;
|
|
gameId: string | null;
|
|
expiresAt: string;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface SendChallengeRequest {
|
|
timeControl: {
|
|
limitSeconds: number;
|
|
incrementSeconds: number;
|
|
};
|
|
color?: PlayerColor;
|
|
ttlSeconds?: number;
|
|
}
|
|
|
|
export interface ListChallengesResponse {
|
|
'in'?: Challenge[];
|
|
'out'?: Challenge[];
|
|
incoming?: Challenge[];
|
|
outgoing?: Challenge[];
|
|
}
|
|
|
|
export interface DeclineChallengeRequest {
|
|
reason?: string;
|
|
}
|