@updraft-solutions/mcrit-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +240 -0
- package/dist/chunk-2DRKSYW4.cjs +99 -0
- package/dist/chunk-2M32EOYI.js +145 -0
- package/dist/chunk-AN55SAGU.js +1189 -0
- package/dist/chunk-D5DUVW34.js +176 -0
- package/dist/chunk-HQSF3WGF.cjs +14 -0
- package/dist/chunk-JGIAOBZI.js +99 -0
- package/dist/chunk-JRVRIKNM.cjs +168 -0
- package/dist/chunk-LVTDNDWE.cjs +124 -0
- package/dist/chunk-LXNCAKJZ.js +0 -0
- package/dist/chunk-MF7G76QS.cjs +176 -0
- package/dist/chunk-MI4YBENQ.cjs +145 -0
- package/dist/chunk-MOOGM3DW.cjs +1 -0
- package/dist/chunk-NQV2D3FJ.js +14 -0
- package/dist/chunk-TJXWL42D.js +124 -0
- package/dist/chunk-VYT5KQWF.js +168 -0
- package/dist/chunk-XKZQ5W7E.cjs +1189 -0
- package/dist/courses/index.cjs +7 -0
- package/dist/courses/index.d.cts +58 -0
- package/dist/courses/index.d.ts +58 -0
- package/dist/courses/index.js +7 -0
- package/dist/crew/index.cjs +10 -0
- package/dist/crew/index.d.cts +102 -0
- package/dist/crew/index.d.ts +102 -0
- package/dist/crew/index.js +10 -0
- package/dist/crew/vue.cjs +34 -0
- package/dist/crew/vue.d.cts +31 -0
- package/dist/crew/vue.d.ts +31 -0
- package/dist/crew/vue.js +34 -0
- package/dist/format/index.cjs +44 -0
- package/dist/format/index.d.cts +69 -0
- package/dist/format/index.d.ts +69 -0
- package/dist/format/index.js +44 -0
- package/dist/index.cjs +261 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +261 -0
- package/dist/media/index.cjs +30 -0
- package/dist/media/index.d.cts +89 -0
- package/dist/media/index.d.ts +89 -0
- package/dist/media/index.js +30 -0
- package/dist/models-CY3MmvCg.d.cts +33801 -0
- package/dist/models-CY3MmvCg.d.ts +33801 -0
- package/dist/money/index.cjs +18 -0
- package/dist/money/index.d.cts +66 -0
- package/dist/money/index.d.ts +66 -0
- package/dist/money/index.js +18 -0
- package/dist/pagination/index.cjs +6 -0
- package/dist/pagination/index.d.cts +16 -0
- package/dist/pagination/index.d.ts +16 -0
- package/dist/pagination/index.js +6 -0
- package/dist/schemas/index.cjs +158 -0
- package/dist/schemas/index.d.cts +1019 -0
- package/dist/schemas/index.d.ts +1019 -0
- package/dist/schemas/index.js +158 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +143 -0
- package/dist/types/index.d.ts +143 -0
- package/dist/types/index.js +1 -0
- package/package.json +171 -0
- package/src/courses/index.ts +202 -0
- package/src/crew/index.ts +255 -0
- package/src/crew/vue.ts +70 -0
- package/src/format/index.ts +265 -0
- package/src/index.ts +76 -0
- package/src/media/index.ts +224 -0
- package/src/money/index.ts +168 -0
- package/src/pagination/index.ts +27 -0
- package/src/schemas/common.ts +73 -0
- package/src/schemas/faq.ts +94 -0
- package/src/schemas/fee.ts +37 -0
- package/src/schemas/index.ts +6 -0
- package/src/schemas/models.ts +996 -0
- package/src/schemas/report.ts +306 -0
- package/src/schemas/safety-report.ts +163 -0
- package/src/types/api.ts +37 -0
- package/src/types/compliance.ts +44 -0
- package/src/types/index.ts +3 -0
- package/src/types/models.ts +124 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// Report Status Types
|
|
2
|
+
export type ReportStatus = "pending" | "processing" | "completed" | "failed";
|
|
3
|
+
|
|
4
|
+
// Report Type Enum
|
|
5
|
+
export type ReportType =
|
|
6
|
+
| "financial"
|
|
7
|
+
| "operational"
|
|
8
|
+
| "instructor_efficiency"
|
|
9
|
+
| "company_development";
|
|
10
|
+
|
|
11
|
+
// Granularity Options
|
|
12
|
+
export type ReportGranularity =
|
|
13
|
+
| "total"
|
|
14
|
+
| "yearly"
|
|
15
|
+
| "quarterly"
|
|
16
|
+
| "monthly"
|
|
17
|
+
| "weekly"
|
|
18
|
+
| "daily";
|
|
19
|
+
|
|
20
|
+
// Media Type (matching backend MediaResource)
|
|
21
|
+
export interface Media {
|
|
22
|
+
type: "media";
|
|
23
|
+
id: number;
|
|
24
|
+
description?: string;
|
|
25
|
+
url: string | null;
|
|
26
|
+
mime_type: string;
|
|
27
|
+
file_name: string;
|
|
28
|
+
size: number;
|
|
29
|
+
collection_name: string;
|
|
30
|
+
created_at: string;
|
|
31
|
+
updated_at: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Media Collection (for reports - only PDF)
|
|
35
|
+
export interface ReportMedia {
|
|
36
|
+
pdf?: Media | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Base Report Interface
|
|
40
|
+
export interface Report {
|
|
41
|
+
id: number;
|
|
42
|
+
reportable_type: string;
|
|
43
|
+
reportable_id: number;
|
|
44
|
+
report_type: ReportType;
|
|
45
|
+
parameters: ReportParameters;
|
|
46
|
+
data: ReportData;
|
|
47
|
+
metadata: ReportMetadata;
|
|
48
|
+
status: ReportStatus;
|
|
49
|
+
generated_at: string | null;
|
|
50
|
+
expires_at: string | null;
|
|
51
|
+
created_at: string;
|
|
52
|
+
updated_at: string;
|
|
53
|
+
media?: ReportMedia;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Report Parameters
|
|
57
|
+
export interface ReportParameters {
|
|
58
|
+
start_date?: string | null;
|
|
59
|
+
end_date?: string | null;
|
|
60
|
+
granularity: ReportGranularity;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Report Generation Parameters (for API requests)
|
|
64
|
+
export interface ReportGenerationParams {
|
|
65
|
+
type: ReportType;
|
|
66
|
+
start_date?: string | null;
|
|
67
|
+
end_date?: string | null;
|
|
68
|
+
granularity?: ReportGranularity;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Report Metadata
|
|
72
|
+
export interface ReportMetadata {
|
|
73
|
+
requested_by?: number;
|
|
74
|
+
requested_at?: string;
|
|
75
|
+
started_at?: string;
|
|
76
|
+
completed_at?: string;
|
|
77
|
+
duration_seconds?: number;
|
|
78
|
+
attempt?: number;
|
|
79
|
+
error?: string;
|
|
80
|
+
batch?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Base structure for period-based data
|
|
84
|
+
export interface PeriodData<T> {
|
|
85
|
+
summary: T;
|
|
86
|
+
by_period?: Record<string, T>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Generic Report Data
|
|
90
|
+
export type ReportData =
|
|
91
|
+
| FinancialReportData
|
|
92
|
+
| OperationalReportData
|
|
93
|
+
| InstructorEfficiencyReportData
|
|
94
|
+
| CompanyDevelopmentReportData;
|
|
95
|
+
|
|
96
|
+
// =====================
|
|
97
|
+
// Financial Report Types
|
|
98
|
+
// =====================
|
|
99
|
+
|
|
100
|
+
export interface FinancialReportData {
|
|
101
|
+
revenue: PeriodData<RevenueData>;
|
|
102
|
+
expenses: PeriodData<ExpenseData>;
|
|
103
|
+
invoices: PeriodData<InvoiceData>;
|
|
104
|
+
prepaid_packages: PeriodData<PrepaidPackageData>;
|
|
105
|
+
summary: PeriodData<FinancialSummaryData>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface RevenueData {
|
|
109
|
+
total_gross: number;
|
|
110
|
+
total_net: number;
|
|
111
|
+
by_type: Record<string, number>;
|
|
112
|
+
count?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface ExpenseData {
|
|
116
|
+
total_gross: number;
|
|
117
|
+
total_net: number;
|
|
118
|
+
by_category: Record<string, number>;
|
|
119
|
+
count?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface InvoiceData {
|
|
123
|
+
total_count: number;
|
|
124
|
+
total_gross: number;
|
|
125
|
+
by_status: Record<string, number>;
|
|
126
|
+
by_paid_status: Record<string, number>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface PrepaidPackageData {
|
|
130
|
+
total_packages: number;
|
|
131
|
+
total_initial_value: number;
|
|
132
|
+
total_remaining_value: number;
|
|
133
|
+
total_used_value: number;
|
|
134
|
+
usage_percentage: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface FinancialSummaryData {
|
|
138
|
+
total_revenue: number;
|
|
139
|
+
total_expenses: number;
|
|
140
|
+
profit: number;
|
|
141
|
+
profit_margin: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// =====================
|
|
145
|
+
// Operational Report Types
|
|
146
|
+
// =====================
|
|
147
|
+
|
|
148
|
+
export interface OperationalReportData {
|
|
149
|
+
flight_hours: FlightHoursData;
|
|
150
|
+
bookings: BookingsData;
|
|
151
|
+
landings: LandingsData;
|
|
152
|
+
aircraft_utilization: AircraftUtilization[];
|
|
153
|
+
member_activity: MemberActivityData;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface FlightHoursData {
|
|
157
|
+
total_hours: number;
|
|
158
|
+
total_flights: number;
|
|
159
|
+
average_flight_hours: number;
|
|
160
|
+
by_month?: Record<string, number>;
|
|
161
|
+
by_period?: Record<
|
|
162
|
+
string,
|
|
163
|
+
{
|
|
164
|
+
hours: number;
|
|
165
|
+
flights: number;
|
|
166
|
+
average: number;
|
|
167
|
+
}
|
|
168
|
+
>;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface BookingsData {
|
|
172
|
+
total_bookings: number;
|
|
173
|
+
completion_rate: number;
|
|
174
|
+
average_efficiency: number;
|
|
175
|
+
by_status: Record<string, number>;
|
|
176
|
+
by_period?: Record<
|
|
177
|
+
string,
|
|
178
|
+
{
|
|
179
|
+
total: number;
|
|
180
|
+
completed: number;
|
|
181
|
+
cancelled: number;
|
|
182
|
+
}
|
|
183
|
+
>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface LandingsData {
|
|
187
|
+
total_landings: number;
|
|
188
|
+
full_stop_landings: number;
|
|
189
|
+
touch_and_gos: number;
|
|
190
|
+
top_airports: Array<{
|
|
191
|
+
airport_code: string;
|
|
192
|
+
airport_name: string;
|
|
193
|
+
count: number;
|
|
194
|
+
}>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface AircraftUtilization {
|
|
198
|
+
aircraft_id: number;
|
|
199
|
+
aircraft_registration: string;
|
|
200
|
+
aircraft_name: string;
|
|
201
|
+
total_hours: number;
|
|
202
|
+
total_bookings: number;
|
|
203
|
+
utilization_rate: number;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface MemberActivityData {
|
|
207
|
+
top_pilots: Array<{
|
|
208
|
+
member_id: number;
|
|
209
|
+
member_name: string;
|
|
210
|
+
flight_hours: number;
|
|
211
|
+
booking_count: number;
|
|
212
|
+
}>;
|
|
213
|
+
total_active_members: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// =====================
|
|
217
|
+
// Instructor Efficiency Report Types
|
|
218
|
+
// =====================
|
|
219
|
+
|
|
220
|
+
export interface InstructorEfficiencyReportData {
|
|
221
|
+
instructors: InstructorData[];
|
|
222
|
+
summary: InstructorSummaryData;
|
|
223
|
+
period: {
|
|
224
|
+
start_date: string;
|
|
225
|
+
end_date: string;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface InstructorData {
|
|
230
|
+
instructor_id: number;
|
|
231
|
+
instructor_name: string;
|
|
232
|
+
instructor_email: string;
|
|
233
|
+
total_bookings: number;
|
|
234
|
+
average_efficiency: number;
|
|
235
|
+
average_delay_minutes: number;
|
|
236
|
+
total_flight_hours: number;
|
|
237
|
+
bookings_with_efficiency: number;
|
|
238
|
+
by_period?: Record<
|
|
239
|
+
string,
|
|
240
|
+
{
|
|
241
|
+
bookings: number;
|
|
242
|
+
efficiency: number;
|
|
243
|
+
delay: number;
|
|
244
|
+
hours: number;
|
|
245
|
+
}
|
|
246
|
+
>;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface InstructorSummaryData {
|
|
250
|
+
total_instructors: number;
|
|
251
|
+
average_efficiency_overall: number;
|
|
252
|
+
average_delay_overall: number;
|
|
253
|
+
total_bookings_overall: number;
|
|
254
|
+
total_flight_hours_overall: number;
|
|
255
|
+
best_performer: {
|
|
256
|
+
name: string;
|
|
257
|
+
efficiency: number;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// =====================
|
|
262
|
+
// Company Development Report Types
|
|
263
|
+
// =====================
|
|
264
|
+
|
|
265
|
+
export interface CompanyDevelopmentReportData {
|
|
266
|
+
summary?: Record<string, any>;
|
|
267
|
+
metrics?: Record<string, any>;
|
|
268
|
+
by_period?: Record<string, any>;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// =====================
|
|
272
|
+
// Helper Types
|
|
273
|
+
// =====================
|
|
274
|
+
|
|
275
|
+
// Report list item for display in tables/lists
|
|
276
|
+
export interface ReportListItem {
|
|
277
|
+
id: number;
|
|
278
|
+
type: ReportType;
|
|
279
|
+
status: ReportStatus;
|
|
280
|
+
created_at: string;
|
|
281
|
+
generated_at: string | null;
|
|
282
|
+
parameters: ReportParameters;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Report generation response
|
|
286
|
+
export interface ReportGenerationResponse {
|
|
287
|
+
message: string;
|
|
288
|
+
data?: Report | Report[];
|
|
289
|
+
skipped?: Array<{
|
|
290
|
+
type: ReportType;
|
|
291
|
+
message: string;
|
|
292
|
+
report: Report;
|
|
293
|
+
}>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Report status response
|
|
297
|
+
export interface ReportStatusResponse {
|
|
298
|
+
data: {
|
|
299
|
+
id: number;
|
|
300
|
+
status: ReportStatus;
|
|
301
|
+
report_type: ReportType;
|
|
302
|
+
created_at: string;
|
|
303
|
+
generated_at: string | null;
|
|
304
|
+
metadata: ReportMetadata;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// Status Enum
|
|
4
|
+
export const SafetyReportStatusEnum = z.enum([
|
|
5
|
+
"new",
|
|
6
|
+
"under_review",
|
|
7
|
+
"action_taken",
|
|
8
|
+
"closed",
|
|
9
|
+
]);
|
|
10
|
+
export type SafetyReportStatus = z.infer<typeof SafetyReportStatusEnum>;
|
|
11
|
+
|
|
12
|
+
// Safety Report Category Schema
|
|
13
|
+
export const SafetyReportCategorySchema = z.object({
|
|
14
|
+
id: z.number(),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
description: z.string().nullable(),
|
|
17
|
+
color: z.string(),
|
|
18
|
+
sort_order: z.number(),
|
|
19
|
+
is_active: z.boolean(),
|
|
20
|
+
is_global: z.boolean().optional(),
|
|
21
|
+
created_at: z.string().optional(),
|
|
22
|
+
updated_at: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type SafetyReportCategory = z.infer<typeof SafetyReportCategorySchema>;
|
|
26
|
+
|
|
27
|
+
// Safety Report Category Form Schema (for creating/updating)
|
|
28
|
+
export const SafetyReportCategoryFormSchema = z.object({
|
|
29
|
+
name: z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1, "Name is required")
|
|
32
|
+
.max(100, "Name must be at most 100 characters"),
|
|
33
|
+
description: z.string().max(500).nullable().optional(),
|
|
34
|
+
color: z
|
|
35
|
+
.string()
|
|
36
|
+
.regex(/^#[0-9A-Fa-f]{6}$/, "Invalid hex color")
|
|
37
|
+
.nullable()
|
|
38
|
+
.optional(),
|
|
39
|
+
sort_order: z.number().int().min(0).optional(),
|
|
40
|
+
is_active: z.boolean().optional(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export type SafetyReportCategoryForm = z.infer<
|
|
44
|
+
typeof SafetyReportCategoryFormSchema
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
// Media Schema (for attachments)
|
|
48
|
+
export const SafetyReportMediaSchema = z.object({
|
|
49
|
+
id: z.number(),
|
|
50
|
+
file_name: z.string(),
|
|
51
|
+
mime_type: z.string(),
|
|
52
|
+
size: z.number(),
|
|
53
|
+
url: z.string().nullable(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export type SafetyReportMedia = z.infer<typeof SafetyReportMediaSchema>;
|
|
57
|
+
|
|
58
|
+
// Safety Report Schema (from API)
|
|
59
|
+
export const SafetyReportSchema = z.object({
|
|
60
|
+
id: z.number(),
|
|
61
|
+
incident_date: z.string(),
|
|
62
|
+
location: z.string().nullable(),
|
|
63
|
+
description: z.string(),
|
|
64
|
+
status: SafetyReportStatusEnum,
|
|
65
|
+
is_archived: z.boolean(),
|
|
66
|
+
category: SafetyReportCategorySchema.nullable().optional(),
|
|
67
|
+
attachments: z.array(SafetyReportMediaSchema).optional(),
|
|
68
|
+
attachments_count: z.number().optional(),
|
|
69
|
+
created_at: z.string(),
|
|
70
|
+
updated_at: z.string(),
|
|
71
|
+
can: z.record(z.string(), z.boolean()).optional(),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export type SafetyReport = z.infer<typeof SafetyReportSchema>;
|
|
75
|
+
|
|
76
|
+
// Safety Report List Response (paginated)
|
|
77
|
+
export const SafetyReportListResponseSchema = z.object({
|
|
78
|
+
data: z.array(SafetyReportSchema),
|
|
79
|
+
links: z
|
|
80
|
+
.object({
|
|
81
|
+
first: z.string().nullable().optional(),
|
|
82
|
+
last: z.string().nullable().optional(),
|
|
83
|
+
prev: z.string().nullable().optional(),
|
|
84
|
+
next: z.string().nullable().optional(),
|
|
85
|
+
})
|
|
86
|
+
.optional(),
|
|
87
|
+
meta: z
|
|
88
|
+
.object({
|
|
89
|
+
current_page: z.number(),
|
|
90
|
+
from: z.number().nullable(),
|
|
91
|
+
last_page: z.number(),
|
|
92
|
+
per_page: z.number(),
|
|
93
|
+
to: z.number().nullable(),
|
|
94
|
+
total: z.number(),
|
|
95
|
+
})
|
|
96
|
+
.optional(),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export type SafetyReportListResponse = z.infer<
|
|
100
|
+
typeof SafetyReportListResponseSchema
|
|
101
|
+
>;
|
|
102
|
+
|
|
103
|
+
// Safety Report Form Schema (for submission)
|
|
104
|
+
export const SafetyReportFormSchema = z.object({
|
|
105
|
+
incident_date: z.string().min(1, "Incident date is required"),
|
|
106
|
+
location: z.string().max(255).nullable().optional(),
|
|
107
|
+
description: z
|
|
108
|
+
.string()
|
|
109
|
+
.min(10, "Description must be at least 10 characters")
|
|
110
|
+
.max(10000, "Description must be at most 10000 characters"),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export type SafetyReportForm = z.infer<typeof SafetyReportFormSchema>;
|
|
114
|
+
|
|
115
|
+
// Safety Report Update Schema (for admin updates)
|
|
116
|
+
export const SafetyReportUpdateSchema = z.object({
|
|
117
|
+
status: SafetyReportStatusEnum.optional(),
|
|
118
|
+
category_id: z.number().nullable().optional(),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export type SafetyReportUpdate = z.infer<typeof SafetyReportUpdateSchema>;
|
|
122
|
+
|
|
123
|
+
// Filter Schema (for querying reports)
|
|
124
|
+
export const SafetyReportFilterSchema = z.object({
|
|
125
|
+
status: SafetyReportStatusEnum.optional(),
|
|
126
|
+
category_id: z.number().optional(),
|
|
127
|
+
date_from: z.string().optional(),
|
|
128
|
+
date_to: z.string().optional(),
|
|
129
|
+
include_archived: z.boolean().optional(),
|
|
130
|
+
search: z.string().optional(),
|
|
131
|
+
sort: z.enum(["incident_date", "created_at", "status"]).optional(),
|
|
132
|
+
direction: z.enum(["asc", "desc"]).optional(),
|
|
133
|
+
per_page: z.number().optional(),
|
|
134
|
+
page: z.number().optional(),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export type SafetyReportFilter = z.infer<typeof SafetyReportFilterSchema>;
|
|
138
|
+
|
|
139
|
+
// Submission Response (minimal, for anonymity)
|
|
140
|
+
export const SafetyReportSubmissionResponseSchema = z.object({
|
|
141
|
+
message: z.string(),
|
|
142
|
+
submitted: z.boolean(),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export type SafetyReportSubmissionResponse = z.infer<
|
|
146
|
+
typeof SafetyReportSubmissionResponseSchema
|
|
147
|
+
>;
|
|
148
|
+
|
|
149
|
+
// Status Labels for UI
|
|
150
|
+
export const SAFETY_REPORT_STATUS_LABELS: Record<SafetyReportStatus, string> = {
|
|
151
|
+
new: "New",
|
|
152
|
+
under_review: "Under Review",
|
|
153
|
+
action_taken: "Action Taken",
|
|
154
|
+
closed: "Closed",
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// Status Colors for UI
|
|
158
|
+
export const SAFETY_REPORT_STATUS_COLORS: Record<SafetyReportStatus, string> = {
|
|
159
|
+
new: "info",
|
|
160
|
+
under_review: "warning",
|
|
161
|
+
action_taken: "primary",
|
|
162
|
+
closed: "success",
|
|
163
|
+
};
|
package/src/types/api.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic response wrapper for data with optional metadata
|
|
3
|
+
* @template T - The data type
|
|
4
|
+
* @template M - The metadata type (optional)
|
|
5
|
+
*/
|
|
6
|
+
export interface DataWrappedResponse<T, M = undefined> {
|
|
7
|
+
data: T;
|
|
8
|
+
meta?: M;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PaginatedResponse<T = any> {
|
|
12
|
+
data: T[];
|
|
13
|
+
meta: {
|
|
14
|
+
current_page: number;
|
|
15
|
+
from: number;
|
|
16
|
+
last_page: number;
|
|
17
|
+
per_page: number;
|
|
18
|
+
to: number;
|
|
19
|
+
total: number;
|
|
20
|
+
};
|
|
21
|
+
links?: {
|
|
22
|
+
first?: string | null;
|
|
23
|
+
last?: string | null;
|
|
24
|
+
prev?: string | null;
|
|
25
|
+
next?: string | null;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Resource {
|
|
30
|
+
id: number;
|
|
31
|
+
type: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface ToggleFavoriteResponse {
|
|
35
|
+
id: number;
|
|
36
|
+
hasFavorited: boolean;
|
|
37
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface ComplianceRequirement {
|
|
2
|
+
requirement_id: number;
|
|
3
|
+
document_type_class: string;
|
|
4
|
+
document_type_label: string;
|
|
5
|
+
logical_group: string;
|
|
6
|
+
is_satisfied: boolean;
|
|
7
|
+
document: any | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ComplianceRequirementGroup {
|
|
11
|
+
group_name: string;
|
|
12
|
+
group_operator: "AND" | "OR";
|
|
13
|
+
group_satisfied: boolean;
|
|
14
|
+
requirements: ComplianceRequirement[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ComplianceGroup {
|
|
18
|
+
group_id: number;
|
|
19
|
+
group_name: string;
|
|
20
|
+
overall_satisfied: boolean;
|
|
21
|
+
requirement_groups: ComplianceRequirementGroup[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ComplianceSummary {
|
|
25
|
+
total_groups: number;
|
|
26
|
+
satisfied_groups: number;
|
|
27
|
+
failed_groups: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ComplianceData {
|
|
31
|
+
overall_satisfied: boolean;
|
|
32
|
+
requirement_groups: ComplianceGroup[];
|
|
33
|
+
summary: ComplianceSummary;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ComplianceResponse {
|
|
37
|
+
data: ComplianceData;
|
|
38
|
+
meta: {
|
|
39
|
+
model_id: string;
|
|
40
|
+
model_type: string;
|
|
41
|
+
target_model_id: string;
|
|
42
|
+
target_model_type: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type * as Common from "../schemas/common";
|
|
3
|
+
import type * as ModelSchemas from "../schemas/models";
|
|
4
|
+
|
|
5
|
+
// Common types
|
|
6
|
+
export type BaseModel = z.infer<typeof Common.BaseModel>;
|
|
7
|
+
export type User = z.infer<typeof Common.userSchema>;
|
|
8
|
+
export type Company = z.infer<typeof Common.companySchema>;
|
|
9
|
+
export type Media = z.infer<typeof Common.mediaSchema>;
|
|
10
|
+
export type MediaCollection = z.infer<typeof Common.mediaCollection>;
|
|
11
|
+
|
|
12
|
+
// Membership types
|
|
13
|
+
export type BaseMembership = z.infer<typeof ModelSchemas.baseMembershipSchema>;
|
|
14
|
+
export type Membership = z.infer<typeof ModelSchemas.membershipSchema>;
|
|
15
|
+
|
|
16
|
+
// Airplane types
|
|
17
|
+
export type Airplane = z.infer<typeof ModelSchemas.airplaneSchema>;
|
|
18
|
+
export type ExtendedAirplane = z.infer<
|
|
19
|
+
typeof ModelSchemas.extendedAirplaneSchema
|
|
20
|
+
>;
|
|
21
|
+
export type AirplanePermission = z.infer<
|
|
22
|
+
typeof ModelSchemas.airplanePermissionSchema
|
|
23
|
+
>;
|
|
24
|
+
export type LandingFee = z.infer<typeof ModelSchemas.landingFeeSchema>;
|
|
25
|
+
export type AircraftRating = z.infer<typeof ModelSchemas.aircraftRatingSchema>;
|
|
26
|
+
export type UserAircraftRating = z.infer<
|
|
27
|
+
typeof ModelSchemas.userAircraftRatingSchema
|
|
28
|
+
>;
|
|
29
|
+
export type UserQualification = z.infer<
|
|
30
|
+
typeof ModelSchemas.userQualificationSchema
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
// Airport types
|
|
34
|
+
export type Airport = z.infer<typeof ModelSchemas.airportSchema>;
|
|
35
|
+
export type RecurringFlight = z.infer<
|
|
36
|
+
typeof ModelSchemas.recurringFlightSchema
|
|
37
|
+
>;
|
|
38
|
+
|
|
39
|
+
// Fee types
|
|
40
|
+
export type Fee = z.infer<typeof ModelSchemas.feeSchema>;
|
|
41
|
+
export type CourseFee = z.infer<typeof ModelSchemas.courseFeeSchema>;
|
|
42
|
+
export type Price = z.infer<typeof ModelSchemas.priceSchema>;
|
|
43
|
+
|
|
44
|
+
// Maintenance types
|
|
45
|
+
export type MaintenanceEvent = z.infer<
|
|
46
|
+
typeof ModelSchemas.maintenanceEventSchema
|
|
47
|
+
>;
|
|
48
|
+
export type MaintenanceStatus = z.infer<
|
|
49
|
+
typeof ModelSchemas.maintenanceStatusSchema
|
|
50
|
+
>;
|
|
51
|
+
export type MaintenanceEventEstimation = z.infer<
|
|
52
|
+
typeof ModelSchemas.maintenanceEventEstimationSchema
|
|
53
|
+
>;
|
|
54
|
+
|
|
55
|
+
// Booking types
|
|
56
|
+
export type Avail = z.infer<typeof ModelSchemas.availSchema>;
|
|
57
|
+
export type Alert = z.infer<typeof ModelSchemas.alertSchema>;
|
|
58
|
+
export type Booking = z.infer<typeof ModelSchemas.bookingSchema>;
|
|
59
|
+
|
|
60
|
+
// Document Manager Types
|
|
61
|
+
export type Document = z.infer<typeof ModelSchemas.documentSchema>;
|
|
62
|
+
export type DocumentType = z.infer<typeof ModelSchemas.documentType>;
|
|
63
|
+
export type DocumentRequirement = z.infer<
|
|
64
|
+
typeof ModelSchemas.documentRequirement
|
|
65
|
+
>;
|
|
66
|
+
export type DocumentRequirementGroup = z.infer<
|
|
67
|
+
typeof ModelSchemas.documentRequirementGroup
|
|
68
|
+
>;
|
|
69
|
+
export type DocumentRequirementGroupAssignment = z.infer<
|
|
70
|
+
typeof ModelSchemas.documentRequirementGroupAssignment
|
|
71
|
+
>;
|
|
72
|
+
export type DocumentComplianceStatus = z.infer<
|
|
73
|
+
typeof ModelSchemas.documentComplianceStatus
|
|
74
|
+
>;
|
|
75
|
+
export type DocumentShare = z.infer<typeof ModelSchemas.documentShareSchema>;
|
|
76
|
+
export type AllowedDocumentType = z.infer<
|
|
77
|
+
typeof ModelSchemas.allowedDocumentTypeSchema
|
|
78
|
+
>;
|
|
79
|
+
|
|
80
|
+
// Flight and Operations Types
|
|
81
|
+
export type FlightLog = z.infer<typeof ModelSchemas.flightLogSchema>;
|
|
82
|
+
export type ScheduledFlight = z.infer<
|
|
83
|
+
typeof ModelSchemas.scheduledFlightSchema
|
|
84
|
+
>;
|
|
85
|
+
export type Landing = z.infer<typeof ModelSchemas.landingSchema>;
|
|
86
|
+
export type ApproachType = z.infer<typeof ModelSchemas.approachTypeSchema>;
|
|
87
|
+
export type Waypoint = z.infer<typeof ModelSchemas.waypointSchema>;
|
|
88
|
+
|
|
89
|
+
// Financial Types
|
|
90
|
+
export type Invoice = z.infer<typeof ModelSchemas.invoiceSchema>;
|
|
91
|
+
export type Expense = z.infer<typeof ModelSchemas.expenseSchema>;
|
|
92
|
+
export type ExpenseItem = z.infer<typeof ModelSchemas.expenseItemSchema>;
|
|
93
|
+
export type SpecialFlight = z.infer<typeof ModelSchemas.specialFlightSchema>;
|
|
94
|
+
export type PrePaidPackage = z.infer<typeof ModelSchemas.prePaidPackageSchema>;
|
|
95
|
+
|
|
96
|
+
// Training and Certification Types
|
|
97
|
+
export type Qualification = z.infer<typeof ModelSchemas.qualificationSchema>;
|
|
98
|
+
export type Course = z.infer<typeof ModelSchemas.courseSchema>;
|
|
99
|
+
export type CourseEnrollment = z.infer<
|
|
100
|
+
typeof ModelSchemas.courseEnrollmentSchema
|
|
101
|
+
>;
|
|
102
|
+
|
|
103
|
+
// Communication and Support Types
|
|
104
|
+
export type Event = z.infer<typeof ModelSchemas.eventSchema>;
|
|
105
|
+
export type Ticket = z.infer<typeof ModelSchemas.ticketSchema>;
|
|
106
|
+
export type Post = z.infer<typeof ModelSchemas.postSchema>;
|
|
107
|
+
export type Comment = z.infer<typeof ModelSchemas.commentSchema>;
|
|
108
|
+
|
|
109
|
+
export interface CreateCommentInput {
|
|
110
|
+
body: string;
|
|
111
|
+
parent_id?: number;
|
|
112
|
+
title?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface UpdateCommentInput {
|
|
116
|
+
body?: string;
|
|
117
|
+
title?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Infrastructure Types
|
|
121
|
+
export type Address = z.infer<typeof ModelSchemas.addressSchema>;
|
|
122
|
+
export type Runway = z.infer<typeof ModelSchemas.runwaySchema>;
|
|
123
|
+
export type Role = z.infer<typeof ModelSchemas.roleSchema>;
|
|
124
|
+
export type Setting = z.infer<typeof ModelSchemas.settingSchema>;
|