File size: 3,911 Bytes
9a92a42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
export interface User {
    _id: string;
    username: string;
    email: string;
    role: 'trainee' | 'trainer' | 'organization' | 'admin';
    profilePhoto?: string;
    traineeCategory?: string;
    organization?: {
        _id: string;
        username: string;
        email: string;
        organizationType?: string;
    };
    workDesignation?: string;
    organizationType?: string;
    organizationVerificationStatus?: 'pending' | 'verified' | 'rejected';
    verificationStatus?: 'pending' | 'approved' | 'rejected';
    createdAt: string;
    lastActive: string;
    isActive: boolean;
    documents?: {
        registrationCertificate?: string;
        gstCertificate?: string;
        authorizationLetter?: string;
        additionalDocs?: string[];
    };
    isTwoFactorEnabled?: boolean;
    location?: {
        type: "Point";
        coordinates: [number, number];
    };
    rejectionReason?: string;
    govtIdCard?: string;
    documentsUploaded?: boolean;
}

export interface LoginRequest {
    email: string;
    password: string;
}

export interface LoginResponse {
    token: string;
    user: User;
    requires2FASetup?: boolean;
    requiresDocumentUpload?: boolean;
    message?: string;
}

export interface SignupTraineeRequest {
    username: string;
    email: string;
    password: string;
    traineeCategory?: string;
}

export interface SignupTrainerRequest {
    username: string;
    email: string;
    password: string;
    organization: string;
    workDesignation: string;
    govtIdCard?: string;
}

export interface SignupOrganizationRequest {
    username: string;
    email: string;
    password: string;
    organizationType: string;
}

export interface ChangePasswordRequest {
    currentPassword: string;
    newPassword: string;
}

export interface ResetPasswordRequest {
    password: string;
}

export interface ForgotPasswordRequest {
    email: string;
}

export interface UpdateUserRequest {
    username?: string;
    email?: string;
    traineeCategory?: string;
    workDesignation?: string;
    organizationType?: string;
    [key: string]: any;
}

export interface VerifyTrainerRequest {
    trainerId: string;
    status: 'verified' | 'rejected';
}

export interface VerifyOrganizationRequest {
    organizationId: string;
    status: 'approved' | 'rejected';
}

export interface Organization {
    _id: string;
    username: string;
    email: string;
    organizationType?: string;
}

export interface PendingTrainer {
    _id: string;
    username: string;
    email: string;
    workDesignation: string;
    govtIdCard?: string;
    createdAt: string;
}

export interface PendingOrganization {
    _id: string;
    username: string;
    email: string;
    organizationType?: string;
    documents?: any;
    createdAt: string;
}

// types/event.ts
export interface IGeoPoint {
    type: "Point";
    coordinates: [number, number]; // [lng, lat]
}

export interface IEventParticipant {
    user: string;
    joinedAt: Date;
    joinMethod: 'code' | 'link' | 'qr' | 'manual';
    attendance?: {
        checkInTime?: Date;
        checkInMethod?: 'qr' | 'gps' | 'link' | 'manual';
        checkInLocation?: IGeoPoint;
    };
}

export interface IEvent {
    _id: string;
    title: string;
    code: string;
    theme: string;
    description?: string;
    organization: string;
    createdBy: string;
    capacity: number;
    startDate: Date;
    endDate: Date;
    type: 'in-person' | 'online' | 'hybrid';
    venue?: string;
    location?: IGeoPoint;
    geofenceRadius?: number;
    onlineLink?: string;
    joinToken: string;
    allowSelfJoin: boolean;
    participants: IEventParticipant[];
    waitlist: string[];
    status: 'draft' | 'published' | 'ongoing' | 'completed' | 'cancelled';
    reminderSent: boolean;
    createdAt: Date;
    updatedAt: Date;
}

export type EventStatus = 'ongoing' | 'upcoming' | 'completed' | 'cancelled';