chat implemented
need testing
This commit is contained in:
1 parent
c90f8cb1fa
commit
9cbdc35903
40 files changed
+7068
-10
No files matched your search
@@ -128,6 +128,13 @@ export const RECOMMENDATION_STATUSES = [
|
||||
] as const;
|
||||
export type RecommendationStatus = (typeof RECOMMENDATION_STATUSES)[number];
|
||||
|
||||
// Chat constants
|
||||
export const CHAT_THREAD_TYPES = ["gym", "dm"] as const;
|
||||
export type ChatThreadType = (typeof CHAT_THREAD_TYPES)[number];
|
||||
|
||||
export const CHAT_MESSAGE_KINDS = ["text", "system"] as const;
|
||||
export type ChatMessageKind = (typeof CHAT_MESSAGE_KINDS)[number];
|
||||
|
||||
// Helper functions to check enum values
|
||||
export function isValidUserRole(role: string): role is UserRole {
|
||||
return USER_ROLES.includes(role as UserRole);
|
||||
|
||||
@@ -13,6 +13,8 @@ import type {
|
||||
NotificationType,
|
||||
GymStatus,
|
||||
RecommendationStatus,
|
||||
ChatThreadType,
|
||||
ChatMessageKind,
|
||||
} from "../constants";
|
||||
|
||||
export interface User {
|
||||
@@ -239,6 +241,55 @@ export interface TrainerClientAssignment {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface ChatThread {
|
||||
id: string;
|
||||
type: ChatThreadType;
|
||||
gymId?: string;
|
||||
trainerId?: string;
|
||||
clientId?: string;
|
||||
createdBy: string;
|
||||
lastMessageAt?: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
archivedAt?: Date;
|
||||
}
|
||||
|
||||
export interface ChatThreadMember {
|
||||
id: string;
|
||||
threadId: string;
|
||||
userId: string;
|
||||
roleInThread: UserRole;
|
||||
joinedAt: Date;
|
||||
leftAt?: Date;
|
||||
muted: boolean;
|
||||
lastReadMessageId?: string;
|
||||
lastReadAt?: Date;
|
||||
}
|
||||
|
||||
export interface ChatMessage {
|
||||
id: string;
|
||||
threadId: string;
|
||||
senderUserId: string;
|
||||
body: string;
|
||||
kind: ChatMessageKind;
|
||||
attachments?: Array<{
|
||||
url: string;
|
||||
type: string;
|
||||
name?: string;
|
||||
}>;
|
||||
clientMessageId?: string;
|
||||
createdAt: Date;
|
||||
editedAt?: Date;
|
||||
deletedAt?: Date;
|
||||
}
|
||||
|
||||
export interface ChatMessageRead {
|
||||
id: string;
|
||||
messageId: string;
|
||||
userId: string;
|
||||
readAt: Date;
|
||||
}
|
||||
|
||||
// User Report Types
|
||||
export interface WeeklyCheckInStats {
|
||||
weekStart: string; // ISO 8601 date (YYYY-MM-DD)
|
||||
|
||||
Reference in new issue
Block a user