Initial commit
This commit is contained in:
191
web/src/types.ts
Normal file
191
web/src/types.ts
Normal file
@@ -0,0 +1,191 @@
|
||||
export type ProjectStatus = "NOT_OPEN" | "RUNNING" | "PAUSED" | "ENDED" | "CLOSED" | "OPEN" | "FINISHED" | string;
|
||||
export type TicketStatus =
|
||||
| "WAITING"
|
||||
| "CALLED"
|
||||
| "ARRIVED"
|
||||
| "SERVING"
|
||||
| "COMPLETED"
|
||||
| "MISSED"
|
||||
| "CANCELED"
|
||||
| "CANCELLED"
|
||||
| string;
|
||||
|
||||
export interface UserDto {
|
||||
id: string;
|
||||
username: string;
|
||||
display_name?: string;
|
||||
role: string;
|
||||
}
|
||||
|
||||
export interface AdminUserDto extends UserDto {
|
||||
active: boolean;
|
||||
protected?: boolean;
|
||||
project_ids: string[];
|
||||
created_at?: string;
|
||||
}
|
||||
|
||||
export interface ProjectDto {
|
||||
id: string;
|
||||
code?: string;
|
||||
name: string;
|
||||
status: ProjectStatus;
|
||||
batch_size: number;
|
||||
call_batch_size?: number;
|
||||
ticket_prefix?: string;
|
||||
timezone?: string;
|
||||
grace_period_minutes?: number;
|
||||
visitor_notice?: string | null;
|
||||
eta?: {
|
||||
interval_per_number_seconds?: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ProjectProfilePayload {
|
||||
name: string;
|
||||
code: string;
|
||||
timezone: string;
|
||||
ticket_prefix: string;
|
||||
}
|
||||
|
||||
export interface AuthPayload {
|
||||
user: UserDto;
|
||||
projects: ProjectDto[];
|
||||
}
|
||||
|
||||
export interface QueueTicketDto {
|
||||
id: string;
|
||||
ticket_number: string;
|
||||
display_number?: string | null;
|
||||
phone?: string;
|
||||
phone_masked?: string | null;
|
||||
last_name?: string | null;
|
||||
honorific?: string | null;
|
||||
status: TicketStatus;
|
||||
created_at?: string | null;
|
||||
estimated_wait?: unknown;
|
||||
public_token?: string | null;
|
||||
public_url?: string | null;
|
||||
}
|
||||
|
||||
export interface CallBatchDto {
|
||||
id: string;
|
||||
batch_number: string | number;
|
||||
status: string;
|
||||
tickets: QueueTicketDto[];
|
||||
called_at?: string | null;
|
||||
}
|
||||
|
||||
export interface DeviceResultDto {
|
||||
channel: string;
|
||||
status: string;
|
||||
message?: string | null;
|
||||
}
|
||||
|
||||
export interface QueueSnapshotDto {
|
||||
project: ProjectDto;
|
||||
revision: string | number;
|
||||
waiting: QueueTicketDto[];
|
||||
current_batch?: CallBatchDto | null;
|
||||
recent_batches?: CallBatchDto[];
|
||||
metrics: {
|
||||
waiting_count: number;
|
||||
called_count?: number;
|
||||
estimated_wait?: unknown;
|
||||
last_ticket_number?: string | null;
|
||||
next_ticket_number?: string | null;
|
||||
};
|
||||
server_time?: string | null;
|
||||
last_success_at?: string | null;
|
||||
}
|
||||
|
||||
export interface CreateTicketPayload {
|
||||
phone: string;
|
||||
last_name?: string;
|
||||
honorific?: string;
|
||||
allow_duplicate?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateTicketResponse {
|
||||
ticket: QueueTicketDto;
|
||||
revision: string | number;
|
||||
}
|
||||
|
||||
export interface CallNextResponse {
|
||||
batch: CallBatchDto;
|
||||
revision: string | number;
|
||||
device_results: DeviceResultDto[];
|
||||
}
|
||||
|
||||
export interface PublicStatusDto {
|
||||
ticket_number: string;
|
||||
display_number?: string | null;
|
||||
phone_last4?: string;
|
||||
project_name: string;
|
||||
project?: {
|
||||
id?: string;
|
||||
name?: string;
|
||||
status?: ProjectStatus;
|
||||
};
|
||||
status: TicketStatus;
|
||||
people_ahead?: number | null;
|
||||
latest_called_number?: string | null;
|
||||
estimated_wait?: unknown;
|
||||
called_at?: string | null;
|
||||
last_updated_at?: string | null;
|
||||
entrance?: string | null;
|
||||
message?: string | null;
|
||||
visitor_notice?: string | null;
|
||||
}
|
||||
|
||||
export interface DisplaySnapshotDto {
|
||||
project_name: string;
|
||||
status: ProjectStatus;
|
||||
current_batch?: CallBatchDto | null;
|
||||
recent_batches: CallBatchDto[];
|
||||
waiting_count: number;
|
||||
estimated_wait?: unknown;
|
||||
last_updated_at?: string | null;
|
||||
device_status?: unknown;
|
||||
}
|
||||
|
||||
export interface AdminProjectDto extends Partial<ProjectDto> {
|
||||
id: string;
|
||||
name: string;
|
||||
status: ProjectStatus;
|
||||
waiting_count?: number;
|
||||
current_batch?: string | number | CallBatchDto | null;
|
||||
estimated_wait?: unknown;
|
||||
last_updated_at?: string | null;
|
||||
device_status?: unknown;
|
||||
}
|
||||
|
||||
export interface UpdateProjectSettingsPayload {
|
||||
status: string;
|
||||
call_batch_size: number;
|
||||
grace_period_minutes: number;
|
||||
eta_interval_seconds: number;
|
||||
visitor_notice: string;
|
||||
}
|
||||
|
||||
export interface AdminActiveTicketDto {
|
||||
id: string;
|
||||
project_id: string;
|
||||
project_name: string;
|
||||
ticket_number: string;
|
||||
phone: string;
|
||||
last_name?: string | null;
|
||||
honorific?: string | null;
|
||||
status: TicketStatus;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface AdminOverviewDto {
|
||||
summary: {
|
||||
running_projects: number;
|
||||
waiting_count: number;
|
||||
anomaly_projects: number;
|
||||
offline_devices: number;
|
||||
};
|
||||
projects: AdminProjectDto[];
|
||||
active_tickets: AdminActiveTicketDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user