@gymspace/sdk 1.2.13 → 1.2.15
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/dist/.tsbuildinfo +1 -1
- package/dist/index.d.mts +515 -18
- package/dist/index.d.ts +515 -18
- package/dist/index.js +239 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +236 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/activities.ts +139 -0
- package/src/models/clients.ts +6 -0
- package/src/models/contracts.ts +127 -9
- package/src/models/gyms.ts +7 -6
- package/src/models/index.ts +2 -0
- package/src/models/tags.ts +151 -0
- package/src/resources/activities.ts +113 -0
- package/src/resources/check-ins.ts +42 -10
- package/src/resources/contracts.ts +53 -1
- package/src/resources/index.ts +2 -0
- package/src/resources/tags.ts +147 -0
- package/src/sdk.ts +6 -0
package/package.json
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export interface CreateActivityDto {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
imageId?: string;
|
|
5
|
+
startDateTime: string;
|
|
6
|
+
durationMinutes: number;
|
|
7
|
+
maxParticipants?: number;
|
|
8
|
+
recurrenceType?: 'daily' | 'weekly' | 'monthly';
|
|
9
|
+
recurrenceEndDate?: string;
|
|
10
|
+
planRestrictions?: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface UpdateActivityDto {
|
|
14
|
+
name?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
imageId?: string;
|
|
17
|
+
startDateTime?: string;
|
|
18
|
+
durationMinutes?: number;
|
|
19
|
+
maxParticipants?: number;
|
|
20
|
+
recurrenceType?: 'daily' | 'weekly' | 'monthly';
|
|
21
|
+
recurrenceEndDate?: string;
|
|
22
|
+
planRestrictions?: string[];
|
|
23
|
+
isActive?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Activity {
|
|
27
|
+
id: string;
|
|
28
|
+
gymId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
imageId?: string;
|
|
32
|
+
startDateTime: string;
|
|
33
|
+
durationMinutes: number;
|
|
34
|
+
maxParticipants?: number;
|
|
35
|
+
recurrenceType?: 'daily' | 'weekly' | 'monthly';
|
|
36
|
+
recurrenceEndDate?: string;
|
|
37
|
+
isActive: boolean;
|
|
38
|
+
planRestrictions: ActivityPlanRestriction[];
|
|
39
|
+
notifications?: ActivityNotification[];
|
|
40
|
+
createdByUserId: string;
|
|
41
|
+
updatedByUserId?: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
deletedAt?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ActivityPlanRestriction {
|
|
48
|
+
id: string;
|
|
49
|
+
membershipPlanId: string;
|
|
50
|
+
membershipPlan: {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SearchActivitiesParams {
|
|
57
|
+
page?: number;
|
|
58
|
+
limit?: number;
|
|
59
|
+
search?: string;
|
|
60
|
+
startDate?: string;
|
|
61
|
+
endDate?: string;
|
|
62
|
+
recurrenceType?: 'daily' | 'weekly' | 'monthly';
|
|
63
|
+
planId?: string;
|
|
64
|
+
isActive?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface CreateActivityNotificationDto {
|
|
68
|
+
templateId?: string;
|
|
69
|
+
customMessage?: string;
|
|
70
|
+
advanceTimeMinutes: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface UpdateActivityNotificationDto {
|
|
74
|
+
templateId?: string;
|
|
75
|
+
customMessage?: string;
|
|
76
|
+
advanceTimeMinutes?: number;
|
|
77
|
+
isActive?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface ActivityNotification {
|
|
81
|
+
id: string;
|
|
82
|
+
activityId: string;
|
|
83
|
+
templateId?: string;
|
|
84
|
+
customMessage?: string;
|
|
85
|
+
advanceTimeMinutes: number;
|
|
86
|
+
isActive: boolean;
|
|
87
|
+
template?: {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
message: string;
|
|
91
|
+
};
|
|
92
|
+
sentNotifications?: SentActivityNotification[];
|
|
93
|
+
createdByUserId: string;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
updatedAt: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface SentActivityNotification {
|
|
99
|
+
id: string;
|
|
100
|
+
sendId: string;
|
|
101
|
+
recipientsCount: number;
|
|
102
|
+
sentAt: string;
|
|
103
|
+
status: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface ActivityStats {
|
|
107
|
+
totalActivities: number;
|
|
108
|
+
activeActivities: number;
|
|
109
|
+
upcomingActivities: number;
|
|
110
|
+
totalNotificationsSent: number;
|
|
111
|
+
notificationsByActivity: {
|
|
112
|
+
activityId: string;
|
|
113
|
+
activityName: string;
|
|
114
|
+
notificationsSent: number;
|
|
115
|
+
lastSentAt: string;
|
|
116
|
+
}[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface ActivityStatsParams {
|
|
120
|
+
startDate?: string;
|
|
121
|
+
endDate?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface EligibleClient {
|
|
125
|
+
id: string;
|
|
126
|
+
name: string;
|
|
127
|
+
phone: string;
|
|
128
|
+
email: string;
|
|
129
|
+
planName: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface EligibleClientsResponse {
|
|
133
|
+
total: number;
|
|
134
|
+
clients: EligibleClient[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface DeleteActivityParams {
|
|
138
|
+
deleteRecurrence?: boolean;
|
|
139
|
+
}
|
package/src/models/clients.ts
CHANGED
|
@@ -14,6 +14,9 @@ export interface CreateClientDto {
|
|
|
14
14
|
occupation?: string;
|
|
15
15
|
notes?: string;
|
|
16
16
|
profilePhotoId?: string;
|
|
17
|
+
emergencyContactName?: string;
|
|
18
|
+
emergencyContactPhone?: string;
|
|
19
|
+
medicalConditions?: string;
|
|
17
20
|
customData?: Record<string, any>;
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -33,6 +36,9 @@ export interface UpdateClientDto {
|
|
|
33
36
|
occupation?: string;
|
|
34
37
|
notes?: string;
|
|
35
38
|
profilePhotoId?: string;
|
|
39
|
+
emergencyContactName?: string;
|
|
40
|
+
emergencyContactPhone?: string;
|
|
41
|
+
medicalConditions?: string;
|
|
36
42
|
customData?: Record<string, any>;
|
|
37
43
|
}
|
|
38
44
|
|
package/src/models/contracts.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import { ContractStatus } from '@gymspace/shared';
|
|
2
2
|
import { PaginationQueryDto } from '../types';
|
|
3
3
|
|
|
4
|
+
// TODO: Import from @gymspace/shared once type resolution is fixed
|
|
5
|
+
export enum CancellationReason {
|
|
6
|
+
PRICE_TOO_HIGH = 'PRICE_TOO_HIGH',
|
|
7
|
+
NOT_USING_SERVICE = 'NOT_USING_SERVICE',
|
|
8
|
+
MOVING_LOCATION = 'MOVING_LOCATION',
|
|
9
|
+
FINANCIAL_ISSUES = 'FINANCIAL_ISSUES',
|
|
10
|
+
SERVICE_DISSATISFACTION = 'SERVICE_DISSATISFACTION',
|
|
11
|
+
TEMPORARY_BREAK = 'TEMPORARY_BREAK',
|
|
12
|
+
OTHER = 'OTHER',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum SuspensionType {
|
|
16
|
+
VACATION = 'vacation',
|
|
17
|
+
MEDICAL = 'medical',
|
|
18
|
+
FINANCIAL = 'financial',
|
|
19
|
+
OTHER = 'other',
|
|
20
|
+
}
|
|
21
|
+
|
|
4
22
|
export interface CreateContractDto {
|
|
5
23
|
gymClientId: string;
|
|
6
24
|
gymMembershipPlanId: string;
|
|
@@ -30,6 +48,36 @@ export interface FreezeContractDto {
|
|
|
30
48
|
reason?: string;
|
|
31
49
|
}
|
|
32
50
|
|
|
51
|
+
export interface CancelContractDto {
|
|
52
|
+
reason: CancellationReason;
|
|
53
|
+
detailedFeedback?: string;
|
|
54
|
+
offeredAlternatives?: boolean;
|
|
55
|
+
wouldRecommend?: boolean;
|
|
56
|
+
satisfactionScore?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface SuspendContractDto {
|
|
60
|
+
suspensionType: SuspensionType;
|
|
61
|
+
startDate: string;
|
|
62
|
+
endDate?: string;
|
|
63
|
+
reason?: string;
|
|
64
|
+
maintainBenefits?: boolean;
|
|
65
|
+
autoReactivate?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface ResumeContractDto {
|
|
69
|
+
resumeDate?: string;
|
|
70
|
+
notes?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ReactivateContractDto {
|
|
74
|
+
newPlanId?: string;
|
|
75
|
+
startDate: string;
|
|
76
|
+
applyWinBackOffer?: boolean;
|
|
77
|
+
paymentMethodId: string;
|
|
78
|
+
notes?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
33
81
|
export interface Contract {
|
|
34
82
|
id: string;
|
|
35
83
|
gymId: string;
|
|
@@ -41,35 +89,71 @@ export interface Contract {
|
|
|
41
89
|
startDate: string;
|
|
42
90
|
endDate: string;
|
|
43
91
|
status: ContractStatus;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
finalAmount:
|
|
47
|
-
|
|
48
|
-
|
|
92
|
+
basePrice: string;
|
|
93
|
+
customPrice?: string | null;
|
|
94
|
+
finalAmount: string;
|
|
95
|
+
currency: string;
|
|
96
|
+
discountPercentage?: number | null;
|
|
97
|
+
discountAmount?: string | null;
|
|
98
|
+
paymentFrequency: string;
|
|
99
|
+
notes?: string | null;
|
|
100
|
+
termsAndConditions?: string | null;
|
|
101
|
+
freezeStartDate?: string | null;
|
|
102
|
+
freezeEndDate?: string | null;
|
|
103
|
+
contractDocumentId?: string | null;
|
|
104
|
+
paymentReceiptIds?: string[] | null;
|
|
49
105
|
receiptIds?: string[];
|
|
50
106
|
metadata?: Record<string, any>;
|
|
107
|
+
createdByUserId?: string;
|
|
108
|
+
updatedByUserId?: string | null;
|
|
109
|
+
approvedByUserId?: string | null;
|
|
110
|
+
approvedAt?: string | null;
|
|
111
|
+
cancelledByUserId?: string | null;
|
|
112
|
+
cancelledAt?: string | null;
|
|
51
113
|
createdAt: string;
|
|
52
114
|
updatedAt: string;
|
|
115
|
+
deletedAt?: string | null;
|
|
53
116
|
// Relations
|
|
54
117
|
gymClient?: {
|
|
55
118
|
id: string;
|
|
56
119
|
name: string;
|
|
57
|
-
email: string;
|
|
120
|
+
email: string | null;
|
|
121
|
+
phone?: string;
|
|
122
|
+
gym?: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
};
|
|
58
126
|
};
|
|
59
127
|
gymMembershipPlan?: {
|
|
60
128
|
id: string;
|
|
129
|
+
gymId: string;
|
|
61
130
|
name: string;
|
|
62
|
-
basePrice
|
|
63
|
-
durationMonths?: number;
|
|
131
|
+
basePrice: string;
|
|
132
|
+
durationMonths?: number | null;
|
|
133
|
+
durationDays?: number | null;
|
|
134
|
+
description?: string;
|
|
135
|
+
features?: string[];
|
|
136
|
+
termsAndConditions?: string;
|
|
137
|
+
allowsCustomPricing?: boolean;
|
|
138
|
+
includesAdvisor?: boolean;
|
|
139
|
+
showInCatalog?: boolean;
|
|
140
|
+
assetsIds?: string[];
|
|
141
|
+
status?: string;
|
|
64
142
|
};
|
|
65
143
|
paymentMethod?: {
|
|
66
144
|
id: string;
|
|
145
|
+
organizationId: string;
|
|
67
146
|
name: string;
|
|
68
147
|
description?: string;
|
|
69
148
|
code: string;
|
|
70
149
|
enabled: boolean;
|
|
150
|
+
metadata?: Record<string, any>;
|
|
71
151
|
};
|
|
72
152
|
renewals?: Contract[]; // Renewal contracts for this contract
|
|
153
|
+
createdBy?: {
|
|
154
|
+
id: string;
|
|
155
|
+
email: string;
|
|
156
|
+
};
|
|
73
157
|
}
|
|
74
158
|
|
|
75
159
|
export interface GetContractsParams extends PaginationQueryDto {
|
|
@@ -80,4 +164,38 @@ export interface GetContractsParams extends PaginationQueryDto {
|
|
|
80
164
|
startDateTo?: string;
|
|
81
165
|
endDateFrom?: string;
|
|
82
166
|
endDateTo?: string;
|
|
83
|
-
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ContractLifecycleEvent {
|
|
170
|
+
id: string;
|
|
171
|
+
contractId: string;
|
|
172
|
+
eventType: string;
|
|
173
|
+
previousStatus?: string;
|
|
174
|
+
newStatus?: string;
|
|
175
|
+
reason?: string;
|
|
176
|
+
metadata?: Record<string, any>;
|
|
177
|
+
createdAt: string;
|
|
178
|
+
createdBy?: {
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
email: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface CancellationAnalytics {
|
|
186
|
+
total: number;
|
|
187
|
+
reasonBreakdown: Record<string, number>;
|
|
188
|
+
averageSatisfaction: number | null;
|
|
189
|
+
recommendationRate: number;
|
|
190
|
+
feedbacks: Array<{
|
|
191
|
+
id: string;
|
|
192
|
+
contractId: string;
|
|
193
|
+
contractNumber: string;
|
|
194
|
+
clientName: string;
|
|
195
|
+
reason: string;
|
|
196
|
+
detailedFeedback?: string;
|
|
197
|
+
satisfactionScore?: number;
|
|
198
|
+
wouldRecommend?: boolean;
|
|
199
|
+
createdAt: string;
|
|
200
|
+
}>;
|
|
201
|
+
}
|
package/src/models/gyms.ts
CHANGED
|
@@ -6,11 +6,10 @@ export interface CreateGymDto {
|
|
|
6
6
|
postalCode?: string;
|
|
7
7
|
phone?: string;
|
|
8
8
|
email?: string;
|
|
9
|
-
openingTime?: string;
|
|
10
|
-
closingTime?: string;
|
|
11
9
|
capacity?: number;
|
|
12
10
|
amenities?: GymAmenities;
|
|
13
11
|
settings?: GymSettings;
|
|
12
|
+
schedule?: GymSchedule;
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export interface UpdateGymDto {
|
|
@@ -21,11 +20,10 @@ export interface UpdateGymDto {
|
|
|
21
20
|
postalCode?: string;
|
|
22
21
|
phone?: string;
|
|
23
22
|
email?: string;
|
|
24
|
-
openingTime?: string;
|
|
25
|
-
closingTime?: string;
|
|
26
23
|
capacity?: number;
|
|
27
24
|
amenities?: GymAmenities;
|
|
28
25
|
settings?: GymSettings;
|
|
26
|
+
schedule?: GymSchedule;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
export interface GymAmenities {
|
|
@@ -90,8 +88,6 @@ export interface Gym {
|
|
|
90
88
|
postalCode?: string;
|
|
91
89
|
phone?: string;
|
|
92
90
|
email?: string;
|
|
93
|
-
openingTime?: string;
|
|
94
|
-
closingTime?: string;
|
|
95
91
|
capacity?: number;
|
|
96
92
|
amenities?: GymAmenities;
|
|
97
93
|
settings?: GymSettings;
|
|
@@ -100,6 +96,11 @@ export interface Gym {
|
|
|
100
96
|
isActive: boolean;
|
|
101
97
|
createdAt: string;
|
|
102
98
|
updatedAt: string;
|
|
99
|
+
_count?: {
|
|
100
|
+
gymClients: number;
|
|
101
|
+
collaborators: number;
|
|
102
|
+
contracts: number;
|
|
103
|
+
};
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
export interface TimeSlot {
|
package/src/models/index.ts
CHANGED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Request DTOs
|
|
2
|
+
export interface CreateTagDto {
|
|
3
|
+
name: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UpdateTagDto {
|
|
9
|
+
name?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AssignTagsDto {
|
|
15
|
+
tagIds: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface RemoveTagsDto {
|
|
19
|
+
tagIds: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Response types
|
|
23
|
+
export interface Tag {
|
|
24
|
+
id: string;
|
|
25
|
+
gymId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
color?: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
clientCount?: number;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
createdBy?: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TagWithAssignment extends Tag {
|
|
39
|
+
assignedAt?: string;
|
|
40
|
+
assignedBy?: {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Query/Filter params
|
|
47
|
+
export interface SearchTagsParams {
|
|
48
|
+
page?: number;
|
|
49
|
+
limit?: number;
|
|
50
|
+
search?: string;
|
|
51
|
+
includeCount?: boolean;
|
|
52
|
+
sortBy?: 'name' | 'createdAt' | 'clientCount';
|
|
53
|
+
sortOrder?: 'asc' | 'desc';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface GetTagClientsParams {
|
|
57
|
+
page?: number;
|
|
58
|
+
limit?: number;
|
|
59
|
+
search?: string;
|
|
60
|
+
status?: 'active' | 'inactive';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Response types for specific operations
|
|
64
|
+
export interface AssignTagsResponse {
|
|
65
|
+
message: string;
|
|
66
|
+
assigned: number;
|
|
67
|
+
skipped: number;
|
|
68
|
+
client: {
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
tags: TagWithAssignment[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface RemoveTagsResponse {
|
|
76
|
+
message: string;
|
|
77
|
+
removed: number;
|
|
78
|
+
notFound: number;
|
|
79
|
+
client: {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
tags: TagWithAssignment[];
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface DeleteTagResponse {
|
|
87
|
+
message: string;
|
|
88
|
+
deletedCount: number;
|
|
89
|
+
affectedClients: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ClientTagsResponse {
|
|
93
|
+
client: {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
clientNumber: string;
|
|
97
|
+
};
|
|
98
|
+
tags: TagWithAssignment[];
|
|
99
|
+
total: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface TagClientsResponse {
|
|
103
|
+
data: Array<{
|
|
104
|
+
id: string;
|
|
105
|
+
clientNumber: string;
|
|
106
|
+
name: string;
|
|
107
|
+
email?: string;
|
|
108
|
+
phone?: string;
|
|
109
|
+
status: string;
|
|
110
|
+
assignedAt: string;
|
|
111
|
+
assignedBy: {
|
|
112
|
+
id: string;
|
|
113
|
+
name: string;
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
116
|
+
meta: {
|
|
117
|
+
total: number;
|
|
118
|
+
page: number;
|
|
119
|
+
limit: number;
|
|
120
|
+
totalPages: number;
|
|
121
|
+
};
|
|
122
|
+
tag: {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
color?: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface TagStatsResponse {
|
|
130
|
+
totalTags: number;
|
|
131
|
+
totalAssignments: number;
|
|
132
|
+
averageTagsPerClient: number;
|
|
133
|
+
mostUsedTags: Array<{
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
color?: string;
|
|
137
|
+
clientCount: number;
|
|
138
|
+
}>;
|
|
139
|
+
leastUsedTags: Array<{
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
color?: string;
|
|
143
|
+
clientCount: number;
|
|
144
|
+
}>;
|
|
145
|
+
unusedTags: Array<{
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
color?: string;
|
|
149
|
+
clientCount: number;
|
|
150
|
+
}>;
|
|
151
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { BaseResource } from './base';
|
|
2
|
+
import {
|
|
3
|
+
Activity,
|
|
4
|
+
CreateActivityDto,
|
|
5
|
+
UpdateActivityDto,
|
|
6
|
+
SearchActivitiesParams,
|
|
7
|
+
CreateActivityNotificationDto,
|
|
8
|
+
UpdateActivityNotificationDto,
|
|
9
|
+
ActivityNotification,
|
|
10
|
+
ActivityStats,
|
|
11
|
+
ActivityStatsParams,
|
|
12
|
+
EligibleClientsResponse,
|
|
13
|
+
DeleteActivityParams,
|
|
14
|
+
} from '../models/activities';
|
|
15
|
+
import { RequestOptions, PaginatedResponseDto } from '../types';
|
|
16
|
+
|
|
17
|
+
export class ActivitiesResource extends BaseResource {
|
|
18
|
+
private basePath = 'activities';
|
|
19
|
+
|
|
20
|
+
async createActivity(data: CreateActivityDto, options?: RequestOptions): Promise<Activity> {
|
|
21
|
+
return this.client.post<Activity>(this.basePath, data, options);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async searchActivities(
|
|
25
|
+
params?: SearchActivitiesParams,
|
|
26
|
+
options?: RequestOptions,
|
|
27
|
+
): Promise<PaginatedResponseDto<Activity>> {
|
|
28
|
+
return this.paginate<Activity>(this.basePath, params as any, options);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async getActivity(id: string, options?: RequestOptions): Promise<Activity> {
|
|
32
|
+
return this.client.get<Activity>(`${this.basePath}/${id}`, undefined, options);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async updateActivity(
|
|
36
|
+
id: string,
|
|
37
|
+
data: UpdateActivityDto,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): Promise<Activity> {
|
|
40
|
+
return this.client.patch<Activity>(`${this.basePath}/${id}`, data, options);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async deleteActivity(
|
|
44
|
+
id: string,
|
|
45
|
+
params?: DeleteActivityParams,
|
|
46
|
+
options?: RequestOptions,
|
|
47
|
+
): Promise<void> {
|
|
48
|
+
const queryString = params?.deleteRecurrence ? '?deleteRecurrence=true' : '';
|
|
49
|
+
return this.client.delete<void>(`${this.basePath}/${id}${queryString}`, options);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async createNotification(
|
|
53
|
+
activityId: string,
|
|
54
|
+
data: CreateActivityNotificationDto,
|
|
55
|
+
options?: RequestOptions,
|
|
56
|
+
): Promise<ActivityNotification> {
|
|
57
|
+
return this.client.post<ActivityNotification>(
|
|
58
|
+
`${this.basePath}/${activityId}/notifications`,
|
|
59
|
+
data,
|
|
60
|
+
options,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async getNotifications(
|
|
65
|
+
activityId: string,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<{ data: ActivityNotification[] }> {
|
|
68
|
+
return this.client.get<{ data: ActivityNotification[] }>(
|
|
69
|
+
`${this.basePath}/${activityId}/notifications`,
|
|
70
|
+
undefined,
|
|
71
|
+
options,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async updateNotification(
|
|
76
|
+
activityId: string,
|
|
77
|
+
notificationId: string,
|
|
78
|
+
data: UpdateActivityNotificationDto,
|
|
79
|
+
options?: RequestOptions,
|
|
80
|
+
): Promise<ActivityNotification> {
|
|
81
|
+
return this.client.patch<ActivityNotification>(
|
|
82
|
+
`${this.basePath}/${activityId}/notifications/${notificationId}`,
|
|
83
|
+
data,
|
|
84
|
+
options,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async deleteNotification(
|
|
89
|
+
activityId: string,
|
|
90
|
+
notificationId: string,
|
|
91
|
+
options?: RequestOptions,
|
|
92
|
+
): Promise<void> {
|
|
93
|
+
return this.client.delete<void>(
|
|
94
|
+
`${this.basePath}/${activityId}/notifications/${notificationId}`,
|
|
95
|
+
options,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async getStats(params?: ActivityStatsParams, options?: RequestOptions): Promise<ActivityStats> {
|
|
100
|
+
return this.client.get<ActivityStats>(`${this.basePath}/stats`, params, options);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async getEligibleClients(
|
|
104
|
+
activityId: string,
|
|
105
|
+
options?: RequestOptions,
|
|
106
|
+
): Promise<EligibleClientsResponse> {
|
|
107
|
+
return this.client.get<EligibleClientsResponse>(
|
|
108
|
+
`${this.basePath}/${activityId}/eligible-clients`,
|
|
109
|
+
undefined,
|
|
110
|
+
options,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}
|