Files
NowChess-Frontend/src/app/models/challenge.models.ts
T
shosho996 bad7366bdb feat: NCS-69 Challenge request (#3)
- 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
2026-05-12 22:38:57 +02:00

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;
}