Files
mtusi2026lab3/src/domain/models.ts
T

72 lines
1.2 KiB
TypeScript

export interface User {
id: string;
username: string;
display_name: string;
created_at: string;
}
export interface CreateUserBody {
password: string;
username: string;
display_name: string;
}
export interface Session {
token: string;
token_type: 'Bearer';
expires_at: string;
user: User;
}
export interface Chat {
id: string;
title: string;
member_ids: string[];
created_at: string;
}
export interface CreateChatBody {
title: string;
member_ids: string[];
}
export interface Message {
id: string;
chat_id: string;
sender_id: string;
text: string;
created_at: string;
}
export interface CreateMessageBody {
text: string;
}
export interface Page<T> {
items: T[];
next_cursor: string | null;
}
export interface Health {
status: 'ok';
}
export type ErrorCode =
| 'invalid_request'
| 'unauthorized'
| 'not_found'
| 'conflict'
| 'payload_too_large'
| 'unsupported_media_type'
| 'rate_limited'
| 'unavailable'
| 'internal_error';
export interface ErrorResponse {
error: {
code: ErrorCode;
message: string;
request_id: string;
};
}