@flusys/nestjs-event-manager 4.1.1 → 5.0.1
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 +40 -27
- 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 +40 -27
- 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
|
@@ -17,6 +17,7 @@ const _config = require("../config");
|
|
|
17
17
|
const _common = require("@nestjs/common");
|
|
18
18
|
const _typeorm = require("typeorm");
|
|
19
19
|
const _eventmanagerconfigservice = require("./event-manager-config.service");
|
|
20
|
+
const _dtos = require("../dtos");
|
|
20
21
|
const _entities = require("../entities");
|
|
21
22
|
const _eventmanagerdatasourceprovider = require("./event-manager-datasource.provider");
|
|
22
23
|
function _define_property(obj, key, value) {
|
|
@@ -56,6 +57,7 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
56
57
|
}
|
|
57
58
|
// Override methods
|
|
58
59
|
async convertSingleDtoToEntity(dto, user) {
|
|
60
|
+
await this.ensureRepositoryInitialized();
|
|
59
61
|
let entity = {};
|
|
60
62
|
if ('id' in dto && dto.id && typeof dto.id === 'string') {
|
|
61
63
|
const existing = await this.repository.findOne({
|
|
@@ -69,19 +71,21 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
69
71
|
});
|
|
70
72
|
entity = existing;
|
|
71
73
|
}
|
|
74
|
+
const isAllDay = dto.isAllDay ?? entity.isAllDay ?? false;
|
|
72
75
|
const merged = {
|
|
73
76
|
...entity,
|
|
74
77
|
title: dto.title ?? entity.title,
|
|
75
78
|
description: dto.description ?? entity.description,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
isAllDay
|
|
79
|
+
eventDate: dto.eventDate ?? entity.eventDate,
|
|
80
|
+
startTime: isAllDay ? '00:00' : dto.startTime ?? entity.startTime ?? '00:00',
|
|
81
|
+
endTime: isAllDay ? '23:59' : dto.endTime ?? entity.endTime ?? '23:59',
|
|
82
|
+
isAllDay,
|
|
80
83
|
recurrenceType: dto.recurrenceType ?? entity.recurrenceType ?? _enums.RecurrenceType.NONE,
|
|
81
|
-
recurrenceEndDate: dto.recurrenceEndDate ?? entity.recurrenceEndDate,
|
|
84
|
+
recurrenceEndDate: dto.recurrenceEndDate ?? entity.recurrenceEndDate ?? null,
|
|
85
|
+
weekDays: dto.weekDays ?? entity.weekDays ?? null,
|
|
82
86
|
color: dto.color ?? entity.color ?? this.eventConfig.getDefaultColor(),
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
meetingLink: dto.meetingLink !== undefined ? dto.meetingLink ?? null : entity.meetingLink ?? null,
|
|
88
|
+
isActive: dto.isActive ?? entity.isActive ?? true
|
|
85
89
|
};
|
|
86
90
|
if (this.eventConfig.isCompanyFeatureEnabled()) {
|
|
87
91
|
merged.companyId = user?.companyId ?? null;
|
|
@@ -124,6 +128,8 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
124
128
|
async getExtraManipulateQuery(query, filterDto, user) {
|
|
125
129
|
const result = await super.getExtraManipulateQuery(query, filterDto, user);
|
|
126
130
|
this.applyEventCompanyFilter(query, user);
|
|
131
|
+
await this.ensureParticipantRepositoryInitialized();
|
|
132
|
+
query.leftJoinAndMapMany(`${this.entityName}.participants`, _entities.EventParticipant, 'ep', 'ep.event_id = event.id AND ep.deleted_at IS NULL');
|
|
127
133
|
return result;
|
|
128
134
|
}
|
|
129
135
|
async afterInsertOperation(entities, user, _qr) {
|
|
@@ -133,20 +139,29 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
133
139
|
}
|
|
134
140
|
this.pendingParticipantsList = [];
|
|
135
141
|
}
|
|
142
|
+
async afterUpdateOperation(entities, user, _qr) {
|
|
143
|
+
const participantRepo = await this.ensureParticipantRepositoryInitialized();
|
|
144
|
+
for(let i = 0; i < entities.length; i++){
|
|
145
|
+
const participantIds = this.pendingParticipantsList[i] ?? [];
|
|
146
|
+
await participantRepo.update({
|
|
147
|
+
eventId: entities[i].id,
|
|
148
|
+
deletedAt: (0, _typeorm.IsNull)()
|
|
149
|
+
}, {
|
|
150
|
+
deletedAt: new Date()
|
|
151
|
+
});
|
|
152
|
+
await this.addCreatorAndParticipants(entities[i].id, participantIds, user);
|
|
153
|
+
}
|
|
154
|
+
this.pendingParticipantsList = [];
|
|
155
|
+
}
|
|
136
156
|
// Public API methods
|
|
137
157
|
async getEventsForCalendarRange(queryDto, user) {
|
|
138
158
|
await this.ensureRepositoryInitialized();
|
|
139
159
|
const query = this.repository.createQueryBuilder('event').where('event.deletedAt IS NULL').andWhere('event.isActive = :isActive', {
|
|
140
160
|
isActive: queryDto.activeOnly !== false
|
|
141
|
-
})
|
|
142
|
-
query.andWhere('(event.startDateTime <= :endDate AND event.endDateTime >= :startDate)', {
|
|
161
|
+
}).andWhere('((event.eventDate >= :startDate AND event.eventDate <= :endDate) OR (event.recurrenceType != :none AND event.eventDate <= :endDate AND (event.recurrenceEndDate IS NULL OR event.recurrenceEndDate >= :startDate)))', {
|
|
143
162
|
startDate: queryDto.startDate,
|
|
144
|
-
endDate: queryDto.endDate
|
|
145
|
-
|
|
146
|
-
query.orWhere('event.deletedAt IS NULL AND event.recurrenceType != :none AND event.startDateTime <= :endDate AND (event.recurrenceEndDate IS NULL OR event.recurrenceEndDate >= :startDate)', {
|
|
147
|
-
none: _enums.RecurrenceType.NONE,
|
|
148
|
-
startDate: queryDto.startDate,
|
|
149
|
-
endDate: queryDto.endDate
|
|
163
|
+
endDate: queryDto.endDate,
|
|
164
|
+
none: _enums.RecurrenceType.NONE
|
|
150
165
|
});
|
|
151
166
|
this.applyEventCompanyFilter(query, user);
|
|
152
167
|
if (queryDto.userId) {
|
|
@@ -165,75 +180,57 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
165
180
|
}
|
|
166
181
|
return this.expandRecurringEvents(events, queryDto.startDate, queryDto.endDate);
|
|
167
182
|
}
|
|
168
|
-
async
|
|
169
|
-
await this.ensureRepositoryInitialized();
|
|
170
|
-
const query = this.repository.createQueryBuilder('event').where('event.id = :id', {
|
|
171
|
-
id
|
|
172
|
-
}).andWhere('event.deletedAt IS NULL');
|
|
173
|
-
this.applyEventCompanyFilter(query, user);
|
|
174
|
-
const event = await query.getOne();
|
|
175
|
-
if (event) {
|
|
176
|
-
const participantRepo = await this.ensureParticipantRepositoryInitialized();
|
|
177
|
-
event.participants = await participantRepo.find({
|
|
178
|
-
where: {
|
|
179
|
-
eventId: id,
|
|
180
|
-
deletedAt: (0, _typeorm.IsNull)()
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
return event;
|
|
185
|
-
}
|
|
186
|
-
async addParticipants(eventId, userIds, _user) {
|
|
187
|
-
await this.ensureRepositoryInitialized();
|
|
183
|
+
async updateParticipantStatus(dto, _user) {
|
|
188
184
|
const participantRepo = await this.ensureParticipantRepositoryInitialized();
|
|
189
|
-
const
|
|
185
|
+
const participant = await participantRepo.findOne({
|
|
190
186
|
where: {
|
|
191
|
-
id:
|
|
192
|
-
deletedAt: (0, _typeorm.IsNull)()
|
|
187
|
+
id: dto.id
|
|
193
188
|
}
|
|
194
189
|
});
|
|
195
|
-
if (!
|
|
190
|
+
if (!participant) {
|
|
196
191
|
throw new _common.NotFoundException({
|
|
197
|
-
message: 'Event not found',
|
|
198
|
-
messageKey: _config.
|
|
192
|
+
message: 'Event participant not found',
|
|
193
|
+
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.NOT_FOUND
|
|
199
194
|
});
|
|
200
195
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
eventId,
|
|
204
|
-
userId: (0, _typeorm.In)(userIds),
|
|
205
|
-
deletedAt: (0, _typeorm.IsNull)()
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
const existingUserIds = new Set(existingParticipants.map((p)=>p.userId));
|
|
209
|
-
const newParticipants = userIds.filter((userId)=>!existingUserIds.has(userId)).map((userId)=>({
|
|
210
|
-
eventId,
|
|
211
|
-
userId,
|
|
212
|
-
isOrganizer: false
|
|
213
|
-
}));
|
|
214
|
-
if (newParticipants.length === 0) {
|
|
215
|
-
return existingParticipants;
|
|
216
|
-
}
|
|
217
|
-
const created = await participantRepo.save(newParticipants);
|
|
218
|
-
return [
|
|
219
|
-
...existingParticipants,
|
|
220
|
-
...created
|
|
221
|
-
];
|
|
196
|
+
participant.status = dto.status;
|
|
197
|
+
return participantRepo.save(participant);
|
|
222
198
|
}
|
|
223
199
|
// Private business logic helpers
|
|
224
200
|
async addCreatorAndParticipants(eventId, participantIds, user) {
|
|
225
201
|
if (!user?.id) return;
|
|
226
202
|
const participantRepo = await this.ensureParticipantRepositoryInitialized();
|
|
227
|
-
const allUserIds = new Set([
|
|
203
|
+
const allUserIds = Array.from(new Set([
|
|
228
204
|
user.id,
|
|
229
205
|
...participantIds
|
|
230
|
-
]);
|
|
231
|
-
const
|
|
206
|
+
]));
|
|
207
|
+
const existing = await participantRepo.find({
|
|
208
|
+
where: {
|
|
209
|
+
eventId,
|
|
210
|
+
userId: (0, _typeorm.In)(allUserIds)
|
|
211
|
+
},
|
|
212
|
+
withDeleted: true
|
|
213
|
+
});
|
|
214
|
+
const existingByUserId = new Map(existing.map((p)=>[
|
|
215
|
+
p.userId,
|
|
216
|
+
p
|
|
217
|
+
]));
|
|
218
|
+
const toSave = allUserIds.map((userId)=>{
|
|
219
|
+
const existingRecord = existingByUserId.get(userId);
|
|
220
|
+
if (existingRecord) {
|
|
221
|
+
return {
|
|
222
|
+
...existingRecord,
|
|
223
|
+
deletedAt: null,
|
|
224
|
+
isOrganizer: userId === user.id
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
232
228
|
eventId,
|
|
233
229
|
userId,
|
|
234
230
|
isOrganizer: userId === user.id
|
|
235
|
-
}
|
|
236
|
-
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
await participantRepo.save(toSave);
|
|
237
234
|
}
|
|
238
235
|
expandRecurringEvents(events, rangeStart, rangeEnd) {
|
|
239
236
|
const result = [];
|
|
@@ -245,48 +242,44 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
245
242
|
result.push(...this.generateOccurrences(event, rangeStart, rangeEnd, maxOccurrences));
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
|
-
return result.sort((a, b)=>
|
|
245
|
+
return result.sort((a, b)=>a.eventDate.localeCompare(b.eventDate));
|
|
249
246
|
}
|
|
250
247
|
generateOccurrences(event, rangeStart, rangeEnd, maxOccurrences) {
|
|
251
248
|
const occurrences = [];
|
|
252
|
-
const
|
|
253
|
-
const recurrenceEnd = event.recurrenceEndDate ? new Date(event.recurrenceEndDate) : null;
|
|
249
|
+
const recurrenceEnd = event.recurrenceEndDate ?? null;
|
|
254
250
|
const recurrenceType = event.recurrenceType;
|
|
255
|
-
const
|
|
256
|
-
|
|
251
|
+
const weekDays = event.weekDays ?? [
|
|
252
|
+
this.getDayOfWeek(event.eventDate)
|
|
257
253
|
];
|
|
258
|
-
let
|
|
254
|
+
let currentDate = event.eventDate;
|
|
259
255
|
let count = 0;
|
|
260
256
|
if (recurrenceType === _enums.RecurrenceType.WEEKLY || recurrenceType === _enums.RecurrenceType.BIWEEKLY) {
|
|
261
|
-
let weekStart =
|
|
262
|
-
weekStart.setDate(weekStart.getDate() - weekStart.getDay());
|
|
257
|
+
let weekStart = this.getWeekStart(event.eventDate);
|
|
263
258
|
while(count < maxOccurrences){
|
|
264
|
-
for (const dayOfWeek of
|
|
259
|
+
for (const dayOfWeek of weekDays){
|
|
265
260
|
if (count >= maxOccurrences) break;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
currentStart.setMinutes(new Date(event.startDateTime).getMinutes());
|
|
270
|
-
if (currentStart < new Date(event.startDateTime)) continue;
|
|
271
|
-
const shouldBreak = this.shouldStopRecurrence(currentStart, recurrenceEnd, rangeEnd);
|
|
272
|
-
if (shouldBreak) {
|
|
261
|
+
currentDate = this.addDaysToDate(weekStart, this.weekdayNameToIndex(dayOfWeek));
|
|
262
|
+
if (currentDate < event.eventDate) continue;
|
|
263
|
+
if (this.shouldStopRecurrence(currentDate, recurrenceEnd, rangeEnd)) {
|
|
273
264
|
count = maxOccurrences;
|
|
274
265
|
break;
|
|
275
266
|
}
|
|
276
|
-
|
|
277
|
-
|
|
267
|
+
if (currentDate >= rangeStart && currentDate <= rangeEnd) {
|
|
268
|
+
occurrences.push(this.toCalendarEventOnDate(event, currentDate, occurrences.length > 0));
|
|
269
|
+
}
|
|
278
270
|
count++;
|
|
279
271
|
}
|
|
280
272
|
const weeksToAdd = recurrenceType === _enums.RecurrenceType.BIWEEKLY ? 2 : 1;
|
|
281
|
-
weekStart.
|
|
273
|
+
weekStart = this.addDaysToDate(weekStart, 7 * weeksToAdd);
|
|
282
274
|
}
|
|
283
275
|
} else {
|
|
284
|
-
const originalDayOfMonth =
|
|
276
|
+
const originalDayOfMonth = parseInt(event.eventDate.split('-')[2], 10);
|
|
285
277
|
while(count < maxOccurrences){
|
|
286
|
-
if (this.shouldStopRecurrence(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
278
|
+
if (this.shouldStopRecurrence(currentDate, recurrenceEnd, rangeEnd)) break;
|
|
279
|
+
if (currentDate >= rangeStart && currentDate <= rangeEnd) {
|
|
280
|
+
occurrences.push(this.toCalendarEventOnDate(event, currentDate, count > 0));
|
|
281
|
+
}
|
|
282
|
+
currentDate = this.getNextOccurrenceDate(currentDate, recurrenceType, originalDayOfMonth);
|
|
290
283
|
count++;
|
|
291
284
|
}
|
|
292
285
|
}
|
|
@@ -331,41 +324,61 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
331
324
|
entityAlias: 'event'
|
|
332
325
|
}, user);
|
|
333
326
|
}
|
|
334
|
-
shouldStopRecurrence(
|
|
335
|
-
return recurrenceEnd &&
|
|
327
|
+
shouldStopRecurrence(currentDate, recurrenceEnd, rangeEnd) {
|
|
328
|
+
return recurrenceEnd !== null && currentDate > recurrenceEnd || currentDate > rangeEnd;
|
|
336
329
|
}
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
330
|
+
getDayOfWeek(dateStr) {
|
|
331
|
+
const days = [
|
|
332
|
+
'SUN',
|
|
333
|
+
'MON',
|
|
334
|
+
'TUE',
|
|
335
|
+
'WED',
|
|
336
|
+
'THU',
|
|
337
|
+
'FRI',
|
|
338
|
+
'SAT'
|
|
339
|
+
];
|
|
340
|
+
return days[new Date(`${dateStr}T00:00:00Z`).getUTCDay()];
|
|
341
|
+
}
|
|
342
|
+
weekdayNameToIndex(day) {
|
|
343
|
+
const map = {
|
|
344
|
+
SUN: 0,
|
|
345
|
+
MON: 1,
|
|
346
|
+
TUE: 2,
|
|
347
|
+
WED: 3,
|
|
348
|
+
THU: 4,
|
|
349
|
+
FRI: 5,
|
|
350
|
+
SAT: 6
|
|
351
|
+
};
|
|
352
|
+
return map[day.toUpperCase()] ?? 0;
|
|
353
|
+
}
|
|
354
|
+
getWeekStart(dateStr) {
|
|
355
|
+
const d = new Date(`${dateStr}T00:00:00Z`);
|
|
356
|
+
d.setUTCDate(d.getUTCDate() - d.getUTCDay());
|
|
357
|
+
return d.toISOString().slice(0, 10);
|
|
358
|
+
}
|
|
359
|
+
addDaysToDate(dateStr, days) {
|
|
360
|
+
const d = new Date(`${dateStr}T00:00:00Z`);
|
|
361
|
+
d.setUTCDate(d.getUTCDate() + days);
|
|
362
|
+
return d.toISOString().slice(0, 10);
|
|
350
363
|
}
|
|
351
364
|
getNextOccurrenceDate(current, recurrenceType, originalDayOfMonth) {
|
|
352
|
-
const
|
|
365
|
+
const d = new Date(`${current}T00:00:00Z`);
|
|
353
366
|
switch(recurrenceType){
|
|
354
367
|
case _enums.RecurrenceType.DAILY:
|
|
355
|
-
|
|
368
|
+
d.setUTCDate(d.getUTCDate() + 1);
|
|
356
369
|
break;
|
|
357
370
|
case _enums.RecurrenceType.MONTHLY:
|
|
358
371
|
{
|
|
359
|
-
const targetDay = originalDayOfMonth ??
|
|
360
|
-
|
|
361
|
-
const lastDayOfMonth = new Date(
|
|
362
|
-
|
|
372
|
+
const targetDay = originalDayOfMonth ?? d.getUTCDate();
|
|
373
|
+
d.setUTCMonth(d.getUTCMonth() + 1);
|
|
374
|
+
const lastDayOfMonth = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + 1, 0)).getUTCDate();
|
|
375
|
+
d.setUTCDate(Math.min(targetDay, lastDayOfMonth));
|
|
363
376
|
break;
|
|
364
377
|
}
|
|
365
378
|
default:
|
|
366
379
|
break;
|
|
367
380
|
}
|
|
368
|
-
return
|
|
381
|
+
return d.toISOString().slice(0, 10);
|
|
369
382
|
}
|
|
370
383
|
// Private transformation helpers
|
|
371
384
|
toCalendarEvent(event) {
|
|
@@ -373,15 +386,16 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
373
386
|
id: event.id,
|
|
374
387
|
title: event.title,
|
|
375
388
|
description: event.description,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
389
|
+
eventDate: event.eventDate,
|
|
390
|
+
startTime: event.startTime,
|
|
391
|
+
endTime: event.endTime,
|
|
379
392
|
isAllDay: event.isAllDay,
|
|
380
393
|
recurrenceType: event.recurrenceType,
|
|
381
394
|
recurrenceEndDate: event.recurrenceEndDate,
|
|
395
|
+
weekDays: event.weekDays,
|
|
382
396
|
color: event.color,
|
|
397
|
+
meetingLink: event.meetingLink ?? null,
|
|
383
398
|
isActive: event.isActive,
|
|
384
|
-
metadata: event.metadata,
|
|
385
399
|
createdAt: event.createdAt,
|
|
386
400
|
updatedAt: event.updatedAt,
|
|
387
401
|
deletedAt: event.deletedAt,
|
|
@@ -391,6 +405,15 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
391
405
|
participants: event.participants?.map((p)=>this.toParticipantInfo(p))
|
|
392
406
|
};
|
|
393
407
|
}
|
|
408
|
+
toCalendarEventOnDate(event, occurrenceDate, isRecurrenceInstance) {
|
|
409
|
+
return {
|
|
410
|
+
...this.toCalendarEvent(event),
|
|
411
|
+
id: `${event.id}_${occurrenceDate}`,
|
|
412
|
+
originalEventId: event.id,
|
|
413
|
+
isRecurrenceInstance,
|
|
414
|
+
eventDate: occurrenceDate
|
|
415
|
+
};
|
|
416
|
+
}
|
|
394
417
|
toParticipantInfo(p) {
|
|
395
418
|
return {
|
|
396
419
|
id: p.id,
|
|
@@ -398,7 +421,6 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
398
421
|
userId: p.userId,
|
|
399
422
|
status: p.status,
|
|
400
423
|
isOrganizer: p.isOrganizer,
|
|
401
|
-
metadata: p.metadata,
|
|
402
424
|
createdAt: p.createdAt,
|
|
403
425
|
updatedAt: p.updatedAt,
|
|
404
426
|
deletedAt: p.deletedAt,
|
|
@@ -413,17 +435,16 @@ let EventService = class EventService extends _classes.RequestScopedApiService {
|
|
|
413
435
|
};
|
|
414
436
|
_ts_decorate([
|
|
415
437
|
(0, _decorators.LogAction)({
|
|
416
|
-
action: '
|
|
438
|
+
action: 'eventParticipant.updateStatus',
|
|
417
439
|
module: 'event-manager'
|
|
418
440
|
}),
|
|
419
441
|
_ts_metadata("design:type", Function),
|
|
420
442
|
_ts_metadata("design:paramtypes", [
|
|
421
|
-
|
|
422
|
-
Array,
|
|
443
|
+
typeof _dtos.UpdateParticipantStatusDto === "undefined" ? Object : _dtos.UpdateParticipantStatusDto,
|
|
423
444
|
Object
|
|
424
445
|
]),
|
|
425
446
|
_ts_metadata("design:returntype", Promise)
|
|
426
|
-
], EventService.prototype, "
|
|
447
|
+
], EventService.prototype, "updateParticipantStatus", null);
|
|
427
448
|
EventService = _ts_decorate([
|
|
428
449
|
(0, _common.Injectable)({
|
|
429
450
|
scope: _common.Scope.REQUEST
|
package/cjs/services/index.js
CHANGED
|
@@ -6,7 +6,6 @@ _export_star(require("./event-manager-config.service"), exports);
|
|
|
6
6
|
_export_star(require("./event-manager-datasource.provider"), exports);
|
|
7
7
|
_export_star(require("./event-manager-helper.service"), exports);
|
|
8
8
|
_export_star(require("./event.service"), exports);
|
|
9
|
-
_export_star(require("./event-participant.service"), exports);
|
|
10
9
|
function _export_star(from, to) {
|
|
11
10
|
Object.keys(from).forEach(function(k) {
|
|
12
11
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/config/message-keys.d.ts
CHANGED
|
@@ -1,64 +1,8 @@
|
|
|
1
1
|
export declare const EVENT_MESSAGES: {
|
|
2
|
-
readonly CREATE_SUCCESS: "event.create.success";
|
|
3
|
-
readonly CREATE_MANY_SUCCESS: "event.create.many.success";
|
|
4
|
-
readonly GET_SUCCESS: "event.get.success";
|
|
5
2
|
readonly GET_ALL_SUCCESS: "event.get.all.success";
|
|
6
|
-
readonly UPDATE_SUCCESS: "event.update.success";
|
|
7
|
-
readonly UPDATE_MANY_SUCCESS: "event.update.many.success";
|
|
8
|
-
readonly DELETE_SUCCESS: "event.delete.success";
|
|
9
|
-
readonly RESTORE_SUCCESS: "event.restore.success";
|
|
10
3
|
readonly NOT_FOUND: "event.not.found";
|
|
11
|
-
readonly PUBLISH_SUCCESS: "event.publish.success";
|
|
12
|
-
readonly UNPUBLISH_SUCCESS: "event.unpublish.success";
|
|
13
|
-
readonly CANCEL_SUCCESS: "event.cancel.success";
|
|
14
|
-
readonly UPCOMING_SUCCESS: "event.upcoming.success";
|
|
15
|
-
readonly MY_EVENTS_SUCCESS: "event.my.events.success";
|
|
16
4
|
};
|
|
17
5
|
export declare const EVENT_PARTICIPANT_MESSAGES: {
|
|
18
|
-
readonly CREATE_SUCCESS: "event.participant.create.success";
|
|
19
|
-
readonly CREATE_MANY_SUCCESS: "event.participant.create.many.success";
|
|
20
|
-
readonly GET_SUCCESS: "event.participant.get.success";
|
|
21
|
-
readonly GET_ALL_SUCCESS: "event.participant.get.all.success";
|
|
22
|
-
readonly UPDATE_SUCCESS: "event.participant.update.success";
|
|
23
|
-
readonly UPDATE_MANY_SUCCESS: "event.participant.update.many.success";
|
|
24
|
-
readonly DELETE_SUCCESS: "event.participant.delete.success";
|
|
25
|
-
readonly RESTORE_SUCCESS: "event.participant.restore.success";
|
|
26
6
|
readonly NOT_FOUND: "event.participant.not.found";
|
|
27
|
-
readonly REGISTER_SUCCESS: "event.participant.register.success";
|
|
28
|
-
readonly UNREGISTER_SUCCESS: "event.participant.unregister.success";
|
|
29
|
-
readonly CHECKIN_SUCCESS: "event.participant.checkin.success";
|
|
30
7
|
readonly STATUS_UPDATE_SUCCESS: "event.participant.status.update.success";
|
|
31
8
|
};
|
|
32
|
-
export declare const EVENT_MANAGER_MODULE_MESSAGES: {
|
|
33
|
-
readonly EVENT: {
|
|
34
|
-
readonly CREATE_SUCCESS: "event.create.success";
|
|
35
|
-
readonly CREATE_MANY_SUCCESS: "event.create.many.success";
|
|
36
|
-
readonly GET_SUCCESS: "event.get.success";
|
|
37
|
-
readonly GET_ALL_SUCCESS: "event.get.all.success";
|
|
38
|
-
readonly UPDATE_SUCCESS: "event.update.success";
|
|
39
|
-
readonly UPDATE_MANY_SUCCESS: "event.update.many.success";
|
|
40
|
-
readonly DELETE_SUCCESS: "event.delete.success";
|
|
41
|
-
readonly RESTORE_SUCCESS: "event.restore.success";
|
|
42
|
-
readonly NOT_FOUND: "event.not.found";
|
|
43
|
-
readonly PUBLISH_SUCCESS: "event.publish.success";
|
|
44
|
-
readonly UNPUBLISH_SUCCESS: "event.unpublish.success";
|
|
45
|
-
readonly CANCEL_SUCCESS: "event.cancel.success";
|
|
46
|
-
readonly UPCOMING_SUCCESS: "event.upcoming.success";
|
|
47
|
-
readonly MY_EVENTS_SUCCESS: "event.my.events.success";
|
|
48
|
-
};
|
|
49
|
-
readonly EVENT_PARTICIPANT: {
|
|
50
|
-
readonly CREATE_SUCCESS: "event.participant.create.success";
|
|
51
|
-
readonly CREATE_MANY_SUCCESS: "event.participant.create.many.success";
|
|
52
|
-
readonly GET_SUCCESS: "event.participant.get.success";
|
|
53
|
-
readonly GET_ALL_SUCCESS: "event.participant.get.all.success";
|
|
54
|
-
readonly UPDATE_SUCCESS: "event.participant.update.success";
|
|
55
|
-
readonly UPDATE_MANY_SUCCESS: "event.participant.update.many.success";
|
|
56
|
-
readonly DELETE_SUCCESS: "event.participant.delete.success";
|
|
57
|
-
readonly RESTORE_SUCCESS: "event.participant.restore.success";
|
|
58
|
-
readonly NOT_FOUND: "event.participant.not.found";
|
|
59
|
-
readonly REGISTER_SUCCESS: "event.participant.register.success";
|
|
60
|
-
readonly UNREGISTER_SUCCESS: "event.participant.unregister.success";
|
|
61
|
-
readonly CHECKIN_SUCCESS: "event.participant.checkin.success";
|
|
62
|
-
readonly STATUS_UPDATE_SUCCESS: "event.participant.status.update.success";
|
|
63
|
-
};
|
|
64
|
-
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ListResponseDto, SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
2
2
|
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { CalendarQueryDto, CalendarEventResponseDto, CreateEventDto, EventParticipantResponseDto, EventResponseDto, UpdateEventDto, UpdateParticipantStatusDto } from '../dtos';
|
|
4
4
|
import { EventService } from '../services/event.service';
|
|
5
5
|
declare const EventController_base: abstract new (service: EventService) => {
|
|
6
6
|
readonly enabledEndpoints: import("@flusys/nestjs-shared/classes").ApiEndpoint[] | "all";
|
|
@@ -21,9 +21,6 @@ export declare class EventController extends EventController_base {
|
|
|
21
21
|
protected eventService: EventService;
|
|
22
22
|
constructor(eventService: EventService);
|
|
23
23
|
getCalendarEvents(dto: CalendarQueryDto, user: ILoggedUserInfo): Promise<ListResponseDto<CalendarEventResponseDto>>;
|
|
24
|
-
|
|
25
|
-
id: string;
|
|
26
|
-
}, user: ILoggedUserInfo): Promise<SingleResponseDto<EventResponseDto>>;
|
|
27
|
-
addParticipants(dto: BulkAddParticipantsDto, user: ILoggedUserInfo): Promise<SingleResponseDto<EventParticipantResponseDto[]>>;
|
|
24
|
+
updateParticipantStatus(dto: UpdateParticipantStatusDto, user: ILoggedUserInfo): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
28
25
|
}
|
|
29
26
|
export {};
|
package/controllers/index.d.ts
CHANGED
package/docs/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { EVENT_PERMISSIONS
|
|
1
|
+
export { EVENT_PERMISSIONS } from '@flusys/nestjs-shared';
|
|
2
2
|
export { eventManagerSwaggerConfig } from './event-manager-swagger.config';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventParticipantResponseDto } from './event-participant.dto';
|
|
2
2
|
export declare class CalendarQueryDto {
|
|
3
|
-
startDate:
|
|
4
|
-
endDate:
|
|
3
|
+
startDate: string;
|
|
4
|
+
endDate: string;
|
|
5
5
|
includeParticipants?: boolean;
|
|
6
6
|
userId?: string;
|
|
7
7
|
activeOnly?: boolean;
|
|
@@ -10,12 +10,15 @@ export declare class CalendarEventResponseDto {
|
|
|
10
10
|
id: string;
|
|
11
11
|
title: string;
|
|
12
12
|
description?: string | null;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
eventDate: string;
|
|
14
|
+
startTime: string;
|
|
15
|
+
endTime: string;
|
|
16
16
|
isAllDay: boolean;
|
|
17
17
|
recurrenceType: string;
|
|
18
|
+
recurrenceEndDate?: string | null;
|
|
19
|
+
weekDays?: string[] | null;
|
|
18
20
|
color: string;
|
|
21
|
+
meetingLink?: string | null;
|
|
19
22
|
isActive: boolean;
|
|
20
23
|
originalEventId?: string;
|
|
21
24
|
isRecurrenceInstance?: boolean;
|
|
@@ -4,7 +4,6 @@ export declare class CreateEventParticipantDto {
|
|
|
4
4
|
userId: string;
|
|
5
5
|
status?: ParticipantStatus;
|
|
6
6
|
isOrganizer?: boolean;
|
|
7
|
-
metadata?: Record<string, unknown>;
|
|
8
7
|
}
|
|
9
8
|
declare const UpdateEventParticipantDto_base: import("@nestjs/common").Type<Partial<CreateEventParticipantDto>>;
|
|
10
9
|
export declare class UpdateEventParticipantDto extends UpdateEventParticipantDto_base {
|
|
@@ -16,7 +15,6 @@ export declare class EventParticipantResponseDto {
|
|
|
16
15
|
userId: string;
|
|
17
16
|
status: string;
|
|
18
17
|
isOrganizer: boolean;
|
|
19
|
-
metadata?: Record<string, unknown> | null;
|
|
20
18
|
createdAt: Date;
|
|
21
19
|
updatedAt: Date;
|
|
22
20
|
}
|
|
@@ -24,8 +22,4 @@ export declare class UpdateParticipantStatusDto {
|
|
|
24
22
|
id: string;
|
|
25
23
|
status: ParticipantStatus;
|
|
26
24
|
}
|
|
27
|
-
export declare class BulkAddParticipantsDto {
|
|
28
|
-
eventId: string;
|
|
29
|
-
userIds: string[];
|
|
30
|
-
}
|
|
31
25
|
export {};
|
package/dtos/event.dto.d.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { RecurrenceType } from '@flusys/nestjs-shared/enums';
|
|
2
|
+
import { EventParticipantResponseDto } from './event-participant.dto';
|
|
2
3
|
export declare class CreateEventDto {
|
|
3
4
|
title: string;
|
|
4
5
|
description?: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
eventDate: string;
|
|
7
|
+
startTime: string;
|
|
8
|
+
endTime: string;
|
|
8
9
|
isAllDay?: boolean;
|
|
9
10
|
recurrenceType?: RecurrenceType;
|
|
10
|
-
recurrenceEndDate?:
|
|
11
|
+
recurrenceEndDate?: string | null;
|
|
12
|
+
weekDays?: string[] | null;
|
|
11
13
|
color?: string;
|
|
12
14
|
isActive?: boolean;
|
|
13
|
-
|
|
15
|
+
meetingLink?: string | null;
|
|
14
16
|
participantIds?: string[];
|
|
15
17
|
}
|
|
16
18
|
declare const UpdateEventDto_base: import("@nestjs/common").Type<Partial<CreateEventDto>>;
|
|
@@ -21,17 +23,19 @@ export declare class EventResponseDto {
|
|
|
21
23
|
id: string;
|
|
22
24
|
title: string;
|
|
23
25
|
description?: string | null;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
eventDate: string;
|
|
27
|
+
startTime: string;
|
|
28
|
+
endTime: string;
|
|
27
29
|
isAllDay: boolean;
|
|
28
30
|
recurrenceType: string;
|
|
29
|
-
recurrenceEndDate?:
|
|
31
|
+
recurrenceEndDate?: string | null;
|
|
32
|
+
weekDays?: string[] | null;
|
|
30
33
|
color: string;
|
|
34
|
+
meetingLink?: string | null;
|
|
31
35
|
isActive: boolean;
|
|
32
|
-
metadata?: Record<string, unknown> | null;
|
|
33
36
|
companyId?: string | null;
|
|
34
37
|
createdAt: Date;
|
|
35
38
|
updatedAt: Date;
|
|
39
|
+
participants?: EventParticipantResponseDto[];
|
|
36
40
|
}
|
|
37
41
|
export {};
|
|
@@ -2,13 +2,14 @@ import { Identity } from '@flusys/nestjs-shared/entities';
|
|
|
2
2
|
export declare class Event extends Identity {
|
|
3
3
|
title: string;
|
|
4
4
|
description: string | null;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
eventDate: string;
|
|
6
|
+
startTime: string;
|
|
7
|
+
endTime: string;
|
|
8
8
|
isAllDay: boolean;
|
|
9
9
|
recurrenceType: string;
|
|
10
|
-
recurrenceEndDate:
|
|
10
|
+
recurrenceEndDate: string | null;
|
|
11
|
+
weekDays: string[] | null;
|
|
11
12
|
color: string;
|
|
13
|
+
meetingLink: string | null;
|
|
12
14
|
isActive: boolean;
|
|
13
|
-
metadata: Record<string, unknown> | null;
|
|
14
15
|
}
|