@gymspace/sdk 1.0.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 +160 -0
- package/dist/index.js +1379 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1321 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +76 -0
- package/src/client.ts +200 -0
- package/src/errors.ts +49 -0
- package/src/index.ts +15 -0
- package/src/models/assets.ts +24 -0
- package/src/models/auth.ts +155 -0
- package/src/models/check-ins.ts +75 -0
- package/src/models/clients.ts +109 -0
- package/src/models/contracts.ts +61 -0
- package/src/models/dashboard.ts +32 -0
- package/src/models/evaluations.ts +91 -0
- package/src/models/files.ts +23 -0
- package/src/models/gyms.ts +73 -0
- package/src/models/index.ts +24 -0
- package/src/models/invitations.ts +29 -0
- package/src/models/leads.ts +52 -0
- package/src/models/membership-plans.ts +71 -0
- package/src/models/onboarding.ts +171 -0
- package/src/models/organizations.ts +25 -0
- package/src/models/products.ts +99 -0
- package/src/models/sales.ts +108 -0
- package/src/models/suppliers.ts +57 -0
- package/src/models/users.ts +17 -0
- package/src/resources/assets.ts +102 -0
- package/src/resources/auth.ts +137 -0
- package/src/resources/base.ts +50 -0
- package/src/resources/check-ins.ts +63 -0
- package/src/resources/clients.ts +57 -0
- package/src/resources/contracts.ts +59 -0
- package/src/resources/dashboard.ts +30 -0
- package/src/resources/evaluations.ts +63 -0
- package/src/resources/files.ts +95 -0
- package/src/resources/gyms.ts +61 -0
- package/src/resources/health.ts +28 -0
- package/src/resources/index.ts +20 -0
- package/src/resources/invitations.ts +38 -0
- package/src/resources/leads.ts +48 -0
- package/src/resources/membership-plans.ts +54 -0
- package/src/resources/onboarding.ts +58 -0
- package/src/resources/organizations.ts +23 -0
- package/src/resources/products.ts +91 -0
- package/src/resources/public-catalog.ts +61 -0
- package/src/resources/sales.ts +83 -0
- package/src/resources/suppliers.ts +44 -0
- package/src/resources/users.ts +27 -0
- package/src/sdk.ts +104 -0
- package/src/types.ts +41 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LeadStatus } from '@gymspace/shared';
|
|
2
|
+
import { PaginationQueryDto } from '../types';
|
|
3
|
+
|
|
4
|
+
export interface CreateLeadDto {
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
phone: string;
|
|
8
|
+
gymId: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
source?: string;
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UpdateLeadDto {
|
|
15
|
+
status?: LeadStatus;
|
|
16
|
+
notes?: string;
|
|
17
|
+
assignedToUserId?: string;
|
|
18
|
+
metadata?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Lead {
|
|
22
|
+
id: string;
|
|
23
|
+
gymId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
email: string;
|
|
26
|
+
phone: string;
|
|
27
|
+
status: LeadStatus;
|
|
28
|
+
source?: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
notes?: string;
|
|
31
|
+
assignedToUserId?: string;
|
|
32
|
+
convertedToClientId?: string;
|
|
33
|
+
metadata?: Record<string, any>;
|
|
34
|
+
createdAt: string;
|
|
35
|
+
updatedAt: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SearchLeadsParams extends PaginationQueryDto {
|
|
39
|
+
status?: LeadStatus;
|
|
40
|
+
search?: string;
|
|
41
|
+
assignedToUserId?: string;
|
|
42
|
+
startDate?: string;
|
|
43
|
+
endDate?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface LeadStats {
|
|
47
|
+
total: number;
|
|
48
|
+
byStatus: Record<LeadStatus, number>;
|
|
49
|
+
conversionRate: number;
|
|
50
|
+
averageResponseTime: number;
|
|
51
|
+
bySource: Record<string, number>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface CreateMembershipPlanDto {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
basePrice: number;
|
|
5
|
+
durationMonths?: number;
|
|
6
|
+
durationDays?: number;
|
|
7
|
+
termsAndConditions?: string;
|
|
8
|
+
allowsCustomPricing?: boolean;
|
|
9
|
+
maxEvaluations?: number;
|
|
10
|
+
includesAdvisor?: boolean;
|
|
11
|
+
showInCatalog?: boolean;
|
|
12
|
+
features?: string[];
|
|
13
|
+
status?: 'active' | 'inactive' | 'archived';
|
|
14
|
+
assetsIds?: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UpdateMembershipPlanDto {
|
|
18
|
+
name?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
basePrice?: number;
|
|
21
|
+
durationMonths?: number;
|
|
22
|
+
durationDays?: number;
|
|
23
|
+
termsAndConditions?: string;
|
|
24
|
+
allowsCustomPricing?: boolean;
|
|
25
|
+
maxEvaluations?: number;
|
|
26
|
+
includesAdvisor?: boolean;
|
|
27
|
+
showInCatalog?: boolean;
|
|
28
|
+
features?: string[];
|
|
29
|
+
status?: 'active' | 'inactive' | 'archived';
|
|
30
|
+
isActive?: boolean;
|
|
31
|
+
assetsIds?: string[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface MembershipPlan {
|
|
35
|
+
id: string;
|
|
36
|
+
gymId: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
basePrice: number;
|
|
40
|
+
durationMonths?: number;
|
|
41
|
+
durationDays?: number;
|
|
42
|
+
gym?: {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
organization: {
|
|
46
|
+
currency: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
termsAndConditions?: string;
|
|
50
|
+
allowsCustomPricing: boolean;
|
|
51
|
+
maxEvaluations: number;
|
|
52
|
+
includesAdvisor: boolean;
|
|
53
|
+
showInCatalog: boolean;
|
|
54
|
+
features: string[];
|
|
55
|
+
status: 'active' | 'inactive' | 'archived';
|
|
56
|
+
isActive: boolean;
|
|
57
|
+
assetsIds?: string[];
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface MembershipPlanStats {
|
|
63
|
+
totalContracts: number;
|
|
64
|
+
activeContracts: number;
|
|
65
|
+
totalRevenue: number;
|
|
66
|
+
monthlyRevenue: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GetMembershipPlansParams {
|
|
70
|
+
activeOnly?: boolean;
|
|
71
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export interface StartOnboardingData {
|
|
2
|
+
name: string;
|
|
3
|
+
email: string;
|
|
4
|
+
phone: string;
|
|
5
|
+
password: string;
|
|
6
|
+
organizationName: string;
|
|
7
|
+
country: string;
|
|
8
|
+
currency: string;
|
|
9
|
+
timezone: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface StartOnboardingResponse {
|
|
13
|
+
success: boolean;
|
|
14
|
+
access_token: string;
|
|
15
|
+
refresh_token: string;
|
|
16
|
+
user: {
|
|
17
|
+
id: string;
|
|
18
|
+
email: string;
|
|
19
|
+
name: string;
|
|
20
|
+
userType: string;
|
|
21
|
+
};
|
|
22
|
+
organization: {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
organizationCode: string;
|
|
26
|
+
};
|
|
27
|
+
gym: {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
onboardingStatus: OnboardingStatus;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface BusinessHours {
|
|
35
|
+
open: string;
|
|
36
|
+
close: string;
|
|
37
|
+
closed: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface WeeklySchedule {
|
|
41
|
+
monday: BusinessHours;
|
|
42
|
+
tuesday: BusinessHours;
|
|
43
|
+
wednesday: BusinessHours;
|
|
44
|
+
thursday: BusinessHours;
|
|
45
|
+
friday: BusinessHours;
|
|
46
|
+
saturday: BusinessHours;
|
|
47
|
+
sunday: BusinessHours;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Amenities {
|
|
51
|
+
hasParking: boolean;
|
|
52
|
+
hasShowers: boolean;
|
|
53
|
+
hasLockers: boolean;
|
|
54
|
+
hasPool: boolean;
|
|
55
|
+
hasSauna: boolean;
|
|
56
|
+
hasWifi: boolean;
|
|
57
|
+
hasChildcare: boolean;
|
|
58
|
+
hasCafeteria: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SocialMedia {
|
|
62
|
+
facebook?: string;
|
|
63
|
+
instagram?: string;
|
|
64
|
+
twitter?: string;
|
|
65
|
+
website?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface UpdateGymSettingsData {
|
|
69
|
+
gymId: string;
|
|
70
|
+
name: string;
|
|
71
|
+
address: string;
|
|
72
|
+
city: string;
|
|
73
|
+
state: string;
|
|
74
|
+
postalCode: string;
|
|
75
|
+
phone: string;
|
|
76
|
+
email: string;
|
|
77
|
+
businessHours: WeeklySchedule;
|
|
78
|
+
capacity: number;
|
|
79
|
+
description?: string;
|
|
80
|
+
amenities: Amenities;
|
|
81
|
+
socialMedia?: SocialMedia;
|
|
82
|
+
logo?: string;
|
|
83
|
+
coverPhoto?: string;
|
|
84
|
+
primaryColor?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ClientManagementFeatures {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
requireDocumentId: boolean;
|
|
90
|
+
enablePhotos: boolean;
|
|
91
|
+
trackEmergencyContacts: boolean;
|
|
92
|
+
trackMedicalConditions: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface MembershipManagementFeatures {
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
allowCustomPricing: boolean;
|
|
98
|
+
allowContractFreezing: boolean;
|
|
99
|
+
expiryWarningDays: number;
|
|
100
|
+
autoRenewalReminders: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface CheckInSystemFeatures {
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
requireActiveContract: boolean;
|
|
106
|
+
trackCheckInTime: boolean;
|
|
107
|
+
allowMultiplePerDay: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface EvaluationSystemFeatures {
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
trackMeasurements: boolean;
|
|
113
|
+
trackBodyComposition: boolean;
|
|
114
|
+
trackPerformance: boolean;
|
|
115
|
+
defaultFrequencyDays: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface LeadManagementFeatures {
|
|
119
|
+
enabled: boolean;
|
|
120
|
+
publicCatalogListing: boolean;
|
|
121
|
+
enableOnlineForm: boolean;
|
|
122
|
+
autoAssignLeads: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface NotificationSettings {
|
|
126
|
+
emailEnabled: boolean;
|
|
127
|
+
smsEnabled: boolean;
|
|
128
|
+
welcomeEmails: boolean;
|
|
129
|
+
contractExpiryAlerts: boolean;
|
|
130
|
+
evaluationReminders: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ConfigureFeaturesData {
|
|
134
|
+
gymId: string;
|
|
135
|
+
clientManagement: ClientManagementFeatures;
|
|
136
|
+
membershipManagement: MembershipManagementFeatures;
|
|
137
|
+
checkInSystem: CheckInSystemFeatures;
|
|
138
|
+
evaluationSystem: EvaluationSystemFeatures;
|
|
139
|
+
leadManagement: LeadManagementFeatures;
|
|
140
|
+
notifications: NotificationSettings;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface CompleteGuidedSetupData {
|
|
144
|
+
gymId: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export enum OnboardingStep {
|
|
148
|
+
ACCOUNT_CREATED = 'account_created',
|
|
149
|
+
GYM_SETTINGS = 'gym_settings',
|
|
150
|
+
FEATURES_CONFIGURED = 'features_configured',
|
|
151
|
+
COMPLETED = 'completed',
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface OnboardingStatus {
|
|
155
|
+
organizationId: string;
|
|
156
|
+
gymId: string;
|
|
157
|
+
currentStep: OnboardingStep;
|
|
158
|
+
accountCreated: boolean;
|
|
159
|
+
gymSettingsCompleted: boolean;
|
|
160
|
+
featuresConfigured: boolean;
|
|
161
|
+
isCompleted: boolean;
|
|
162
|
+
nextAction: string;
|
|
163
|
+
completionPercentage: number;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface OnboardingResponse {
|
|
167
|
+
success: boolean;
|
|
168
|
+
gym?: any;
|
|
169
|
+
onboardingStatus: OnboardingStatus;
|
|
170
|
+
message?: string;
|
|
171
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface UpdateOrganizationDto {
|
|
2
|
+
country?: string;
|
|
3
|
+
currency?: string;
|
|
4
|
+
timezone?: string;
|
|
5
|
+
settings?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Organization {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
country?: string;
|
|
12
|
+
currency?: string;
|
|
13
|
+
timezone?: string;
|
|
14
|
+
settings?: Record<string, any>;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface OrganizationStats {
|
|
20
|
+
totalGyms: number;
|
|
21
|
+
totalClients: number;
|
|
22
|
+
totalContracts: number;
|
|
23
|
+
activeContracts: number;
|
|
24
|
+
totalRevenue: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PaginationQueryDto } from '../types';
|
|
2
|
+
|
|
3
|
+
// Product Category Models
|
|
4
|
+
export interface CreateProductCategoryDto {
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface UpdateProductCategoryDto {
|
|
11
|
+
name?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ProductCategory {
|
|
17
|
+
id: string;
|
|
18
|
+
gymId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
createdBy?: {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
email: string;
|
|
28
|
+
};
|
|
29
|
+
updatedBy?: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
email: string;
|
|
33
|
+
};
|
|
34
|
+
_count?: {
|
|
35
|
+
products: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Product Models
|
|
40
|
+
export interface CreateProductDto {
|
|
41
|
+
name: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
price: number;
|
|
44
|
+
stock?: number;
|
|
45
|
+
categoryId?: string;
|
|
46
|
+
imageId?: string;
|
|
47
|
+
status?: 'active' | 'inactive';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface UpdateProductDto {
|
|
51
|
+
name?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
price?: number;
|
|
54
|
+
stock?: number;
|
|
55
|
+
categoryId?: string;
|
|
56
|
+
imageId?: string;
|
|
57
|
+
status?: 'active' | 'inactive';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface UpdateStockDto {
|
|
61
|
+
quantity: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface Product {
|
|
65
|
+
id: string;
|
|
66
|
+
gymId: string;
|
|
67
|
+
categoryId?: string;
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
price: number;
|
|
71
|
+
stock: number;
|
|
72
|
+
imageId?: string;
|
|
73
|
+
status: 'active' | 'inactive';
|
|
74
|
+
createdAt: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
category?: ProductCategory;
|
|
77
|
+
createdBy?: {
|
|
78
|
+
id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
email: string;
|
|
81
|
+
};
|
|
82
|
+
updatedBy?: {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
email: string;
|
|
86
|
+
};
|
|
87
|
+
_count?: {
|
|
88
|
+
saleItems: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface SearchProductsParams extends PaginationQueryDto {
|
|
93
|
+
search?: string;
|
|
94
|
+
categoryId?: string;
|
|
95
|
+
status?: 'active' | 'inactive';
|
|
96
|
+
inStock?: boolean;
|
|
97
|
+
minPrice?: number;
|
|
98
|
+
maxPrice?: number;
|
|
99
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { PaginationQueryDto } from '../types';
|
|
2
|
+
|
|
3
|
+
// Sale Item Models
|
|
4
|
+
export interface SaleItemDto {
|
|
5
|
+
productId: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
unitPrice: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SaleItem {
|
|
11
|
+
id: string;
|
|
12
|
+
saleId: string;
|
|
13
|
+
productId: string;
|
|
14
|
+
quantity: number;
|
|
15
|
+
unitPrice: number;
|
|
16
|
+
total: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
product?: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
imageId?: string;
|
|
23
|
+
category?: {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
color?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Sale Models
|
|
32
|
+
export interface CreateSaleDto {
|
|
33
|
+
items: SaleItemDto[];
|
|
34
|
+
customerName?: string;
|
|
35
|
+
notes?: string;
|
|
36
|
+
paymentStatus?: 'paid' | 'unpaid';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface UpdateSaleDto {
|
|
40
|
+
customerName?: string;
|
|
41
|
+
notes?: string;
|
|
42
|
+
paymentStatus?: 'paid' | 'unpaid';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface UpdatePaymentStatusDto {
|
|
46
|
+
paymentStatus: 'paid' | 'unpaid';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface Sale {
|
|
50
|
+
id: string;
|
|
51
|
+
gymId: string;
|
|
52
|
+
saleNumber: string;
|
|
53
|
+
total: number;
|
|
54
|
+
paymentStatus: 'paid' | 'unpaid';
|
|
55
|
+
saleDate: string;
|
|
56
|
+
customerName?: string;
|
|
57
|
+
notes?: string;
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
saleItems?: SaleItem[];
|
|
61
|
+
createdBy?: {
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
email: string;
|
|
65
|
+
};
|
|
66
|
+
updatedBy?: {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
email: string;
|
|
70
|
+
};
|
|
71
|
+
_count?: {
|
|
72
|
+
saleItems: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface SearchSalesParams extends PaginationQueryDto {
|
|
77
|
+
customerName?: string;
|
|
78
|
+
paymentStatus?: 'paid' | 'unpaid';
|
|
79
|
+
startDate?: string;
|
|
80
|
+
endDate?: string;
|
|
81
|
+
minTotal?: number;
|
|
82
|
+
maxTotal?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Analytics Models
|
|
86
|
+
export interface SalesStats {
|
|
87
|
+
totalSales: number;
|
|
88
|
+
totalRevenue: number;
|
|
89
|
+
paidSales: number;
|
|
90
|
+
unpaidSales: number;
|
|
91
|
+
paymentRate: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface TopSellingProduct {
|
|
95
|
+
product?: {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
price: number;
|
|
99
|
+
imageId?: string;
|
|
100
|
+
category?: {
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
color?: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
totalQuantity: number;
|
|
107
|
+
totalRevenue: number;
|
|
108
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { PaginationQueryDto } from '../types';
|
|
2
|
+
|
|
3
|
+
// Supplier Models
|
|
4
|
+
export interface CreateSupplierDto {
|
|
5
|
+
name: string;
|
|
6
|
+
contactInfo?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
address?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateSupplierDto {
|
|
13
|
+
name?: string;
|
|
14
|
+
contactInfo?: string;
|
|
15
|
+
phone?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
address?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Supplier {
|
|
21
|
+
id: string;
|
|
22
|
+
gymId: string;
|
|
23
|
+
name: string;
|
|
24
|
+
contactInfo?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
email?: string;
|
|
27
|
+
address?: string;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
createdBy?: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
email: string;
|
|
34
|
+
};
|
|
35
|
+
updatedBy?: {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
email: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SearchSuppliersParams extends PaginationQueryDto {
|
|
43
|
+
search?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Analytics Models
|
|
47
|
+
export interface SuppliersStats {
|
|
48
|
+
totalSuppliers: number;
|
|
49
|
+
suppliersWithEmail: number;
|
|
50
|
+
suppliersWithPhone: number;
|
|
51
|
+
suppliersWithAddress: number;
|
|
52
|
+
contactCompleteness: {
|
|
53
|
+
email: number;
|
|
54
|
+
phone: number;
|
|
55
|
+
address: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface UpdateProfileDto {
|
|
2
|
+
name?: string;
|
|
3
|
+
phone?: string;
|
|
4
|
+
birthDate?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface UserProfileDto {
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
name: string;
|
|
11
|
+
phone?: string | null;
|
|
12
|
+
birthDate?: Date | string | null;
|
|
13
|
+
userType: 'owner' | 'collaborator';
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
createdAt: Date | string;
|
|
16
|
+
updatedAt: Date | string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { BaseResource } from './base';
|
|
2
|
+
import type { AssetResponseDto } from '../models/assets';
|
|
3
|
+
|
|
4
|
+
export class AssetsResource extends BaseResource {
|
|
5
|
+
/**
|
|
6
|
+
* Upload a new asset
|
|
7
|
+
*/
|
|
8
|
+
async upload(data: {
|
|
9
|
+
file: File;
|
|
10
|
+
description?: string;
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
}): Promise<AssetResponseDto> {
|
|
13
|
+
const formData = new FormData();
|
|
14
|
+
formData.append('file', data.file);
|
|
15
|
+
|
|
16
|
+
if (data.description) {
|
|
17
|
+
formData.append('description', data.description);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (data.metadata) {
|
|
21
|
+
formData.append('metadata', JSON.stringify(data.metadata));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return await this.client.post<AssetResponseDto>('/assets/upload', formData, {
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'multipart/form-data',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get a single asset by ID
|
|
33
|
+
*/
|
|
34
|
+
async findOne(id: string): Promise<AssetResponseDto> {
|
|
35
|
+
return await this.client.get<AssetResponseDto>(`/assets/${id}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get multiple assets by IDs
|
|
40
|
+
*/
|
|
41
|
+
async findByIds(ids: string[]): Promise<AssetResponseDto[]> {
|
|
42
|
+
if (!ids || ids.length === 0) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// El segundo parámetro del get son los params directamente
|
|
47
|
+
return await this.client.get<AssetResponseDto[]>('/assets/by-ids', {
|
|
48
|
+
ids: ids.join(',')
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get all assets for the current gym
|
|
54
|
+
*/
|
|
55
|
+
async findAll(): Promise<AssetResponseDto[]> {
|
|
56
|
+
return await this.client.get<AssetResponseDto[]>('/assets');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Delete an asset
|
|
61
|
+
*/
|
|
62
|
+
async delete(id: string): Promise<void> {
|
|
63
|
+
await this.client.delete(`/assets/${id}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Get a signed download URL for an asset
|
|
68
|
+
*/
|
|
69
|
+
async getDownloadUrl(id: string): Promise<{ url: string; filename: string }> {
|
|
70
|
+
return await this.client.get<{ url: string; filename: string }>(`/assets/${id}/download-url`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Download an asset as a blob
|
|
75
|
+
*/
|
|
76
|
+
async download(id: string): Promise<Blob> {
|
|
77
|
+
const response = await this.client.get<ArrayBuffer>(`/assets/${id}/download`, {
|
|
78
|
+
responseType: 'arraybuffer',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return new Blob([response]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get the render URL for an asset (for inline display)
|
|
86
|
+
* This returns the URL directly without making an API call
|
|
87
|
+
*/
|
|
88
|
+
getRenderUrl(id: string): string {
|
|
89
|
+
return `${this.client.getBaseUrl()}/assets/${id}/render`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Get asset blob for rendering/preview
|
|
94
|
+
*/
|
|
95
|
+
async render(id: string): Promise<Blob> {
|
|
96
|
+
const response = await this.client.get<ArrayBuffer>(`/assets/${id}/render`, {
|
|
97
|
+
responseType: 'arraybuffer',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return new Blob([response]);
|
|
101
|
+
}
|
|
102
|
+
}
|