@flusys/nestjs-event-manager 4.1.0 → 5.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 +126 -337
- package/adapters/event-manager.adapter.d.ts +0 -2
- package/cjs/adapters/event-manager.adapter.js +1 -7
- package/cjs/config/message-keys.js +1 -31
- package/cjs/controllers/event.controller.js +10 -60
- package/cjs/controllers/index.js +0 -1
- package/cjs/docs/event-manager-swagger.config.js +19 -29
- package/cjs/docs/index.js +0 -3
- package/cjs/dtos/calendar-query.dto.js +46 -20
- package/cjs/dtos/event-participant.dto.js +0 -45
- package/cjs/dtos/event.dto.js +97 -45
- package/cjs/entities/event-participant.entity.js +1 -8
- package/cjs/entities/event.entity.js +38 -26
- package/cjs/modules/event-manager.module.js +2 -4
- package/cjs/services/event-manager-helper.service.js +15 -83
- package/cjs/services/event.service.js +143 -122
- package/cjs/services/index.js +0 -1
- package/config/message-keys.d.ts +0 -56
- package/controllers/event.controller.d.ts +2 -5
- package/controllers/index.d.ts +0 -1
- package/docs/index.d.ts +1 -1
- package/dtos/calendar-query.dto.d.ts +8 -5
- package/dtos/event-participant.dto.d.ts +0 -6
- package/dtos/event.dto.d.ts +14 -10
- package/entities/event-participant.entity.d.ts +0 -1
- package/entities/event.entity.d.ts +6 -5
- package/fesm/adapters/event-manager.adapter.js +1 -7
- package/fesm/config/message-keys.js +1 -29
- package/fesm/controllers/event.controller.js +11 -61
- package/fesm/controllers/index.js +0 -1
- package/fesm/docs/event-manager-swagger.config.js +19 -29
- package/fesm/docs/index.js +1 -1
- package/fesm/dtos/calendar-query.dto.js +47 -21
- package/fesm/dtos/event-participant.dto.js +0 -42
- package/fesm/dtos/event.dto.js +98 -46
- package/fesm/entities/event-participant.entity.js +1 -8
- package/fesm/entities/event.entity.js +38 -26
- package/fesm/modules/event-manager.module.js +4 -6
- package/fesm/services/event-manager-helper.service.js +17 -85
- package/fesm/services/event.service.js +144 -123
- package/fesm/services/index.js +0 -1
- package/interfaces/event.interface.d.ts +6 -6
- package/package.json +3 -3
- package/services/event-manager-helper.service.d.ts +1 -3
- package/services/event.service.d.ts +8 -8
- package/services/index.d.ts +0 -1
- package/cjs/controllers/event-participant.controller.js +0 -287
- package/cjs/services/event-participant.service.js +0 -198
- package/controllers/event-participant.controller.d.ts +0 -35
- package/fesm/controllers/event-participant.controller.js +0 -277
- package/fesm/services/event-participant.service.js +0 -188
- package/services/event-participant.service.d.ts +0 -27
package/fesm/dtos/event.dto.js
CHANGED
|
@@ -23,20 +23,22 @@ function _ts_metadata(k, v) {
|
|
|
23
23
|
import { RecurrenceType } from '@flusys/nestjs-shared/enums';
|
|
24
24
|
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
25
25
|
import { Expose, Type } from 'class-transformer';
|
|
26
|
-
import {
|
|
26
|
+
import { EventParticipantResponseDto } from './event-participant.dto';
|
|
27
|
+
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString, IsUrl, IsUUID, Matches, MaxLength } from 'class-validator';
|
|
27
28
|
export class CreateEventDto {
|
|
28
29
|
constructor(){
|
|
29
30
|
_define_property(this, "title", void 0);
|
|
30
31
|
_define_property(this, "description", void 0);
|
|
31
|
-
_define_property(this, "
|
|
32
|
-
_define_property(this, "
|
|
33
|
-
_define_property(this, "
|
|
32
|
+
_define_property(this, "eventDate", void 0);
|
|
33
|
+
_define_property(this, "startTime", void 0);
|
|
34
|
+
_define_property(this, "endTime", void 0);
|
|
34
35
|
_define_property(this, "isAllDay", void 0);
|
|
35
36
|
_define_property(this, "recurrenceType", void 0);
|
|
36
37
|
_define_property(this, "recurrenceEndDate", void 0);
|
|
38
|
+
_define_property(this, "weekDays", void 0);
|
|
37
39
|
_define_property(this, "color", void 0);
|
|
38
40
|
_define_property(this, "isActive", void 0);
|
|
39
|
-
_define_property(this, "
|
|
41
|
+
_define_property(this, "meetingLink", void 0);
|
|
40
42
|
_define_property(this, "participantIds", void 0);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -60,35 +62,41 @@ _ts_decorate([
|
|
|
60
62
|
_ts_metadata("design:type", String)
|
|
61
63
|
], CreateEventDto.prototype, "description", void 0);
|
|
62
64
|
_ts_decorate([
|
|
63
|
-
|
|
64
|
-
description: '
|
|
65
|
-
|
|
65
|
+
ApiProperty({
|
|
66
|
+
description: 'Event date (YYYY-MM-DD)',
|
|
67
|
+
example: '2024-01-15'
|
|
66
68
|
}),
|
|
67
|
-
|
|
69
|
+
IsNotEmpty(),
|
|
68
70
|
IsString(),
|
|
69
|
-
|
|
71
|
+
Matches(/^\d{4}-\d{2}-\d{2}$/, {
|
|
72
|
+
message: 'eventDate must be in YYYY-MM-DD format'
|
|
73
|
+
}),
|
|
70
74
|
_ts_metadata("design:type", String)
|
|
71
|
-
], CreateEventDto.prototype, "
|
|
75
|
+
], CreateEventDto.prototype, "eventDate", void 0);
|
|
72
76
|
_ts_decorate([
|
|
73
77
|
ApiProperty({
|
|
74
|
-
description: 'Start
|
|
75
|
-
example: '
|
|
78
|
+
description: 'Start time (HH:mm)',
|
|
79
|
+
example: '09:00'
|
|
76
80
|
}),
|
|
77
81
|
IsNotEmpty(),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
IsString(),
|
|
83
|
+
Matches(/^\d{2}:\d{2}$/, {
|
|
84
|
+
message: 'startTime must be in HH:mm format'
|
|
85
|
+
}),
|
|
86
|
+
_ts_metadata("design:type", String)
|
|
87
|
+
], CreateEventDto.prototype, "startTime", void 0);
|
|
82
88
|
_ts_decorate([
|
|
83
89
|
ApiProperty({
|
|
84
|
-
description: 'End
|
|
85
|
-
example: '
|
|
90
|
+
description: 'End time (HH:mm)',
|
|
91
|
+
example: '10:00'
|
|
86
92
|
}),
|
|
87
93
|
IsNotEmpty(),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
IsString(),
|
|
95
|
+
Matches(/^\d{2}:\d{2}$/, {
|
|
96
|
+
message: 'endTime must be in HH:mm format'
|
|
97
|
+
}),
|
|
98
|
+
_ts_metadata("design:type", String)
|
|
99
|
+
], CreateEventDto.prototype, "endTime", void 0);
|
|
92
100
|
_ts_decorate([
|
|
93
101
|
ApiPropertyOptional({
|
|
94
102
|
description: 'All day event flag',
|
|
@@ -110,13 +118,30 @@ _ts_decorate([
|
|
|
110
118
|
], CreateEventDto.prototype, "recurrenceType", void 0);
|
|
111
119
|
_ts_decorate([
|
|
112
120
|
ApiPropertyOptional({
|
|
113
|
-
description: 'Recurrence end date'
|
|
121
|
+
description: 'Recurrence end date (YYYY-MM-DD)',
|
|
122
|
+
example: '2024-12-31'
|
|
114
123
|
}),
|
|
115
124
|
IsOptional(),
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
IsString(),
|
|
126
|
+
Matches(/^\d{4}-\d{2}-\d{2}$/, {
|
|
127
|
+
message: 'recurrenceEndDate must be in YYYY-MM-DD format'
|
|
128
|
+
}),
|
|
129
|
+
_ts_metadata("design:type", Object)
|
|
119
130
|
], CreateEventDto.prototype, "recurrenceEndDate", void 0);
|
|
131
|
+
_ts_decorate([
|
|
132
|
+
ApiPropertyOptional({
|
|
133
|
+
description: 'Selected weekdays for WEEKLY recurrence (e.g. ["MON","WED"])',
|
|
134
|
+
type: [
|
|
135
|
+
String
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
IsOptional(),
|
|
139
|
+
IsArray(),
|
|
140
|
+
IsString({
|
|
141
|
+
each: true
|
|
142
|
+
}),
|
|
143
|
+
_ts_metadata("design:type", Object)
|
|
144
|
+
], CreateEventDto.prototype, "weekDays", void 0);
|
|
120
145
|
_ts_decorate([
|
|
121
146
|
ApiPropertyOptional({
|
|
122
147
|
description: 'Event color (hex)',
|
|
@@ -139,11 +164,17 @@ _ts_decorate([
|
|
|
139
164
|
], CreateEventDto.prototype, "isActive", void 0);
|
|
140
165
|
_ts_decorate([
|
|
141
166
|
ApiPropertyOptional({
|
|
142
|
-
description: '
|
|
167
|
+
description: 'Meeting link URL (e.g. video call)',
|
|
168
|
+
example: 'https://meet.google.com/abc-def-ghi'
|
|
143
169
|
}),
|
|
144
170
|
IsOptional(),
|
|
145
|
-
|
|
146
|
-
|
|
171
|
+
IsString(),
|
|
172
|
+
IsUrl({}, {
|
|
173
|
+
message: 'meetingLink must be a valid URL'
|
|
174
|
+
}),
|
|
175
|
+
MaxLength(500),
|
|
176
|
+
_ts_metadata("design:type", Object)
|
|
177
|
+
], CreateEventDto.prototype, "meetingLink", void 0);
|
|
147
178
|
_ts_decorate([
|
|
148
179
|
ApiPropertyOptional({
|
|
149
180
|
description: 'Participant user IDs',
|
|
@@ -177,18 +208,20 @@ export class EventResponseDto {
|
|
|
177
208
|
_define_property(this, "id", void 0);
|
|
178
209
|
_define_property(this, "title", void 0);
|
|
179
210
|
_define_property(this, "description", void 0);
|
|
180
|
-
_define_property(this, "
|
|
181
|
-
_define_property(this, "
|
|
182
|
-
_define_property(this, "
|
|
211
|
+
_define_property(this, "eventDate", void 0);
|
|
212
|
+
_define_property(this, "startTime", void 0);
|
|
213
|
+
_define_property(this, "endTime", void 0);
|
|
183
214
|
_define_property(this, "isAllDay", void 0);
|
|
184
215
|
_define_property(this, "recurrenceType", void 0);
|
|
185
216
|
_define_property(this, "recurrenceEndDate", void 0);
|
|
217
|
+
_define_property(this, "weekDays", void 0);
|
|
186
218
|
_define_property(this, "color", void 0);
|
|
219
|
+
_define_property(this, "meetingLink", void 0);
|
|
187
220
|
_define_property(this, "isActive", void 0);
|
|
188
|
-
_define_property(this, "metadata", void 0);
|
|
189
221
|
_define_property(this, "companyId", void 0);
|
|
190
222
|
_define_property(this, "createdAt", void 0);
|
|
191
223
|
_define_property(this, "updatedAt", void 0);
|
|
224
|
+
_define_property(this, "participants", void 0);
|
|
192
225
|
}
|
|
193
226
|
}
|
|
194
227
|
_ts_decorate([
|
|
@@ -208,19 +241,19 @@ _ts_decorate([
|
|
|
208
241
|
], EventResponseDto.prototype, "description", void 0);
|
|
209
242
|
_ts_decorate([
|
|
210
243
|
Expose(),
|
|
211
|
-
|
|
212
|
-
_ts_metadata("design:type",
|
|
213
|
-
], EventResponseDto.prototype, "
|
|
244
|
+
ApiProperty(),
|
|
245
|
+
_ts_metadata("design:type", String)
|
|
246
|
+
], EventResponseDto.prototype, "eventDate", void 0);
|
|
214
247
|
_ts_decorate([
|
|
215
248
|
Expose(),
|
|
216
249
|
ApiProperty(),
|
|
217
|
-
_ts_metadata("design:type",
|
|
218
|
-
], EventResponseDto.prototype, "
|
|
250
|
+
_ts_metadata("design:type", String)
|
|
251
|
+
], EventResponseDto.prototype, "startTime", void 0);
|
|
219
252
|
_ts_decorate([
|
|
220
253
|
Expose(),
|
|
221
254
|
ApiProperty(),
|
|
222
|
-
_ts_metadata("design:type",
|
|
223
|
-
], EventResponseDto.prototype, "
|
|
255
|
+
_ts_metadata("design:type", String)
|
|
256
|
+
], EventResponseDto.prototype, "endTime", void 0);
|
|
224
257
|
_ts_decorate([
|
|
225
258
|
Expose(),
|
|
226
259
|
ApiProperty(),
|
|
@@ -238,21 +271,30 @@ _ts_decorate([
|
|
|
238
271
|
ApiPropertyOptional(),
|
|
239
272
|
_ts_metadata("design:type", Object)
|
|
240
273
|
], EventResponseDto.prototype, "recurrenceEndDate", void 0);
|
|
274
|
+
_ts_decorate([
|
|
275
|
+
Expose(),
|
|
276
|
+
ApiPropertyOptional({
|
|
277
|
+
type: [
|
|
278
|
+
String
|
|
279
|
+
]
|
|
280
|
+
}),
|
|
281
|
+
_ts_metadata("design:type", Object)
|
|
282
|
+
], EventResponseDto.prototype, "weekDays", void 0);
|
|
241
283
|
_ts_decorate([
|
|
242
284
|
Expose(),
|
|
243
285
|
ApiProperty(),
|
|
244
286
|
_ts_metadata("design:type", String)
|
|
245
287
|
], EventResponseDto.prototype, "color", void 0);
|
|
288
|
+
_ts_decorate([
|
|
289
|
+
Expose(),
|
|
290
|
+
ApiPropertyOptional(),
|
|
291
|
+
_ts_metadata("design:type", Object)
|
|
292
|
+
], EventResponseDto.prototype, "meetingLink", void 0);
|
|
246
293
|
_ts_decorate([
|
|
247
294
|
Expose(),
|
|
248
295
|
ApiProperty(),
|
|
249
296
|
_ts_metadata("design:type", Boolean)
|
|
250
297
|
], EventResponseDto.prototype, "isActive", void 0);
|
|
251
|
-
_ts_decorate([
|
|
252
|
-
Expose(),
|
|
253
|
-
ApiPropertyOptional(),
|
|
254
|
-
_ts_metadata("design:type", Object)
|
|
255
|
-
], EventResponseDto.prototype, "metadata", void 0);
|
|
256
298
|
_ts_decorate([
|
|
257
299
|
Expose(),
|
|
258
300
|
ApiPropertyOptional(),
|
|
@@ -268,3 +310,13 @@ _ts_decorate([
|
|
|
268
310
|
ApiProperty(),
|
|
269
311
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
270
312
|
], EventResponseDto.prototype, "updatedAt", void 0);
|
|
313
|
+
_ts_decorate([
|
|
314
|
+
Expose(),
|
|
315
|
+
ApiPropertyOptional({
|
|
316
|
+
type: ()=>[
|
|
317
|
+
EventParticipantResponseDto
|
|
318
|
+
]
|
|
319
|
+
}),
|
|
320
|
+
Type(()=>EventParticipantResponseDto),
|
|
321
|
+
_ts_metadata("design:type", Array)
|
|
322
|
+
], EventResponseDto.prototype, "participants", void 0);
|
|
@@ -25,7 +25,7 @@ import { Identity } from '@flusys/nestjs-shared/entities';
|
|
|
25
25
|
import { Column, Entity, Index } from 'typeorm';
|
|
26
26
|
export class EventParticipant extends Identity {
|
|
27
27
|
constructor(...args){
|
|
28
|
-
super(...args), _define_property(this, "eventId", void 0), _define_property(this, "userId", void 0), _define_property(this, "status", void 0), _define_property(this, "isOrganizer", void 0)
|
|
28
|
+
super(...args), _define_property(this, "eventId", void 0), _define_property(this, "userId", void 0), _define_property(this, "status", void 0), _define_property(this, "isOrganizer", void 0);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
_ts_decorate([
|
|
@@ -63,13 +63,6 @@ _ts_decorate([
|
|
|
63
63
|
}),
|
|
64
64
|
_ts_metadata("design:type", Boolean)
|
|
65
65
|
], EventParticipant.prototype, "isOrganizer", void 0);
|
|
66
|
-
_ts_decorate([
|
|
67
|
-
Column({
|
|
68
|
-
type: 'simple-json',
|
|
69
|
-
nullable: true
|
|
70
|
-
}),
|
|
71
|
-
_ts_metadata("design:type", Object)
|
|
72
|
-
], EventParticipant.prototype, "metadata", void 0);
|
|
73
66
|
EventParticipant = _ts_decorate([
|
|
74
67
|
Entity({
|
|
75
68
|
name: 'event_participant'
|
|
@@ -25,7 +25,7 @@ import { Identity } from '@flusys/nestjs-shared/entities';
|
|
|
25
25
|
import { Column, Entity, Index } from 'typeorm';
|
|
26
26
|
export class Event extends Identity {
|
|
27
27
|
constructor(...args){
|
|
28
|
-
super(...args), _define_property(this, "title", void 0), _define_property(this, "description", void 0), _define_property(this, "
|
|
28
|
+
super(...args), _define_property(this, "title", void 0), _define_property(this, "description", void 0), _define_property(this, "eventDate", void 0), _define_property(this, "startTime", void 0), _define_property(this, "endTime", void 0), _define_property(this, "isAllDay", void 0), _define_property(this, "recurrenceType", void 0), _define_property(this, "recurrenceEndDate", void 0), _define_property(this, "weekDays", void 0), _define_property(this, "color", void 0), _define_property(this, "meetingLink", void 0), _define_property(this, "isActive", void 0);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
_ts_decorate([
|
|
@@ -45,28 +45,32 @@ _ts_decorate([
|
|
|
45
45
|
], Event.prototype, "description", void 0);
|
|
46
46
|
_ts_decorate([
|
|
47
47
|
Column({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
nullable:
|
|
48
|
+
name: 'event_date',
|
|
49
|
+
type: 'date',
|
|
50
|
+
nullable: false
|
|
51
51
|
}),
|
|
52
|
-
_ts_metadata("design:type",
|
|
53
|
-
], Event.prototype, "
|
|
52
|
+
_ts_metadata("design:type", String)
|
|
53
|
+
], Event.prototype, "eventDate", void 0);
|
|
54
54
|
_ts_decorate([
|
|
55
55
|
Column({
|
|
56
|
-
name: '
|
|
57
|
-
type: '
|
|
58
|
-
|
|
56
|
+
name: 'start_time',
|
|
57
|
+
type: 'varchar',
|
|
58
|
+
length: 5,
|
|
59
|
+
nullable: false,
|
|
60
|
+
default: '00:00'
|
|
59
61
|
}),
|
|
60
|
-
_ts_metadata("design:type",
|
|
61
|
-
], Event.prototype, "
|
|
62
|
+
_ts_metadata("design:type", String)
|
|
63
|
+
], Event.prototype, "startTime", void 0);
|
|
62
64
|
_ts_decorate([
|
|
63
65
|
Column({
|
|
64
|
-
name: '
|
|
65
|
-
type: '
|
|
66
|
-
|
|
66
|
+
name: 'end_time',
|
|
67
|
+
type: 'varchar',
|
|
68
|
+
length: 5,
|
|
69
|
+
nullable: false,
|
|
70
|
+
default: '23:59'
|
|
67
71
|
}),
|
|
68
|
-
_ts_metadata("design:type",
|
|
69
|
-
], Event.prototype, "
|
|
72
|
+
_ts_metadata("design:type", String)
|
|
73
|
+
], Event.prototype, "endTime", void 0);
|
|
70
74
|
_ts_decorate([
|
|
71
75
|
Column({
|
|
72
76
|
name: 'is_all_day',
|
|
@@ -89,11 +93,18 @@ _ts_decorate([
|
|
|
89
93
|
_ts_decorate([
|
|
90
94
|
Column({
|
|
91
95
|
name: 'recurrence_end_date',
|
|
92
|
-
type: '
|
|
96
|
+
type: 'date',
|
|
93
97
|
nullable: true
|
|
94
98
|
}),
|
|
95
99
|
_ts_metadata("design:type", Object)
|
|
96
100
|
], Event.prototype, "recurrenceEndDate", void 0);
|
|
101
|
+
_ts_decorate([
|
|
102
|
+
Column({
|
|
103
|
+
type: 'json',
|
|
104
|
+
nullable: true
|
|
105
|
+
}),
|
|
106
|
+
_ts_metadata("design:type", Object)
|
|
107
|
+
], Event.prototype, "weekDays", void 0);
|
|
97
108
|
_ts_decorate([
|
|
98
109
|
Column({
|
|
99
110
|
type: 'varchar',
|
|
@@ -103,6 +114,15 @@ _ts_decorate([
|
|
|
103
114
|
}),
|
|
104
115
|
_ts_metadata("design:type", String)
|
|
105
116
|
], Event.prototype, "color", void 0);
|
|
117
|
+
_ts_decorate([
|
|
118
|
+
Column({
|
|
119
|
+
name: 'meeting_link',
|
|
120
|
+
type: 'varchar',
|
|
121
|
+
length: 500,
|
|
122
|
+
nullable: true
|
|
123
|
+
}),
|
|
124
|
+
_ts_metadata("design:type", Object)
|
|
125
|
+
], Event.prototype, "meetingLink", void 0);
|
|
106
126
|
_ts_decorate([
|
|
107
127
|
Column({
|
|
108
128
|
name: 'is_active',
|
|
@@ -112,20 +132,12 @@ _ts_decorate([
|
|
|
112
132
|
}),
|
|
113
133
|
_ts_metadata("design:type", Boolean)
|
|
114
134
|
], Event.prototype, "isActive", void 0);
|
|
115
|
-
_ts_decorate([
|
|
116
|
-
Column({
|
|
117
|
-
type: 'simple-json',
|
|
118
|
-
nullable: true
|
|
119
|
-
}),
|
|
120
|
-
_ts_metadata("design:type", Object)
|
|
121
|
-
], Event.prototype, "metadata", void 0);
|
|
122
135
|
Event = _ts_decorate([
|
|
123
136
|
Entity({
|
|
124
137
|
name: 'event'
|
|
125
138
|
}),
|
|
126
139
|
Index([
|
|
127
|
-
'
|
|
128
|
-
'endDateTime'
|
|
140
|
+
'eventDate'
|
|
129
141
|
]),
|
|
130
142
|
Index([
|
|
131
143
|
'isActive'
|
|
@@ -8,19 +8,17 @@ import { CacheModule, UtilsModule } from '@flusys/nestjs-shared/modules';
|
|
|
8
8
|
import { EVENT_MANAGER_ADAPTER } from '@flusys/nestjs-shared/interfaces';
|
|
9
9
|
import { Module } from '@nestjs/common';
|
|
10
10
|
import { EVENT_MANAGER_MODULE_OPTIONS } from '../config/event-manager.constants';
|
|
11
|
-
import { EventController
|
|
11
|
+
import { EventController } from '../controllers';
|
|
12
12
|
import { EventManagerAdapter } from '../adapters';
|
|
13
|
-
import { EventManagerConfigService, EventManagerDataSourceProvider, EventManagerHelperService,
|
|
13
|
+
import { EventManagerConfigService, EventManagerDataSourceProvider, EventManagerHelperService, EventService } from '../services';
|
|
14
14
|
const CONTROLLERS = [
|
|
15
|
-
EventController
|
|
16
|
-
EventParticipantController
|
|
15
|
+
EventController
|
|
17
16
|
];
|
|
18
17
|
const EXPORTED_SERVICES = [
|
|
19
18
|
EventManagerConfigService,
|
|
20
19
|
EventManagerDataSourceProvider,
|
|
21
20
|
EventManagerHelperService,
|
|
22
|
-
EventService
|
|
23
|
-
EventParticipantService
|
|
21
|
+
EventService
|
|
24
22
|
];
|
|
25
23
|
const ADAPTER_PROVIDER = {
|
|
26
24
|
provide: EVENT_MANAGER_ADAPTER,
|
|
@@ -25,9 +25,9 @@ function _ts_param(paramIndex, decorator) {
|
|
|
25
25
|
decorator(target, key, paramIndex);
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
import {
|
|
28
|
+
import { EVENT_PARTICIPANT_MESSAGES } from '../config';
|
|
29
29
|
import { Inject, Injectable, NotFoundException } from '@nestjs/common';
|
|
30
|
-
import {
|
|
30
|
+
import { IsNull } from 'typeorm';
|
|
31
31
|
import { HybridCache } from '@flusys/nestjs-shared/classes';
|
|
32
32
|
import { LogAction } from '@flusys/nestjs-shared/decorators';
|
|
33
33
|
import { UtilsService } from '@flusys/nestjs-shared/modules';
|
|
@@ -53,18 +53,20 @@ export class EventManagerHelperService {
|
|
|
53
53
|
}
|
|
54
54
|
async createEvent(options) {
|
|
55
55
|
const repo = await this.getEventRepository();
|
|
56
|
+
const isAllDay = options.isAllDay ?? false;
|
|
56
57
|
const entity = {
|
|
57
58
|
title: options.title,
|
|
58
59
|
description: options.description ?? null,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
isAllDay
|
|
60
|
+
eventDate: options.eventDate,
|
|
61
|
+
startTime: isAllDay ? '00:00' : options.startTime,
|
|
62
|
+
endTime: isAllDay ? '23:59' : options.endTime,
|
|
63
|
+
isAllDay,
|
|
63
64
|
recurrenceType: options.recurrenceType ?? RecurrenceType.NONE,
|
|
64
65
|
recurrenceEndDate: options.recurrenceEndDate ?? null,
|
|
66
|
+
weekDays: options.weekDays ?? null,
|
|
65
67
|
color: options.color ?? this.configService.getDefaultColor(),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
meetingLink: options.meetingLink ?? null,
|
|
69
|
+
isActive: true
|
|
68
70
|
};
|
|
69
71
|
if (this.configService.isCompanyFeatureEnabled() && options.companyId) {
|
|
70
72
|
entity.companyId = options.companyId;
|
|
@@ -74,52 +76,6 @@ export class EventManagerHelperService {
|
|
|
74
76
|
await this.clearCache();
|
|
75
77
|
return this.toEventResult(saved);
|
|
76
78
|
}
|
|
77
|
-
async addParticipants(eventId, userIds, _companyId) {
|
|
78
|
-
const eventRepo = await this.getEventRepository();
|
|
79
|
-
const participantRepo = await this.getParticipantRepository();
|
|
80
|
-
const event = await eventRepo.findOne({
|
|
81
|
-
where: {
|
|
82
|
-
id: eventId,
|
|
83
|
-
deletedAt: IsNull()
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
if (!event) {
|
|
87
|
-
throw new NotFoundException({
|
|
88
|
-
message: 'Event not found',
|
|
89
|
-
messageKey: EVENT_MESSAGES.NOT_FOUND
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const existingParticipants = await participantRepo.find({
|
|
93
|
-
where: {
|
|
94
|
-
eventId,
|
|
95
|
-
userId: In(userIds),
|
|
96
|
-
deletedAt: IsNull()
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
const existingUserIds = new Set(existingParticipants.map((p)=>p.userId));
|
|
100
|
-
const newParticipants = userIds.filter((userId)=>!existingUserIds.has(userId)).map((userId)=>({
|
|
101
|
-
eventId,
|
|
102
|
-
userId,
|
|
103
|
-
status: ParticipantStatus.PENDING,
|
|
104
|
-
isOrganizer: false
|
|
105
|
-
}));
|
|
106
|
-
if (newParticipants.length > 0) {
|
|
107
|
-
await participantRepo.save(newParticipants);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async removeParticipant(eventId, userId) {
|
|
111
|
-
const participantRepo = await this.getParticipantRepository();
|
|
112
|
-
const participant = await participantRepo.findOne({
|
|
113
|
-
where: {
|
|
114
|
-
eventId,
|
|
115
|
-
userId,
|
|
116
|
-
deletedAt: IsNull()
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
if (participant) {
|
|
120
|
-
await participantRepo.softRemove(participant);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
79
|
async updateParticipantStatus(participantId, status) {
|
|
124
80
|
const participantRepo = await this.getParticipantRepository();
|
|
125
81
|
const participant = await participantRepo.findOne({
|
|
@@ -151,9 +107,9 @@ export class EventManagerHelperService {
|
|
|
151
107
|
eventIds
|
|
152
108
|
}).andWhere('event.deletedAt IS NULL').andWhere('event.isActive = :isActive', {
|
|
153
109
|
isActive: true
|
|
154
|
-
}).andWhere('event.
|
|
110
|
+
}).andWhere('event.eventDate <= :endDate', {
|
|
155
111
|
endDate
|
|
156
|
-
}).andWhere('event.
|
|
112
|
+
}).andWhere('event.eventDate >= :startDate', {
|
|
157
113
|
startDate
|
|
158
114
|
});
|
|
159
115
|
if (this.configService.isCompanyFeatureEnabled() && companyId) {
|
|
@@ -197,15 +153,16 @@ export class EventManagerHelperService {
|
|
|
197
153
|
id: event.id,
|
|
198
154
|
title: event.title,
|
|
199
155
|
description: event.description,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
156
|
+
eventDate: event.eventDate,
|
|
157
|
+
startTime: event.startTime,
|
|
158
|
+
endTime: event.endTime,
|
|
203
159
|
isAllDay: event.isAllDay,
|
|
204
160
|
recurrenceType: event.recurrenceType,
|
|
205
161
|
recurrenceEndDate: event.recurrenceEndDate,
|
|
162
|
+
weekDays: event.weekDays,
|
|
206
163
|
color: event.color,
|
|
164
|
+
meetingLink: event.meetingLink ?? null,
|
|
207
165
|
isActive: event.isActive,
|
|
208
|
-
metadata: event.metadata,
|
|
209
166
|
companyId: eventExt.companyId ?? null,
|
|
210
167
|
createdAt: event.createdAt,
|
|
211
168
|
updatedAt: event.updatedAt
|
|
@@ -240,31 +197,6 @@ _ts_decorate([
|
|
|
240
197
|
]),
|
|
241
198
|
_ts_metadata("design:returntype", Promise)
|
|
242
199
|
], EventManagerHelperService.prototype, "createEvent", null);
|
|
243
|
-
_ts_decorate([
|
|
244
|
-
LogAction({
|
|
245
|
-
action: 'eventParticipant.addMany',
|
|
246
|
-
module: 'event-manager'
|
|
247
|
-
}),
|
|
248
|
-
_ts_metadata("design:type", Function),
|
|
249
|
-
_ts_metadata("design:paramtypes", [
|
|
250
|
-
String,
|
|
251
|
-
Array,
|
|
252
|
-
String
|
|
253
|
-
]),
|
|
254
|
-
_ts_metadata("design:returntype", Promise)
|
|
255
|
-
], EventManagerHelperService.prototype, "addParticipants", null);
|
|
256
|
-
_ts_decorate([
|
|
257
|
-
LogAction({
|
|
258
|
-
action: 'eventParticipant.remove',
|
|
259
|
-
module: 'event-manager'
|
|
260
|
-
}),
|
|
261
|
-
_ts_metadata("design:type", Function),
|
|
262
|
-
_ts_metadata("design:paramtypes", [
|
|
263
|
-
String,
|
|
264
|
-
String
|
|
265
|
-
]),
|
|
266
|
-
_ts_metadata("design:returntype", Promise)
|
|
267
|
-
], EventManagerHelperService.prototype, "removeParticipant", null);
|
|
268
200
|
_ts_decorate([
|
|
269
201
|
LogAction({
|
|
270
202
|
action: 'eventParticipant.updateStatus',
|