@flusys/nestjs-event-manager 3.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.
Files changed (89) hide show
  1. package/README.md +1328 -0
  2. package/adapters/event-manager.adapter.d.ts +12 -0
  3. package/adapters/index.d.ts +1 -0
  4. package/cjs/adapters/event-manager.adapter.js +71 -0
  5. package/cjs/adapters/index.js +18 -0
  6. package/cjs/config/event-manager.constants.js +13 -0
  7. package/cjs/config/index.js +18 -0
  8. package/cjs/controllers/event-participant.controller.js +271 -0
  9. package/cjs/controllers/event.controller.js +229 -0
  10. package/cjs/controllers/index.js +19 -0
  11. package/cjs/docs/event-manager-swagger.config.js +135 -0
  12. package/cjs/docs/index.js +24 -0
  13. package/cjs/dtos/calendar-query.dto.js +186 -0
  14. package/cjs/dtos/event-participant.dto.js +226 -0
  15. package/cjs/dtos/event.dto.js +291 -0
  16. package/cjs/dtos/index.js +20 -0
  17. package/cjs/entities/event-participant.entity.js +96 -0
  18. package/cjs/entities/event-with-company.entity.js +56 -0
  19. package/cjs/entities/event.entity.js +143 -0
  20. package/cjs/entities/index.js +55 -0
  21. package/cjs/index.js +27 -0
  22. package/cjs/interfaces/event-manager-module.interface.js +4 -0
  23. package/cjs/interfaces/event.interface.js +4 -0
  24. package/cjs/interfaces/index.js +19 -0
  25. package/cjs/modules/event-manager.module.js +133 -0
  26. package/cjs/modules/index.js +18 -0
  27. package/cjs/services/event-manager-config.service.js +76 -0
  28. package/cjs/services/event-manager-datasource.provider.js +181 -0
  29. package/cjs/services/event-manager-helper.service.js +253 -0
  30. package/cjs/services/event-participant.service.js +164 -0
  31. package/cjs/services/event.service.js +421 -0
  32. package/cjs/services/index.js +22 -0
  33. package/config/event-manager.constants.d.ts +1 -0
  34. package/config/index.d.ts +1 -0
  35. package/controllers/event-participant.controller.d.ts +31 -0
  36. package/controllers/event.controller.d.ts +24 -0
  37. package/controllers/index.d.ts +2 -0
  38. package/docs/event-manager-swagger.config.d.ts +3 -0
  39. package/docs/index.d.ts +2 -0
  40. package/dtos/calendar-query.dto.d.ts +23 -0
  41. package/dtos/event-participant.dto.d.ts +31 -0
  42. package/dtos/event.dto.d.ts +37 -0
  43. package/dtos/index.d.ts +3 -0
  44. package/entities/event-participant.entity.d.ts +8 -0
  45. package/entities/event-with-company.entity.d.ts +4 -0
  46. package/entities/event.entity.d.ts +14 -0
  47. package/entities/index.d.ts +11 -0
  48. package/fesm/adapters/event-manager.adapter.js +61 -0
  49. package/fesm/adapters/index.js +1 -0
  50. package/fesm/config/event-manager.constants.js +3 -0
  51. package/fesm/config/index.js +1 -0
  52. package/fesm/controllers/event-participant.controller.js +261 -0
  53. package/fesm/controllers/event.controller.js +219 -0
  54. package/fesm/controllers/index.js +2 -0
  55. package/fesm/docs/event-manager-swagger.config.js +128 -0
  56. package/fesm/docs/index.js +4 -0
  57. package/fesm/dtos/calendar-query.dto.js +168 -0
  58. package/fesm/dtos/event-participant.dto.js +199 -0
  59. package/fesm/dtos/event.dto.js +270 -0
  60. package/fesm/dtos/index.js +3 -0
  61. package/fesm/entities/event-participant.entity.js +86 -0
  62. package/fesm/entities/event-with-company.entity.js +46 -0
  63. package/fesm/entities/event.entity.js +133 -0
  64. package/fesm/entities/index.js +24 -0
  65. package/fesm/index.js +10 -0
  66. package/fesm/interfaces/event-manager-module.interface.js +3 -0
  67. package/fesm/interfaces/event.interface.js +1 -0
  68. package/fesm/interfaces/index.js +2 -0
  69. package/fesm/modules/event-manager.module.js +123 -0
  70. package/fesm/modules/index.js +1 -0
  71. package/fesm/services/event-manager-config.service.js +66 -0
  72. package/fesm/services/event-manager-datasource.provider.js +130 -0
  73. package/fesm/services/event-manager-helper.service.js +243 -0
  74. package/fesm/services/event-participant.service.js +154 -0
  75. package/fesm/services/event.service.js +411 -0
  76. package/fesm/services/index.js +5 -0
  77. package/index.d.ts +9 -0
  78. package/interfaces/event-manager-module.interface.d.ts +20 -0
  79. package/interfaces/event.interface.d.ts +28 -0
  80. package/interfaces/index.d.ts +2 -0
  81. package/modules/event-manager.module.d.ts +8 -0
  82. package/modules/index.d.ts +1 -0
  83. package/package.json +89 -0
  84. package/services/event-manager-config.service.d.ts +13 -0
  85. package/services/event-manager-datasource.provider.d.ts +23 -0
  86. package/services/event-manager-helper.service.d.ts +27 -0
  87. package/services/event-participant.service.d.ts +27 -0
  88. package/services/event.service.d.ts +49 -0
  89. package/services/index.d.ts +5 -0
@@ -0,0 +1,12 @@
1
+ import { IEventManagerAdapter, CreateEventOptions, EventResult, ParticipantStatus } from '@flusys/nestjs-shared';
2
+ import { EventManagerHelperService } from '../services/event-manager-helper.service';
3
+ export declare class EventManagerAdapter implements IEventManagerAdapter {
4
+ private readonly eventManagerHelper;
5
+ constructor(eventManagerHelper: EventManagerHelperService);
6
+ createEvent(options: CreateEventOptions): Promise<EventResult>;
7
+ addParticipants(eventId: string, userIds: string[], companyId?: string): Promise<void>;
8
+ removeParticipant(eventId: string, userId: string): Promise<void>;
9
+ updateParticipantStatus(participantId: string, status: ParticipantStatus): Promise<void>;
10
+ getEventsForUser(userId: string, startDate: Date, endDate: Date, companyId?: string): Promise<EventResult[]>;
11
+ getEventById(eventId: string): Promise<EventResult | null>;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './event-manager.adapter';
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EventManagerAdapter", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return EventManagerAdapter;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _eventmanagerhelperservice = require("../services/event-manager-helper.service");
13
+ function _define_property(obj, key, value) {
14
+ if (key in obj) {
15
+ Object.defineProperty(obj, key, {
16
+ value: value,
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true
20
+ });
21
+ } else {
22
+ obj[key] = value;
23
+ }
24
+ return obj;
25
+ }
26
+ function _ts_decorate(decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ }
32
+ function _ts_metadata(k, v) {
33
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
34
+ }
35
+ function _ts_param(paramIndex, decorator) {
36
+ return function(target, key) {
37
+ decorator(target, key, paramIndex);
38
+ };
39
+ }
40
+ let EventManagerAdapter = class EventManagerAdapter {
41
+ async createEvent(options) {
42
+ return this.eventManagerHelper.createEvent(options);
43
+ }
44
+ async addParticipants(eventId, userIds, companyId) {
45
+ await this.eventManagerHelper.addParticipants(eventId, userIds, companyId);
46
+ }
47
+ async removeParticipant(eventId, userId) {
48
+ await this.eventManagerHelper.removeParticipant(eventId, userId);
49
+ }
50
+ async updateParticipantStatus(participantId, status) {
51
+ await this.eventManagerHelper.updateParticipantStatus(participantId, status);
52
+ }
53
+ async getEventsForUser(userId, startDate, endDate, companyId) {
54
+ return this.eventManagerHelper.getEventsForUser(userId, startDate, endDate, companyId);
55
+ }
56
+ async getEventById(eventId) {
57
+ return this.eventManagerHelper.getEventById(eventId);
58
+ }
59
+ constructor(eventManagerHelper){
60
+ _define_property(this, "eventManagerHelper", void 0);
61
+ this.eventManagerHelper = eventManagerHelper;
62
+ }
63
+ };
64
+ EventManagerAdapter = _ts_decorate([
65
+ (0, _common.Injectable)(),
66
+ _ts_param(0, (0, _common.Inject)(_eventmanagerhelperservice.EventManagerHelperService)),
67
+ _ts_metadata("design:type", Function),
68
+ _ts_metadata("design:paramtypes", [
69
+ typeof _eventmanagerhelperservice.EventManagerHelperService === "undefined" ? Object : _eventmanagerhelperservice.EventManagerHelperService
70
+ ])
71
+ ], EventManagerAdapter);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./event-manager.adapter"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Event Manager Module Constants
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "EVENT_MANAGER_MODULE_OPTIONS", {
8
+ enumerable: true,
9
+ get: function() {
10
+ return EVENT_MANAGER_MODULE_OPTIONS;
11
+ }
12
+ });
13
+ const EVENT_MANAGER_MODULE_OPTIONS = 'EVENT_MANAGER_MODULE_OPTIONS';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./event-manager.constants"), exports);
6
+ function _export_star(from, to) {
7
+ Object.keys(from).forEach(function(k) {
8
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
+ Object.defineProperty(to, k, {
10
+ enumerable: true,
11
+ get: function() {
12
+ return from[k];
13
+ }
14
+ });
15
+ }
16
+ });
17
+ return from;
18
+ }
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EventParticipantController", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return EventParticipantController;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _swagger = require("@nestjs/swagger");
13
+ const _classes = require("@flusys/nestjs-shared/classes");
14
+ const _decorators = require("@flusys/nestjs-shared/decorators");
15
+ const _dtos = require("@flusys/nestjs-shared/dtos");
16
+ const _guards = require("@flusys/nestjs-shared/guards");
17
+ const _interfaces = require("@flusys/nestjs-shared/interfaces");
18
+ const _dtos1 = require("../dtos");
19
+ const _docs = require("../docs");
20
+ const _eventparticipantservice = require("../services/event-participant.service");
21
+ function _define_property(obj, key, value) {
22
+ if (key in obj) {
23
+ Object.defineProperty(obj, key, {
24
+ value: value,
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true
28
+ });
29
+ } else {
30
+ obj[key] = value;
31
+ }
32
+ return obj;
33
+ }
34
+ function _ts_decorate(decorators, target, key, desc) {
35
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
38
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
39
+ }
40
+ function _ts_metadata(k, v) {
41
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
42
+ }
43
+ function _ts_param(paramIndex, decorator) {
44
+ return function(target, key) {
45
+ decorator(target, key, paramIndex);
46
+ };
47
+ }
48
+ let EventParticipantController = class EventParticipantController extends (0, _classes.createApiController)(_dtos1.CreateEventParticipantDto, _dtos1.UpdateEventParticipantDto, _dtos1.EventParticipantResponseDto, {
49
+ security: {
50
+ insert: {
51
+ level: 'permission',
52
+ permissions: [
53
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.CREATE
54
+ ]
55
+ },
56
+ insertMany: {
57
+ level: 'permission',
58
+ permissions: [
59
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.CREATE
60
+ ]
61
+ },
62
+ getById: {
63
+ level: 'permission',
64
+ permissions: [
65
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.READ
66
+ ]
67
+ },
68
+ getAll: {
69
+ level: 'permission',
70
+ permissions: [
71
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.READ
72
+ ]
73
+ },
74
+ update: {
75
+ level: 'permission',
76
+ permissions: [
77
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE
78
+ ]
79
+ },
80
+ updateMany: {
81
+ level: 'permission',
82
+ permissions: [
83
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE
84
+ ]
85
+ },
86
+ delete: {
87
+ level: 'permission',
88
+ permissions: [
89
+ _docs.EVENT_PARTICIPANT_PERMISSIONS.DELETE
90
+ ]
91
+ }
92
+ }
93
+ }) {
94
+ async updateStatus(dto, user) {
95
+ const participant = await this.participantService.updateStatus(dto, user);
96
+ return {
97
+ success: true,
98
+ message: 'Participant status updated successfully',
99
+ data: participant
100
+ };
101
+ }
102
+ async getByEvent(body, user) {
103
+ const participants = await this.participantService.getParticipantsByEvent(body.eventId, user);
104
+ return this.buildListResponse(participants, 'Participants retrieved successfully');
105
+ }
106
+ async getByUser(body, user) {
107
+ const participants = await this.participantService.getParticipantsByUser(body.userId, user);
108
+ return this.buildListResponse(participants, 'Participations retrieved successfully');
109
+ }
110
+ async removeParticipant(body, user) {
111
+ await this.participantService.removeParticipant(body.eventId, body.userId, user);
112
+ return {
113
+ success: true,
114
+ message: 'Participant removed successfully'
115
+ };
116
+ }
117
+ buildListResponse(data, message) {
118
+ return {
119
+ success: true,
120
+ message,
121
+ data: data,
122
+ meta: {
123
+ total: data.length,
124
+ page: 0,
125
+ pageSize: data.length,
126
+ count: data.length
127
+ }
128
+ };
129
+ }
130
+ constructor(participantService){
131
+ super(participantService), _define_property(this, "participantService", void 0), this.participantService = participantService;
132
+ }
133
+ };
134
+ _ts_decorate([
135
+ (0, _common.Post)('update-status'),
136
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
137
+ (0, _swagger.ApiBearerAuth)(),
138
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
139
+ (0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE),
140
+ (0, _swagger.ApiOperation)({
141
+ summary: 'Update participant status (accept/decline/tentative)'
142
+ }),
143
+ (0, _swagger.ApiBody)({
144
+ type: _dtos1.UpdateParticipantStatusDto
145
+ }),
146
+ (0, _swagger.ApiResponse)({
147
+ status: 200,
148
+ description: 'Status updated successfully',
149
+ type: _dtos.SingleResponseDto
150
+ }),
151
+ _ts_param(0, (0, _common.Body)()),
152
+ _ts_param(1, (0, _decorators.CurrentUser)()),
153
+ _ts_metadata("design:type", Function),
154
+ _ts_metadata("design:paramtypes", [
155
+ typeof _dtos1.UpdateParticipantStatusDto === "undefined" ? Object : _dtos1.UpdateParticipantStatusDto,
156
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
157
+ ]),
158
+ _ts_metadata("design:returntype", Promise)
159
+ ], EventParticipantController.prototype, "updateStatus", null);
160
+ _ts_decorate([
161
+ (0, _common.Post)('get-by-event'),
162
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
163
+ (0, _swagger.ApiBearerAuth)(),
164
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
165
+ (0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.READ),
166
+ (0, _swagger.ApiOperation)({
167
+ summary: 'Get all participants for an event'
168
+ }),
169
+ (0, _swagger.ApiBody)({
170
+ schema: {
171
+ properties: {
172
+ eventId: {
173
+ type: 'string',
174
+ format: 'uuid'
175
+ }
176
+ }
177
+ }
178
+ }),
179
+ (0, _swagger.ApiResponse)({
180
+ status: 200,
181
+ description: 'Participants retrieved successfully',
182
+ type: _dtos.ListResponseDto
183
+ }),
184
+ _ts_param(0, (0, _common.Body)()),
185
+ _ts_param(1, (0, _decorators.CurrentUser)()),
186
+ _ts_metadata("design:type", Function),
187
+ _ts_metadata("design:paramtypes", [
188
+ Object,
189
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
190
+ ]),
191
+ _ts_metadata("design:returntype", Promise)
192
+ ], EventParticipantController.prototype, "getByEvent", null);
193
+ _ts_decorate([
194
+ (0, _common.Post)('get-by-user'),
195
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
196
+ (0, _swagger.ApiBearerAuth)(),
197
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
198
+ (0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.READ),
199
+ (0, _swagger.ApiOperation)({
200
+ summary: 'Get all event participations for a user'
201
+ }),
202
+ (0, _swagger.ApiBody)({
203
+ schema: {
204
+ properties: {
205
+ userId: {
206
+ type: 'string',
207
+ format: 'uuid'
208
+ }
209
+ }
210
+ }
211
+ }),
212
+ (0, _swagger.ApiResponse)({
213
+ status: 200,
214
+ description: 'Participations retrieved successfully',
215
+ type: _dtos.ListResponseDto
216
+ }),
217
+ _ts_param(0, (0, _common.Body)()),
218
+ _ts_param(1, (0, _decorators.CurrentUser)()),
219
+ _ts_metadata("design:type", Function),
220
+ _ts_metadata("design:paramtypes", [
221
+ Object,
222
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
223
+ ]),
224
+ _ts_metadata("design:returntype", Promise)
225
+ ], EventParticipantController.prototype, "getByUser", null);
226
+ _ts_decorate([
227
+ (0, _common.Post)('remove'),
228
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
229
+ (0, _swagger.ApiBearerAuth)(),
230
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
231
+ (0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.DELETE),
232
+ (0, _swagger.ApiOperation)({
233
+ summary: 'Remove a participant from an event'
234
+ }),
235
+ (0, _swagger.ApiBody)({
236
+ schema: {
237
+ properties: {
238
+ eventId: {
239
+ type: 'string',
240
+ format: 'uuid'
241
+ },
242
+ userId: {
243
+ type: 'string',
244
+ format: 'uuid'
245
+ }
246
+ }
247
+ }
248
+ }),
249
+ (0, _swagger.ApiResponse)({
250
+ status: 200,
251
+ description: 'Participant removed successfully',
252
+ type: _dtos.MessageResponseDto
253
+ }),
254
+ _ts_param(0, (0, _common.Body)()),
255
+ _ts_param(1, (0, _decorators.CurrentUser)()),
256
+ _ts_metadata("design:type", Function),
257
+ _ts_metadata("design:paramtypes", [
258
+ Object,
259
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
260
+ ]),
261
+ _ts_metadata("design:returntype", Promise)
262
+ ], EventParticipantController.prototype, "removeParticipant", null);
263
+ EventParticipantController = _ts_decorate([
264
+ (0, _swagger.ApiTags)('Event Participants'),
265
+ (0, _common.Controller)('event-manager/participant'),
266
+ _ts_param(0, (0, _common.Inject)(_eventparticipantservice.EventParticipantService)),
267
+ _ts_metadata("design:type", Function),
268
+ _ts_metadata("design:paramtypes", [
269
+ typeof _eventparticipantservice.EventParticipantService === "undefined" ? Object : _eventparticipantservice.EventParticipantService
270
+ ])
271
+ ], EventParticipantController);
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "EventController", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return EventController;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _swagger = require("@nestjs/swagger");
13
+ const _classes = require("@flusys/nestjs-shared/classes");
14
+ const _decorators = require("@flusys/nestjs-shared/decorators");
15
+ const _dtos = require("@flusys/nestjs-shared/dtos");
16
+ const _guards = require("@flusys/nestjs-shared/guards");
17
+ const _interfaces = require("@flusys/nestjs-shared/interfaces");
18
+ const _classtransformer = require("class-transformer");
19
+ const _dtos1 = require("../dtos");
20
+ const _docs = require("../docs");
21
+ const _eventservice = require("../services/event.service");
22
+ function _define_property(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _ts_decorate(decorators, target, key, desc) {
36
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
39
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
40
+ }
41
+ function _ts_metadata(k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ }
44
+ function _ts_param(paramIndex, decorator) {
45
+ return function(target, key) {
46
+ decorator(target, key, paramIndex);
47
+ };
48
+ }
49
+ let EventController = class EventController extends (0, _classes.createApiController)(_dtos1.CreateEventDto, _dtos1.UpdateEventDto, _dtos1.EventResponseDto, {
50
+ security: {
51
+ insert: {
52
+ level: 'permission',
53
+ permissions: [
54
+ _docs.EVENT_PERMISSIONS.CREATE
55
+ ]
56
+ },
57
+ insertMany: {
58
+ level: 'permission',
59
+ permissions: [
60
+ _docs.EVENT_PERMISSIONS.CREATE
61
+ ]
62
+ },
63
+ getById: {
64
+ level: 'permission',
65
+ permissions: [
66
+ _docs.EVENT_PERMISSIONS.READ
67
+ ]
68
+ },
69
+ getAll: {
70
+ level: 'permission',
71
+ permissions: [
72
+ _docs.EVENT_PERMISSIONS.READ
73
+ ]
74
+ },
75
+ update: {
76
+ level: 'permission',
77
+ permissions: [
78
+ _docs.EVENT_PERMISSIONS.UPDATE
79
+ ]
80
+ },
81
+ updateMany: {
82
+ level: 'permission',
83
+ permissions: [
84
+ _docs.EVENT_PERMISSIONS.UPDATE
85
+ ]
86
+ },
87
+ delete: {
88
+ level: 'permission',
89
+ permissions: [
90
+ _docs.EVENT_PERMISSIONS.DELETE
91
+ ]
92
+ }
93
+ }
94
+ }) {
95
+ async getCalendarEvents(dto, user) {
96
+ const events = await this.eventService.getEventsForCalendarRange(dto, user);
97
+ const data = (0, _classtransformer.plainToInstance)(_dtos1.CalendarEventResponseDto, events);
98
+ return {
99
+ success: true,
100
+ message: 'Calendar events retrieved successfully',
101
+ data,
102
+ meta: {
103
+ total: data.length,
104
+ page: 0,
105
+ pageSize: data.length,
106
+ count: data.length
107
+ }
108
+ };
109
+ }
110
+ async getEventWithParticipants(body, user) {
111
+ const event = await this.eventService.getEventWithParticipants(body.id, user);
112
+ if (!event) {
113
+ return {
114
+ success: false,
115
+ message: 'Event not found'
116
+ };
117
+ }
118
+ return {
119
+ success: true,
120
+ message: 'Event retrieved successfully',
121
+ data: (0, _classtransformer.plainToInstance)(_dtos1.EventResponseDto, event)
122
+ };
123
+ }
124
+ async addParticipants(dto, user) {
125
+ const participants = await this.eventService.addParticipants(dto.eventId, dto.userIds, user);
126
+ return {
127
+ success: true,
128
+ message: 'Participants added successfully',
129
+ data: (0, _classtransformer.plainToInstance)(_dtos1.EventParticipantResponseDto, participants)
130
+ };
131
+ }
132
+ constructor(eventService){
133
+ super(eventService), _define_property(this, "eventService", void 0), this.eventService = eventService;
134
+ }
135
+ };
136
+ _ts_decorate([
137
+ (0, _common.Post)('calendar'),
138
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
139
+ (0, _swagger.ApiBearerAuth)(),
140
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
141
+ (0, _decorators.RequirePermission)(_docs.EVENT_PERMISSIONS.READ),
142
+ (0, _swagger.ApiOperation)({
143
+ summary: 'Get events for calendar range with recurrence expansion'
144
+ }),
145
+ (0, _swagger.ApiBody)({
146
+ type: _dtos1.CalendarQueryDto
147
+ }),
148
+ (0, _swagger.ApiResponse)({
149
+ status: 200,
150
+ description: 'Calendar events retrieved successfully',
151
+ type: _dtos.ListResponseDto
152
+ }),
153
+ _ts_param(0, (0, _common.Body)()),
154
+ _ts_param(1, (0, _decorators.CurrentUser)()),
155
+ _ts_metadata("design:type", Function),
156
+ _ts_metadata("design:paramtypes", [
157
+ typeof _dtos1.CalendarQueryDto === "undefined" ? Object : _dtos1.CalendarQueryDto,
158
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
159
+ ]),
160
+ _ts_metadata("design:returntype", Promise)
161
+ ], EventController.prototype, "getCalendarEvents", null);
162
+ _ts_decorate([
163
+ (0, _common.Post)('get-with-participants'),
164
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
165
+ (0, _swagger.ApiBearerAuth)(),
166
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
167
+ (0, _decorators.RequirePermission)(_docs.EVENT_PERMISSIONS.READ),
168
+ (0, _swagger.ApiOperation)({
169
+ summary: 'Get event with participants'
170
+ }),
171
+ (0, _swagger.ApiBody)({
172
+ schema: {
173
+ properties: {
174
+ id: {
175
+ type: 'string',
176
+ format: 'uuid'
177
+ }
178
+ }
179
+ }
180
+ }),
181
+ (0, _swagger.ApiResponse)({
182
+ status: 200,
183
+ description: 'Event retrieved successfully',
184
+ type: _dtos.SingleResponseDto
185
+ }),
186
+ _ts_param(0, (0, _common.Body)()),
187
+ _ts_param(1, (0, _decorators.CurrentUser)()),
188
+ _ts_metadata("design:type", Function),
189
+ _ts_metadata("design:paramtypes", [
190
+ Object,
191
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
192
+ ]),
193
+ _ts_metadata("design:returntype", Promise)
194
+ ], EventController.prototype, "getEventWithParticipants", null);
195
+ _ts_decorate([
196
+ (0, _common.Post)('add-participants'),
197
+ (0, _common.UseGuards)(_guards.JwtAuthGuard),
198
+ (0, _swagger.ApiBearerAuth)(),
199
+ (0, _common.HttpCode)(_common.HttpStatus.OK),
200
+ (0, _decorators.RequirePermission)(_docs.EVENT_PERMISSIONS.UPDATE),
201
+ (0, _swagger.ApiOperation)({
202
+ summary: 'Add participants to an event'
203
+ }),
204
+ (0, _swagger.ApiBody)({
205
+ type: _dtos1.BulkAddParticipantsDto
206
+ }),
207
+ (0, _swagger.ApiResponse)({
208
+ status: 200,
209
+ description: 'Participants added successfully',
210
+ type: _dtos.SingleResponseDto
211
+ }),
212
+ _ts_param(0, (0, _common.Body)()),
213
+ _ts_param(1, (0, _decorators.CurrentUser)()),
214
+ _ts_metadata("design:type", Function),
215
+ _ts_metadata("design:paramtypes", [
216
+ typeof _dtos1.BulkAddParticipantsDto === "undefined" ? Object : _dtos1.BulkAddParticipantsDto,
217
+ typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
218
+ ]),
219
+ _ts_metadata("design:returntype", Promise)
220
+ ], EventController.prototype, "addParticipants", null);
221
+ EventController = _ts_decorate([
222
+ (0, _swagger.ApiTags)('Events'),
223
+ (0, _common.Controller)('event-manager/event'),
224
+ _ts_param(0, (0, _common.Inject)(_eventservice.EventService)),
225
+ _ts_metadata("design:type", Function),
226
+ _ts_metadata("design:paramtypes", [
227
+ typeof _eventservice.EventService === "undefined" ? Object : _eventservice.EventService
228
+ ])
229
+ ], EventController);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./event.controller"), exports);
6
+ _export_star(require("./event-participant.controller"), exports);
7
+ function _export_star(from, to) {
8
+ Object.keys(from).forEach(function(k) {
9
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
10
+ Object.defineProperty(to, k, {
11
+ enumerable: true,
12
+ get: function() {
13
+ return from[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ return from;
19
+ }