@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
|
@@ -1,287 +0,0 @@
|
|
|
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 _classtransformer = require("class-transformer");
|
|
14
|
-
const _classes = require("@flusys/nestjs-shared/classes");
|
|
15
|
-
const _config = require("../config");
|
|
16
|
-
const _decorators = require("@flusys/nestjs-shared/decorators");
|
|
17
|
-
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
18
|
-
const _guards = require("@flusys/nestjs-shared/guards");
|
|
19
|
-
const _interfaces = require("@flusys/nestjs-shared/interfaces");
|
|
20
|
-
const _dtos1 = require("../dtos");
|
|
21
|
-
const _docs = require("../docs");
|
|
22
|
-
const _eventparticipantservice = require("../services/event-participant.service");
|
|
23
|
-
function _define_property(obj, key, value) {
|
|
24
|
-
if (key in obj) {
|
|
25
|
-
Object.defineProperty(obj, key, {
|
|
26
|
-
value: value,
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
obj[key] = value;
|
|
33
|
-
}
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
37
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
38
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
39
|
-
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;
|
|
40
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
41
|
-
}
|
|
42
|
-
function _ts_metadata(k, v) {
|
|
43
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
44
|
-
}
|
|
45
|
-
function _ts_param(paramIndex, decorator) {
|
|
46
|
-
return function(target, key) {
|
|
47
|
-
decorator(target, key, paramIndex);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
let EventParticipantController = class EventParticipantController extends (0, _classes.createApiController)(_dtos1.CreateEventParticipantDto, _dtos1.UpdateEventParticipantDto, _dtos1.EventParticipantResponseDto, {
|
|
51
|
-
entityName: 'eventParticipant',
|
|
52
|
-
security: {
|
|
53
|
-
insert: {
|
|
54
|
-
level: 'permission',
|
|
55
|
-
permissions: [
|
|
56
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.CREATE
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
insertMany: {
|
|
60
|
-
level: 'permission',
|
|
61
|
-
permissions: [
|
|
62
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.CREATE
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
getById: {
|
|
66
|
-
level: 'permission',
|
|
67
|
-
permissions: [
|
|
68
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.READ
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
getAll: {
|
|
72
|
-
level: 'permission',
|
|
73
|
-
permissions: [
|
|
74
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.READ
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
update: {
|
|
78
|
-
level: 'permission',
|
|
79
|
-
permissions: [
|
|
80
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE
|
|
81
|
-
]
|
|
82
|
-
},
|
|
83
|
-
updateMany: {
|
|
84
|
-
level: 'permission',
|
|
85
|
-
permissions: [
|
|
86
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
delete: {
|
|
90
|
-
level: 'permission',
|
|
91
|
-
permissions: [
|
|
92
|
-
_docs.EVENT_PARTICIPANT_PERMISSIONS.DELETE
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}) {
|
|
97
|
-
async updateStatus(dto, user) {
|
|
98
|
-
const participant = await this.participantService.updateStatus(dto, user);
|
|
99
|
-
return {
|
|
100
|
-
success: true,
|
|
101
|
-
message: 'Participant status updated successfully',
|
|
102
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.STATUS_UPDATE_SUCCESS,
|
|
103
|
-
data: (0, _classtransformer.plainToInstance)(_dtos1.EventParticipantResponseDto, participant)
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
async getByEvent(body, user) {
|
|
107
|
-
const participants = await this.participantService.getParticipantsByEvent(body.eventId, user);
|
|
108
|
-
const data = (0, _classtransformer.plainToInstance)(_dtos1.EventParticipantResponseDto, participants);
|
|
109
|
-
return {
|
|
110
|
-
success: true,
|
|
111
|
-
message: 'Participants retrieved successfully',
|
|
112
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.GET_ALL_SUCCESS,
|
|
113
|
-
data,
|
|
114
|
-
meta: {
|
|
115
|
-
total: data.length,
|
|
116
|
-
page: 0,
|
|
117
|
-
pageSize: data.length,
|
|
118
|
-
count: data.length
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async getByUser(body, user) {
|
|
123
|
-
const participants = await this.participantService.getParticipantsByUser(body.userId, user);
|
|
124
|
-
const data = (0, _classtransformer.plainToInstance)(_dtos1.EventParticipantResponseDto, participants);
|
|
125
|
-
return {
|
|
126
|
-
success: true,
|
|
127
|
-
message: 'Participations retrieved successfully',
|
|
128
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.GET_ALL_SUCCESS,
|
|
129
|
-
data,
|
|
130
|
-
meta: {
|
|
131
|
-
total: data.length,
|
|
132
|
-
page: 0,
|
|
133
|
-
pageSize: data.length,
|
|
134
|
-
count: data.length
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
async removeParticipant(body, user) {
|
|
139
|
-
await this.participantService.removeParticipant(body.eventId, body.userId, user);
|
|
140
|
-
return {
|
|
141
|
-
success: true,
|
|
142
|
-
message: 'Participant removed successfully',
|
|
143
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.DELETE_SUCCESS
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
constructor(participantService){
|
|
147
|
-
super(participantService), _define_property(this, "participantService", void 0), this.participantService = participantService;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
_ts_decorate([
|
|
151
|
-
(0, _common.Post)('update-status'),
|
|
152
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
153
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
154
|
-
(0, _common.HttpCode)(_common.HttpStatus.OK),
|
|
155
|
-
(0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.UPDATE),
|
|
156
|
-
(0, _swagger.ApiOperation)({
|
|
157
|
-
summary: 'Update participant status (accept/decline/tentative)'
|
|
158
|
-
}),
|
|
159
|
-
(0, _swagger.ApiBody)({
|
|
160
|
-
type: _dtos1.UpdateParticipantStatusDto
|
|
161
|
-
}),
|
|
162
|
-
(0, _swagger.ApiResponse)({
|
|
163
|
-
status: 200,
|
|
164
|
-
description: 'Status updated successfully',
|
|
165
|
-
type: _dtos.SingleResponseDto
|
|
166
|
-
}),
|
|
167
|
-
_ts_param(0, (0, _common.Body)()),
|
|
168
|
-
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
169
|
-
_ts_metadata("design:type", Function),
|
|
170
|
-
_ts_metadata("design:paramtypes", [
|
|
171
|
-
typeof _dtos1.UpdateParticipantStatusDto === "undefined" ? Object : _dtos1.UpdateParticipantStatusDto,
|
|
172
|
-
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
173
|
-
]),
|
|
174
|
-
_ts_metadata("design:returntype", Promise)
|
|
175
|
-
], EventParticipantController.prototype, "updateStatus", null);
|
|
176
|
-
_ts_decorate([
|
|
177
|
-
(0, _common.Post)('get-by-event'),
|
|
178
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
179
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
180
|
-
(0, _common.HttpCode)(_common.HttpStatus.OK),
|
|
181
|
-
(0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.READ),
|
|
182
|
-
(0, _swagger.ApiOperation)({
|
|
183
|
-
summary: 'Get all participants for an event'
|
|
184
|
-
}),
|
|
185
|
-
(0, _swagger.ApiBody)({
|
|
186
|
-
schema: {
|
|
187
|
-
properties: {
|
|
188
|
-
eventId: {
|
|
189
|
-
type: 'string',
|
|
190
|
-
format: 'uuid'
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}),
|
|
195
|
-
(0, _swagger.ApiResponse)({
|
|
196
|
-
status: 200,
|
|
197
|
-
description: 'Participants retrieved successfully',
|
|
198
|
-
type: _dtos.ListResponseDto
|
|
199
|
-
}),
|
|
200
|
-
_ts_param(0, (0, _common.Body)()),
|
|
201
|
-
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
202
|
-
_ts_metadata("design:type", Function),
|
|
203
|
-
_ts_metadata("design:paramtypes", [
|
|
204
|
-
Object,
|
|
205
|
-
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
206
|
-
]),
|
|
207
|
-
_ts_metadata("design:returntype", Promise)
|
|
208
|
-
], EventParticipantController.prototype, "getByEvent", null);
|
|
209
|
-
_ts_decorate([
|
|
210
|
-
(0, _common.Post)('get-by-user'),
|
|
211
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
212
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
213
|
-
(0, _common.HttpCode)(_common.HttpStatus.OK),
|
|
214
|
-
(0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.READ),
|
|
215
|
-
(0, _swagger.ApiOperation)({
|
|
216
|
-
summary: 'Get all event participations for a user'
|
|
217
|
-
}),
|
|
218
|
-
(0, _swagger.ApiBody)({
|
|
219
|
-
schema: {
|
|
220
|
-
properties: {
|
|
221
|
-
userId: {
|
|
222
|
-
type: 'string',
|
|
223
|
-
format: 'uuid'
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}),
|
|
228
|
-
(0, _swagger.ApiResponse)({
|
|
229
|
-
status: 200,
|
|
230
|
-
description: 'Participations retrieved successfully',
|
|
231
|
-
type: _dtos.ListResponseDto
|
|
232
|
-
}),
|
|
233
|
-
_ts_param(0, (0, _common.Body)()),
|
|
234
|
-
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
235
|
-
_ts_metadata("design:type", Function),
|
|
236
|
-
_ts_metadata("design:paramtypes", [
|
|
237
|
-
Object,
|
|
238
|
-
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
239
|
-
]),
|
|
240
|
-
_ts_metadata("design:returntype", Promise)
|
|
241
|
-
], EventParticipantController.prototype, "getByUser", null);
|
|
242
|
-
_ts_decorate([
|
|
243
|
-
(0, _common.Post)('remove'),
|
|
244
|
-
(0, _common.UseGuards)(_guards.JwtAuthGuard),
|
|
245
|
-
(0, _swagger.ApiBearerAuth)(),
|
|
246
|
-
(0, _common.HttpCode)(_common.HttpStatus.OK),
|
|
247
|
-
(0, _decorators.RequirePermission)(_docs.EVENT_PARTICIPANT_PERMISSIONS.DELETE),
|
|
248
|
-
(0, _swagger.ApiOperation)({
|
|
249
|
-
summary: 'Remove a participant from an event'
|
|
250
|
-
}),
|
|
251
|
-
(0, _swagger.ApiBody)({
|
|
252
|
-
schema: {
|
|
253
|
-
properties: {
|
|
254
|
-
eventId: {
|
|
255
|
-
type: 'string',
|
|
256
|
-
format: 'uuid'
|
|
257
|
-
},
|
|
258
|
-
userId: {
|
|
259
|
-
type: 'string',
|
|
260
|
-
format: 'uuid'
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}),
|
|
265
|
-
(0, _swagger.ApiResponse)({
|
|
266
|
-
status: 200,
|
|
267
|
-
description: 'Participant removed successfully',
|
|
268
|
-
type: _dtos.MessageResponseDto
|
|
269
|
-
}),
|
|
270
|
-
_ts_param(0, (0, _common.Body)()),
|
|
271
|
-
_ts_param(1, (0, _decorators.CurrentUser)()),
|
|
272
|
-
_ts_metadata("design:type", Function),
|
|
273
|
-
_ts_metadata("design:paramtypes", [
|
|
274
|
-
Object,
|
|
275
|
-
typeof _interfaces.ILoggedUserInfo === "undefined" ? Object : _interfaces.ILoggedUserInfo
|
|
276
|
-
]),
|
|
277
|
-
_ts_metadata("design:returntype", Promise)
|
|
278
|
-
], EventParticipantController.prototype, "removeParticipant", null);
|
|
279
|
-
EventParticipantController = _ts_decorate([
|
|
280
|
-
(0, _swagger.ApiTags)('Event Participants'),
|
|
281
|
-
(0, _common.Controller)('event-manager/participant'),
|
|
282
|
-
_ts_param(0, (0, _common.Inject)(_eventparticipantservice.EventParticipantService)),
|
|
283
|
-
_ts_metadata("design:type", Function),
|
|
284
|
-
_ts_metadata("design:paramtypes", [
|
|
285
|
-
typeof _eventparticipantservice.EventParticipantService === "undefined" ? Object : _eventparticipantservice.EventParticipantService
|
|
286
|
-
])
|
|
287
|
-
], EventParticipantController);
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "EventParticipantService", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return EventParticipantService;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _classes = require("@flusys/nestjs-shared/classes");
|
|
12
|
-
const _decorators = require("@flusys/nestjs-shared/decorators");
|
|
13
|
-
const _enums = require("@flusys/nestjs-shared/enums");
|
|
14
|
-
const _modules = require("@flusys/nestjs-shared/modules");
|
|
15
|
-
const _config = require("../config");
|
|
16
|
-
const _common = require("@nestjs/common");
|
|
17
|
-
const _eventmanagerconfigservice = require("./event-manager-config.service");
|
|
18
|
-
const _dtos = require("../dtos");
|
|
19
|
-
const _entities = require("../entities");
|
|
20
|
-
const _eventmanagerdatasourceprovider = require("./event-manager-datasource.provider");
|
|
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 EventParticipantService = class EventParticipantService extends _classes.RequestScopedApiService {
|
|
49
|
-
resolveEntity() {
|
|
50
|
-
// EventParticipant doesn't need company variant - company context is inherited through Event
|
|
51
|
-
return _entities.EventParticipant;
|
|
52
|
-
}
|
|
53
|
-
getDataSourceProvider() {
|
|
54
|
-
return this.dataSourceProvider;
|
|
55
|
-
}
|
|
56
|
-
// Override Methods
|
|
57
|
-
async convertSingleDtoToEntity(dto, _user) {
|
|
58
|
-
let entity = {};
|
|
59
|
-
if ('id' in dto && dto.id && typeof dto.id === 'string') {
|
|
60
|
-
const existing = await this.repository.findOne({
|
|
61
|
-
where: {
|
|
62
|
-
id: dto.id
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (!existing) throw new _common.NotFoundException({
|
|
66
|
-
message: 'Event participant not found',
|
|
67
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.NOT_FOUND
|
|
68
|
-
});
|
|
69
|
-
entity = existing;
|
|
70
|
-
}
|
|
71
|
-
// EventParticipant doesn't have companyId - company context comes from Event
|
|
72
|
-
return {
|
|
73
|
-
...entity,
|
|
74
|
-
eventId: dto.eventId ?? entity.eventId,
|
|
75
|
-
userId: dto.userId ?? entity.userId,
|
|
76
|
-
status: dto.status ?? entity.status ?? _enums.ParticipantStatus.PENDING,
|
|
77
|
-
isOrganizer: dto.isOrganizer ?? entity.isOrganizer ?? false,
|
|
78
|
-
metadata: dto.metadata ?? entity.metadata
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
async getFilterQuery(query, filter, _user) {
|
|
82
|
-
for (const [key, value] of Object.entries(filter)){
|
|
83
|
-
if (key === 'eventId') {
|
|
84
|
-
query.andWhere(`${this.entityName}.eventId = :eventId`, {
|
|
85
|
-
eventId: value
|
|
86
|
-
});
|
|
87
|
-
} else if (key === 'userId') {
|
|
88
|
-
query.andWhere(`${this.entityName}.userId = :userId`, {
|
|
89
|
-
userId: value
|
|
90
|
-
});
|
|
91
|
-
} else if (key === 'status') {
|
|
92
|
-
query.andWhere(`${this.entityName}.status = :status`, {
|
|
93
|
-
status: value
|
|
94
|
-
});
|
|
95
|
-
} else if (key === 'isOrganizer' && typeof value === 'boolean') {
|
|
96
|
-
query.andWhere(`${this.entityName}.isOrganizer = :isOrganizer`, {
|
|
97
|
-
isOrganizer: value
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
query.andWhere(`${this.entityName}.${key} = :value`, {
|
|
101
|
-
value
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
query,
|
|
107
|
-
isRaw: false
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// Public Methods
|
|
111
|
-
// Note: EventParticipant doesn't have companyId - company filtering happens at Event level
|
|
112
|
-
async updateStatus(dto, _user) {
|
|
113
|
-
await this.ensureRepositoryInitialized();
|
|
114
|
-
const participant = await this.repository.findOne({
|
|
115
|
-
where: {
|
|
116
|
-
id: dto.id
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
if (!participant) {
|
|
120
|
-
throw new _common.NotFoundException({
|
|
121
|
-
message: 'Event participant not found',
|
|
122
|
-
messageKey: _config.EVENT_PARTICIPANT_MESSAGES.NOT_FOUND
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
participant.status = dto.status;
|
|
126
|
-
return await this.repository.save(participant);
|
|
127
|
-
}
|
|
128
|
-
async getParticipantsByEvent(eventId, _user) {
|
|
129
|
-
await this.ensureRepositoryInitialized();
|
|
130
|
-
// Company filtering happens at Event level, not participant level
|
|
131
|
-
return await this.repository.createQueryBuilder('event_participant').where('event_participant.eventId = :eventId', {
|
|
132
|
-
eventId
|
|
133
|
-
}).andWhere('event_participant.deletedAt IS NULL').getMany();
|
|
134
|
-
}
|
|
135
|
-
async getParticipantsByUser(userId, _user) {
|
|
136
|
-
await this.ensureRepositoryInitialized();
|
|
137
|
-
// Company filtering happens at Event level, not participant level
|
|
138
|
-
return await this.repository.createQueryBuilder('event_participant').where('event_participant.userId = :userId', {
|
|
139
|
-
userId
|
|
140
|
-
}).andWhere('event_participant.deletedAt IS NULL').getMany();
|
|
141
|
-
}
|
|
142
|
-
async removeParticipant(eventId, userId, _user) {
|
|
143
|
-
await this.ensureRepositoryInitialized();
|
|
144
|
-
const participant = await this.repository.findOne({
|
|
145
|
-
where: {
|
|
146
|
-
eventId,
|
|
147
|
-
userId
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
if (participant) {
|
|
151
|
-
await this.repository.softRemove(participant);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
constructor(cacheManager, utilsService, eventConfig, dataSourceProvider){
|
|
155
|
-
super('event_participant', null, cacheManager, utilsService, EventParticipantService.name, true, 'event-manager'), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "eventConfig", void 0), _define_property(this, "dataSourceProvider", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.eventConfig = eventConfig, this.dataSourceProvider = dataSourceProvider;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
_ts_decorate([
|
|
159
|
-
(0, _decorators.LogAction)({
|
|
160
|
-
action: 'eventParticipant.updateStatus',
|
|
161
|
-
module: 'event-manager'
|
|
162
|
-
}),
|
|
163
|
-
_ts_metadata("design:type", Function),
|
|
164
|
-
_ts_metadata("design:paramtypes", [
|
|
165
|
-
typeof _dtos.UpdateParticipantStatusDto === "undefined" ? Object : _dtos.UpdateParticipantStatusDto,
|
|
166
|
-
Object
|
|
167
|
-
]),
|
|
168
|
-
_ts_metadata("design:returntype", Promise)
|
|
169
|
-
], EventParticipantService.prototype, "updateStatus", null);
|
|
170
|
-
_ts_decorate([
|
|
171
|
-
(0, _decorators.LogAction)({
|
|
172
|
-
action: 'eventParticipant.remove',
|
|
173
|
-
module: 'event-manager'
|
|
174
|
-
}),
|
|
175
|
-
_ts_metadata("design:type", Function),
|
|
176
|
-
_ts_metadata("design:paramtypes", [
|
|
177
|
-
String,
|
|
178
|
-
String,
|
|
179
|
-
Object
|
|
180
|
-
]),
|
|
181
|
-
_ts_metadata("design:returntype", Promise)
|
|
182
|
-
], EventParticipantService.prototype, "removeParticipant", null);
|
|
183
|
-
EventParticipantService = _ts_decorate([
|
|
184
|
-
(0, _common.Injectable)({
|
|
185
|
-
scope: _common.Scope.REQUEST
|
|
186
|
-
}),
|
|
187
|
-
_ts_param(0, (0, _common.Inject)('CACHE_INSTANCE')),
|
|
188
|
-
_ts_param(1, (0, _common.Inject)(_modules.UtilsService)),
|
|
189
|
-
_ts_param(2, (0, _common.Inject)(_eventmanagerconfigservice.EventManagerConfigService)),
|
|
190
|
-
_ts_param(3, (0, _common.Inject)(_eventmanagerdatasourceprovider.EventManagerDataSourceProvider)),
|
|
191
|
-
_ts_metadata("design:type", Function),
|
|
192
|
-
_ts_metadata("design:paramtypes", [
|
|
193
|
-
typeof _classes.HybridCache === "undefined" ? Object : _classes.HybridCache,
|
|
194
|
-
typeof _modules.UtilsService === "undefined" ? Object : _modules.UtilsService,
|
|
195
|
-
typeof _eventmanagerconfigservice.EventManagerConfigService === "undefined" ? Object : _eventmanagerconfigservice.EventManagerConfigService,
|
|
196
|
-
typeof _eventmanagerdatasourceprovider.EventManagerDataSourceProvider === "undefined" ? Object : _eventmanagerdatasourceprovider.EventManagerDataSourceProvider
|
|
197
|
-
])
|
|
198
|
-
], EventParticipantService);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ListResponseDto, MessageResponseDto, SingleResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
2
|
-
import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
|
|
3
|
-
import { CreateEventParticipantDto, EventParticipantResponseDto, UpdateParticipantStatusDto, UpdateEventParticipantDto } from '../dtos';
|
|
4
|
-
import { EventParticipantService } from '../services/event-participant.service';
|
|
5
|
-
declare const EventParticipantController_base: abstract new (service: EventParticipantService) => {
|
|
6
|
-
readonly enabledEndpoints: import("@flusys/nestjs-shared/classes").ApiEndpoint[] | "all";
|
|
7
|
-
service: EventParticipantService;
|
|
8
|
-
isEnabled(endpoint: import("@flusys/nestjs-shared/classes").ApiEndpoint): boolean;
|
|
9
|
-
insert(addDto: CreateEventParticipantDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
10
|
-
insertMany(addDto: CreateEventParticipantDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<EventParticipantResponseDto>>;
|
|
11
|
-
getById(id: string, body: import("@flusys/nestjs-shared/dtos").GetByIdBodyDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
12
|
-
getByIds(body: import("@flusys/nestjs-shared/dtos").GetByIdsDto, user: ILoggedUserInfo | null): Promise<ListResponseDto<EventParticipantResponseDto>>;
|
|
13
|
-
update(updateDto: UpdateEventParticipantDto, user: ILoggedUserInfo | null): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
14
|
-
updateMany(updateDtos: UpdateEventParticipantDto[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<EventParticipantResponseDto>>;
|
|
15
|
-
bulkUpsert(dtos: (CreateEventParticipantDto | UpdateEventParticipantDto)[], user: ILoggedUserInfo | null): Promise<import("@flusys/nestjs-shared/dtos").BulkResponseDto<EventParticipantResponseDto>>;
|
|
16
|
-
getByFilter(filter: Record<string, any>, user: ILoggedUserInfo | null): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
17
|
-
getAll(filterAndPaginationDto: import("@flusys/nestjs-shared/dtos").FilterAndPaginationDto, user: ILoggedUserInfo | null, search?: string): Promise<ListResponseDto<EventParticipantResponseDto>>;
|
|
18
|
-
delete(deleteDto: import("@flusys/nestjs-shared/dtos").DeleteDto, user: ILoggedUserInfo | null): Promise<MessageResponseDto>;
|
|
19
|
-
};
|
|
20
|
-
export declare class EventParticipantController extends EventParticipantController_base {
|
|
21
|
-
protected participantService: EventParticipantService;
|
|
22
|
-
constructor(participantService: EventParticipantService);
|
|
23
|
-
updateStatus(dto: UpdateParticipantStatusDto, user: ILoggedUserInfo): Promise<SingleResponseDto<EventParticipantResponseDto>>;
|
|
24
|
-
getByEvent(body: {
|
|
25
|
-
eventId: string;
|
|
26
|
-
}, user: ILoggedUserInfo): Promise<ListResponseDto<EventParticipantResponseDto>>;
|
|
27
|
-
getByUser(body: {
|
|
28
|
-
userId: string;
|
|
29
|
-
}, user: ILoggedUserInfo): Promise<ListResponseDto<EventParticipantResponseDto>>;
|
|
30
|
-
removeParticipant(body: {
|
|
31
|
-
eventId: string;
|
|
32
|
-
userId: string;
|
|
33
|
-
}, user: ILoggedUserInfo): Promise<MessageResponseDto>;
|
|
34
|
-
}
|
|
35
|
-
export {};
|