@universis/accommodation 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/models/AccommodationRoom.json +0 -5
- package/dist/config/models/RoomType.json +246 -240
- package/dist/config/models/StudentAccommodationCard.json +1 -4
- package/dist/config/scope.access.js +9 -0
- package/dist/config/scope.access.js.map +1 -1
- package/dist/listeners/StudentAccommodationCardSaveListener.js +13 -2
- package/dist/listeners/StudentAccommodationCardSaveListener.js.map +1 -1
- package/dist/models/StudentAccommodationCard.js +170 -47
- package/dist/models/StudentAccommodationCard.js.map +1 -1
- package/package.json +1 -1
- package/src/config/models/AccommodationRoom.json +0 -5
- package/src/config/models/RoomType.json +246 -240
- package/src/config/models/StudentAccommodationCard.json +1 -4
- package/src/config/scope.access.js +9 -0
- package/src/listeners/StudentAccommodationCardSaveListener.js +14 -3
- package/src/models/StudentAccommodationCard.js +157 -34
- package/dist/listeners/OnUpdateAccommodationRoomListener.js +0 -151
- package/dist/listeners/OnUpdateAccommodationRoomListener.js.map +0 -1
- package/src/listeners/OnUpdateAccommodationRoomListener.js +0 -150
|
@@ -22,14 +22,25 @@ var _common = require("@themost/common"); /**
|
|
|
22
22
|
throw new _common.DataError('ERR_STATUS', 'Student cannot be found');
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
// const isActive = await student.silent().isActive();
|
|
26
25
|
const isActive = await student.is(':active');
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
if (!isActive && event.state === 1)
|
|
28
|
+
{
|
|
28
29
|
throw new _common.DataError('ERR_STATUS',
|
|
29
30
|
'Invalid student status. Student Accommodation Card may be published upon an active student only.' + student,
|
|
30
31
|
null,
|
|
31
32
|
'Student', 'studentStatus');
|
|
32
33
|
}
|
|
34
|
+
if (Object.prototype.hasOwnProperty.call(event.target, 'CardStatus')) {
|
|
35
|
+
const previousActionStatus = await context.model('ActionStatusType').find(previous.cardStatus).select('alternateName').value();
|
|
36
|
+
const targetActionStatus = await context.model('ActionStatusType').find(event.target.cardStatus).select('alternateName').value();
|
|
37
|
+
if (!isActive && previousActionStatus !== targetActionStatus && targetActionStatus !== 'CancelledActionStatus') {
|
|
38
|
+
throw new _common.DataError('ERR_STATUS',
|
|
39
|
+
'The student accommodation card cannot be activated for an inactive student' + student,
|
|
40
|
+
null,
|
|
41
|
+
'Student', 'studentStatus');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
33
44
|
|
|
34
45
|
const academicYear = context.model('AcademicYear').convert(event.target.academicYear).getId();
|
|
35
46
|
if (Number.isInteger(academicYear) === false) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StudentAccommodationCardSaveListener.js","names":["_common","require","beforeSave","event","callback","state","context","model","previous","student","convert","target","DataError","isActive","is","academicYear","getId","Number","isInteger","academicYearObject","where","equal","getItem","undefined","academicPeriod","academicPeriodObject","then","catch","err","afterSave","accommodationRoom","
|
|
1
|
+
{"version":3,"file":"StudentAccommodationCardSaveListener.js","names":["_common","require","beforeSave","event","callback","state","context","model","previous","student","convert","target","DataError","isActive","is","Object","prototype","hasOwnProperty","call","previousActionStatus","find","cardStatus","select","value","targetActionStatus","academicYear","getId","Number","isInteger","academicYearObject","where","equal","getItem","undefined","academicPeriod","academicPeriodObject","then","catch","err","afterSave","accommodationRoom","keys","length","room","id","newRoom","currentOccupancy","silent","save"],"sources":["../../src/listeners/StudentAccommodationCardSaveListener.js"],"sourcesContent":["/**\n * @param {DataEventArgs} event\n * @param {Function} callback\n */\nimport {DataError} from \"@themost/common\";\n\nexport function beforeSave(event, callback) {\n (async () => {\n\n // validate student state (on insert or update)\n if (event.state === 1 || event.state === 2) {\n let context = event.model.context;\n /**\n * @type {Student|DataObject|*}\n */\n const previous = event.previous;\n let student = context.model('Student').convert(event.target.student);\n if (!student){\n if (previous){\n student = context.model('Student').convert(previous.student);\n }else{\n throw new DataError('ERR_STATUS','Student cannot be found');\n }\n }\n const isActive = await student.is(':active');\n \n if (!isActive && event.state===1)\n {\n throw new DataError('ERR_STATUS',\n 'Invalid student status. Student Accommodation Card may be published upon an active student only.'+student\n , null,\n 'Student', 'studentStatus');\n }\n if (Object.prototype.hasOwnProperty.call(event.target, 'CardStatus')) {\n const previousActionStatus = await context.model('ActionStatusType').find(previous.cardStatus).select('alternateName').value();\n const targetActionStatus = await context.model('ActionStatusType').find(event.target.cardStatus).select('alternateName').value();\n if (!isActive && previousActionStatus !== targetActionStatus && targetActionStatus!=='CancelledActionStatus') {\n throw new DataError('ERR_STATUS',\n 'The student accommodation card cannot be activated for an inactive student' + student\n , null,\n 'Student', 'studentStatus');\n }\n }\n \n const academicYear = context.model('AcademicYear').convert(event.target.academicYear).getId();\n if (Number.isInteger(academicYear) === false) {\n throw new DataError('E_VALUE', 'Invalid academic year. Expected number.', null, 'AcademicYear', 'id');\n }\n\n const academicYearObject = await context.model('AcademicYear').where('id').equal(academicYear).getItem();\n if (academicYearObject === undefined){\n throw new DataError('E_VALUE', 'Invalid academic year.', null, 'AcademicYear', 'id');\n }\n\n if (event.target.academicPeriod != null){\n\n const academicPeriod = context.model('AcademicPeriod').convert(event.target.academicPeriod).getId();\n if (Number.isInteger(academicPeriod) === false) {\n throw new DataError('E_VALUE', 'Invalid academic period. Expected number.', null, 'AcademicPeriod', 'id');\n }\n \n const academicPeriodObject = await context.model('AcademicPeriod').where('id').equal(academicPeriod).getItem();\n if (academicPeriodObject === undefined){\n throw new DataError('E_VALUE', 'Invalid academic period.', null, 'AcademicPeriod', 'id');\n }\n \n }\n }\n })().then( () => {\n return callback();\n }).catch( err => {\n return callback(err);\n });\n}\n\n\n/**\n * @param {DataEventArgs} event\n * @param {Function} callback\n */\nexport function afterSave(event, callback) {\n (async () => {\n //\n let context = event.model.context;\n if (event.state === 1) {\n if (event.target.accommodationRoom && Object.keys(event.target.accommodationRoom).length != 0) {\n // get accommodation valid through date\n\n const room = await context.model('AccommodationRoom').where('id').equal(event.target.accommodationRoom.id).getItem();\n if (room === undefined) {\n throw new DataError('E_VALUE', 'Invalid accommodation room.', null, 'AccommodationRoom', 'id');\n }\n let newRoom = room;\n newRoom.currentOccupancy = room.currentOccupancy+1;\n //todo if i can increase occupancy\n await context.model('AccommodationRoom').silent().save(newRoom);\n }\n }\n\n\n })().then(() => {\n return callback();\n }).catch(err => {\n return callback(err);\n });\n}\n"],"mappings":";;;;AAIA,IAAAA,OAAA,GAAAC,OAAA,oBAA0C,CAJ1C;AACA;AACA;AACA,GAGO,SAASC,UAAUA,CAACC,KAAK,EAAEC,QAAQ,EAAE,CACxC,CAAC,YAAY;;IAET;IACA,IAAID,KAAK,CAACE,KAAK,KAAK,CAAC,IAAIF,KAAK,CAACE,KAAK,KAAK,CAAC,EAAE;MACxC,IAAIC,OAAO,GAAGH,KAAK,CAACI,KAAK,CAACD,OAAO;MACjC;AACZ;AACA;MACY,MAAME,QAAQ,GAAGL,KAAK,CAACK,QAAQ;MAC/B,IAAIC,OAAO,GAAGH,OAAO,CAACC,KAAK,CAAC,SAAS,CAAC,CAACG,OAAO,CAACP,KAAK,CAACQ,MAAM,CAACF,OAAO,CAAC;MACpE,IAAI,CAACA,OAAO,EAAC;QACT,IAAID,QAAQ,EAAC;UACTC,OAAO,GAAGH,OAAO,CAACC,KAAK,CAAC,SAAS,CAAC,CAACG,OAAO,CAACF,QAAQ,CAACC,OAAO,CAAC;QAChE,CAAC,MAAI;UACD,MAAM,IAAIG,iBAAS,CAAC,YAAY,EAAC,yBAAyB,CAAC;QAC/D;MACJ;MACA,MAAMC,QAAQ,GAAG,MAAMJ,OAAO,CAACK,EAAE,CAAC,SAAS,CAAC;;MAE5C,IAAI,CAACD,QAAQ,IAAIV,KAAK,CAACE,KAAK,KAAG,CAAC;MAChC;QACI,MAAM,IAAIO,iBAAS,CAAC,YAAY;QAC5B,kGAAkG,GAACH,OAAO;QACxG,IAAI;QACN,SAAS,EAAE,eAAe,CAAC;MACnC;MACA,IAAIM,MAAM,CAACC,SAAS,CAACC,cAAc,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AI,CAAC,EAAE;QAC3F;;QAEA,MAAMC,IAAI,GAAG,MAAMrC,OAAO,CAACC,KAAK,CAAC,mBAAmB,CAAC,CAACuB,KAAK,CAAC,IAAI,CAAC,CAACC,KAAK,CAAC5B,KAAK,CAACQ,MAAM,CAAC6B,iBAAiB,CAACI,EAAE,CAAC,CAACZ,OAAO,EAAE;QACpH,IAAIW,IAAI,KAAKV,SAAS,EAAE;UACpB,MAAM,IAAIrB,iBAAS,CAAC,SAAS,EAAE,6BAA6B,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC;QAClG;QACA,IAAIiC,OAAO,GAAGF,IAAI;QAClBE,OAAO,CAACC,gBAAgB,GAAGH,IAAI,CAACG,gBAAgB,GAAC,CAAC;QAClD;QACA,MAAMxC,OAAO,CAACC,KAAK,CAAC,mBAAmB,CAAC,CAACwC,MAAM,EAAE,CAACC,IAAI,CAACH,OAAO,CAAC;MACnE;IACJ;;;EAGJ,CAAC,GAAG,CAACT,IAAI,CAAC,MAAM;IACZ,OAAOhC,QAAQ,EAAE;EACrB,CAAC,CAAC,CAACiC,KAAK,CAAC,CAAAC,GAAG,KAAI;IACZ,OAAOlC,QAAQ,CAACkC,GAAG,CAAC;EACxB,CAAC,CAAC;AACN"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _data = require("@themost/data");
|
|
3
|
-
var _common = require("@themost/common");
|
|
3
|
+
var _common = require("@themost/common");
|
|
4
|
+
var _EnableAttachmentModel = _interopRequireDefault(require("./EnableAttachmentModel"));var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _class, _class2;function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {var desc = {};Object.keys(descriptor).forEach(function (key) {desc[key] = descriptor[key];});desc.enumerable = !!desc.enumerable;desc.configurable = !!desc.configurable;if ('value' in desc || desc.initializer) {desc.writable = true;}desc = decorators.slice().reverse().reduce(function (desc, decorator) {return decorator(target, property, desc) || desc;}, desc);if (context && desc.initializer !== void 0) {desc.value = desc.initializer ? desc.initializer.call(context) : void 0;desc.initializer = undefined;}if (desc.initializer === void 0) {Object.defineProperty(target, property, desc);desc = null;}return desc;}
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @class
|
|
@@ -31,63 +32,185 @@ StudentAccommodationCard = (_dec = _data.EdmMapping.entityType('StudentAccommoda
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
_data.EdmMapping.param('data', 'Object', false, true), _dec3 =
|
|
34
|
-
_data.EdmMapping.action('cancel', 'StudentAccommodationCard'),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
_data.EdmMapping.action('cancel', 'StudentAccommodationCard'), _dec4 =
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
_data.EdmMapping.param('data', 'Object', false, true), _dec5 =
|
|
73
|
+
_data.EdmMapping.action('changeRoom', 'StudentAccommodationCard'), _dec6 =
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
50
97
|
|
|
51
|
-
// validate existance and permission
|
|
52
|
-
if (StudentAccommodationCard == null) {
|
|
53
|
-
throw new _common.DataNotFoundError('The specified Student Accommodation Card cannot be found or is inaccessible');
|
|
54
|
-
}
|
|
55
|
-
// StudentAccommodationCard already cancelled throw error
|
|
56
|
-
if (StudentAccommodationCard.active === false) {
|
|
57
|
-
throw new _common.DataError('E_ACTIVE', 'The specified Student Accommodation Card is already cancelled');
|
|
58
|
-
}
|
|
59
98
|
|
|
60
|
-
//validate AccommodationRequestAction
|
|
61
|
-
if (StudentAccommodationCard.action == null) {
|
|
62
|
-
throw new _common.DataError('E_ACTION', 'The Student Accommodation Card is not linked to a Accommodation Request Action');
|
|
63
|
-
}
|
|
64
99
|
|
|
65
|
-
// cancel StudentAccommodationCard
|
|
66
|
-
StudentAccommodationCard.cardStatus = { alternateName: "CancelledActionStatus" };
|
|
67
|
-
StudentAccommodationCard.cancelReason = data.cancelReason;
|
|
68
|
-
await this.context.model('StudentAccommodationCard').save(StudentAccommodationCard);
|
|
69
100
|
|
|
70
|
-
const action = await this.context.model('AccommodationRequestAction').where('id').equal(StudentAccommodationCard.action).select('id', 'actionStatus/alternateName as requestStatus').getItem();
|
|
71
|
-
//validate AccommodationRequestAction
|
|
72
|
-
if (action == null) {
|
|
73
|
-
throw new _common.DataError('E_ACTION', 'The specified AccommodationRequestAction cannot be found or is inaccessible');
|
|
74
|
-
}
|
|
75
101
|
|
|
76
|
-
if (action.requestStatus !== 'CompletedActionStatus') {
|
|
77
|
-
throw new _common.DataError('E_ACTION', 'The specified AccommodationRequestAction is not in Completed state');
|
|
78
|
-
}
|
|
79
102
|
|
|
80
|
-
action.actionStatus = {
|
|
81
|
-
alternateName: "ActiveActionStatus"
|
|
82
|
-
};
|
|
83
103
|
|
|
84
|
-
|
|
85
|
-
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
_data.EdmMapping.param('data', 'Object', false, true), _dec7 =
|
|
134
|
+
_data.EdmMapping.action('addToRoom', 'StudentAccommodationCard'), _dec8 =
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
_data.EdmMapping.param('data', 'Object', false, true), _dec9 =
|
|
164
|
+
_data.EdmMapping.action('revertToPending', 'StudentAccommodationCard'), _dec(_class = (_class2 = class StudentAccommodationCard extends _EnableAttachmentModel.default {/**
|
|
165
|
+
* @constructor
|
|
166
|
+
*/constructor() {super();} /**
|
|
167
|
+
* POST StudentAccommodationCards/:id/Cancel
|
|
168
|
+
*/async cancel(data) {_common.Args.notEmpty(data.cancelReason, 'Cancel Reason');if (!_common.LangUtils.isDate(data.dateCancelled)) {throw new _common.DataError('E_STATE', 'Cancel date can not be empty or invalid date');}await this.context.executeInTransactionAsync(async () => {var _currentStudentAccomm, _currentStudentAccomm2; // find StudentAccommodationCard from id
|
|
169
|
+
const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard').where('id').equal(this.getId()).select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom').expand('cardStatus').getItem();_common.Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card'); // StudentAccommodationCard already cancelled throw error
|
|
170
|
+
if ((currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : (_currentStudentAccomm = currentStudentAccommodationCard.cardStatus) === null || _currentStudentAccomm === void 0 ? void 0 : _currentStudentAccomm.alternateName) === 'CompletedActionStatus') {throw new _common.DataError('E_ACTIVE', 'The specified Student Accommodation Card in not active');} // cancel StudentAccommodationCard
|
|
171
|
+
currentStudentAccommodationCard.cardStatus = { alternateName: 'CompletedActionStatus' };currentStudentAccommodationCard.cancelReason = data.cancelReason;currentStudentAccommodationCard.dateCancelled = data.dateCancelled;await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);const room = ((_currentStudentAccomm2 = currentStudentAccommodationCard.accommodationRoom) === null || _currentStudentAccomm2 === void 0 ? void 0 : _currentStudentAccomm2.id) || (currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : currentStudentAccommodationCard.accommodationRoom);_common.Args.notNull(room, 'Accommodation room can not be empty');_common.Args.notNumber(room, 'Accommodation room should be a number');await calculateOccupancy(this.context, room);}, (err) => {_common.TraceUtils.log(err);});}async changeRoom(data) {var _data$accommodationRo;const room = ((_data$accommodationRo = data.accommodationRoom) === null || _data$accommodationRo === void 0 ? void 0 : _data$accommodationRo.id) || (data === null || data === void 0 ? void 0 : data.accommodationRoom);_common.Args.notNull(room, 'Accommodation room can not be empty');_common.Args.notNumber(room, 'Accommodation room should be a number');if (!_common.LangUtils.isDate(data.validThrough)) {throw new _common.DataError('E_STATE', 'Valid through date can not be empty or it is not a valid date');}_common.Args.notEmpty(data.cancelReason, 'Cancel Reason cannot be empty');if (!_common.LangUtils.isDate(data.dateCancelled)) {throw new _common.DataError('E_STATE', 'Cancel date can not be empty or invalid date');}await this.context.executeInTransactionAsync(async () => {var _currentStudentAccomm3, _currentStudentAccomm4;const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard').where('id').equal(this.getId()).select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom').expand('cardStatus').getItem();_common.Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');if ((currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : (_currentStudentAccomm3 = currentStudentAccommodationCard.cardStatus) === null || _currentStudentAccomm3 === void 0 ? void 0 : _currentStudentAccomm3.alternateName) !== 'ActiveActionStatus') {throw new _common.DataError('E_STATE', 'The accommodation room cannot be changed for inactive accommodation card');}const newCard = { action: currentStudentAccommodationCard.action, student: currentStudentAccommodationCard.student, accommodationRoom: room, academicYear: currentStudentAccommodationCard.academicYear, validFrom: data.validThrough, validThrough: currentStudentAccommodationCard.validThrough, cardStatus: { alternateName: 'ActiveActionStatus' } };currentStudentAccommodationCard.cancelReason = data.cancelReason;currentStudentAccommodationCard.dateCancelled = data.dateCancelled;currentStudentAccommodationCard.validThrough = data.dateCancelled;delete currentStudentAccommodationCard.cardStatus;currentStudentAccommodationCard.cardStatus = { alternateName: 'CompletedActionStatus' };await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);const currentAccommodationRoom = ((_currentStudentAccomm4 = currentStudentAccommodationCard.accommodationRoom) === null || _currentStudentAccomm4 === void 0 ? void 0 : _currentStudentAccomm4.id) || (currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : currentStudentAccommodationCard.accommodationRoom);_common.Args.notNull(currentAccommodationRoom, 'The specified Student Accommodation Card does not contain any room');await calculateOccupancy(this.context, currentAccommodationRoom);await this.context.model('StudentAccommodationCards').save(newCard);await calculateOccupancy(this.context, room);}, (err) => {_common.TraceUtils.log(err);});}async addToRoom(data) {var _data$accommodationRo2;const room = ((_data$accommodationRo2 = data.accommodationRoom) === null || _data$accommodationRo2 === void 0 ? void 0 : _data$accommodationRo2.id) || (data === null || data === void 0 ? void 0 : data.accommodationRoom);_common.Args.notNull(room, 'Accommodation room can not be empty');_common.Args.notNumber(room, 'Accommodation room should be a number');if (!_common.LangUtils.isDate(data.validFrom)) {throw new _common.DataError('E_STATE', 'Valid through date can not be empty or it is not a valid date');}await this.context.executeInTransactionAsync(async () => {var _currentStudentAccomm5;const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard').where('id').equal(this.getId()).select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough').expand('cardStatus').getItem();_common.Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');if ((currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : (_currentStudentAccomm5 = currentStudentAccommodationCard.cardStatus) === null || _currentStudentAccomm5 === void 0 ? void 0 : _currentStudentAccomm5.alternateName) !== 'ActiveActionStatus') {throw new _common.DataError('E_STATE', 'Add to room action can only be applied when student accommodation card status is Active');}currentStudentAccommodationCard.accommodationRoom = room;currentStudentAccommodationCard.validFrom = data.validFrom;await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);await calculateOccupancy(this.context, room); // calculate occupancy after new room updated
|
|
172
|
+
}, (err) => {_common.TraceUtils.log(err);});}async revertToPending(data) {await this.context.executeInTransactionAsync(async () => {var _currentStudentAccomm6, _currentStudentAccomm7;const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard').where('id').equal(this.getId()).select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom').expand('cardStatus').
|
|
173
|
+
getItem();
|
|
174
|
+
|
|
175
|
+
_common.Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');
|
|
176
|
+
if ((currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : (_currentStudentAccomm6 = currentStudentAccommodationCard.cardStatus) === null || _currentStudentAccomm6 === void 0 ? void 0 : _currentStudentAccomm6.alternateName) !== 'ActiveActionStatus') {
|
|
177
|
+
throw new _common.DataError('E_STATE', 'Inactive accommodation card');
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const accommodationRoom = ((_currentStudentAccomm7 = currentStudentAccommodationCard.accommodationRoom) === null || _currentStudentAccomm7 === void 0 ? void 0 : _currentStudentAccomm7.id) || (currentStudentAccommodationCard === null || currentStudentAccommodationCard === void 0 ? void 0 : currentStudentAccommodationCard.accommodationRoom);
|
|
181
|
+
currentStudentAccommodationCard.cardStatus = { alternateName: 'ActiveActionStatus' };
|
|
182
|
+
currentStudentAccommodationCard.accommodationRoom = null;
|
|
183
|
+
await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);
|
|
184
|
+
await calculateOccupancy(this.context, accommodationRoom);
|
|
86
185
|
});
|
|
87
186
|
}
|
|
88
187
|
|
|
89
188
|
|
|
90
|
-
}, (_applyDecoratedDescriptor(_class2.prototype, "cancel", [_dec2, _dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "cancel"), _class2.prototype)), _class2)) || _class);
|
|
189
|
+
}, (_applyDecoratedDescriptor(_class2.prototype, "cancel", [_dec2, _dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "cancel"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "changeRoom", [_dec4, _dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "changeRoom"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addToRoom", [_dec6, _dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addToRoom"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "revertToPending", [_dec8, _dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "revertToPending"), _class2.prototype)), _class2)) || _class);
|
|
190
|
+
async function calculateOccupancy(context, accommodationRoom) {
|
|
191
|
+
if (accommodationRoom == null) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const currentOccupancy = await context.model('StudentAccommodationCard').
|
|
195
|
+
where('accommodationRoom').equal(accommodationRoom).
|
|
196
|
+
and('cardStatus/alternateName').equal('ActiveActionStatus').
|
|
197
|
+
and('accommodationRoom/outOfService').equal(0).
|
|
198
|
+
and('accommodationRoom/roomType/accessibleType').equal(1).
|
|
199
|
+
select('count(id) as total', 'accommodationRoom/occupancy as maxOccupancy').
|
|
200
|
+
groupBy('accommodationRoom/occupancy').
|
|
201
|
+
silent().
|
|
202
|
+
getItem();
|
|
203
|
+
|
|
204
|
+
const totalOccupancy = currentOccupancy && currentOccupancy.total || 0;
|
|
205
|
+
if (totalOccupancy && totalOccupancy > currentOccupancy.maxOccupancy) {
|
|
206
|
+
throw new _common.DataError('E_STATE', 'No room space for new resident');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
await context.model('AccommodationRoom').save({
|
|
210
|
+
id: accommodationRoom,
|
|
211
|
+
currentOccupancy: totalOccupancy
|
|
212
|
+
});
|
|
213
|
+
}
|
|
91
214
|
|
|
92
215
|
module.exports = StudentAccommodationCard;
|
|
93
216
|
//# sourceMappingURL=StudentAccommodationCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StudentAccommodationCard.js","names":["_data","require","_common","_dec","_dec2","_dec3","_class","_class2","_applyDecoratedDescriptor","target","property","decorators","descriptor","context","desc","Object","keys","forEach","key","enumerable","configurable","initializer","writable","slice","reverse","reduce","decorator","value","call","undefined","defineProperty","StudentAccommodationCard","EdmMapping","entityType","param","action","DataObject","constructor","cancel","data","cancelReason","DataError","executeInTransactionAsync","model","where","equal","getId","select","flatten","getItem","DataNotFoundError","active","cardStatus","alternateName","save","requestStatus","actionStatus","prototype","getOwnPropertyDescriptor","module","exports"],"sources":["../../src/models/StudentAccommodationCard.js"],"sourcesContent":["\nimport { DataObject, EdmMapping } from '@themost/data';\nimport { DataError, DataNotFoundError } from \"@themost/common\"\n\n/**\n * @class\n \n * @property {number} id \n * @property {number} serialNumber \n * @property {boolean} active \n * @property {string} cancelReason \n * @property {string} notes \n * @property {AccommodationRequestAction|any} action \n * @property {AcademicYear|any} academicYear\n * @property {AcademicPeriod|any} academicPeriod\n * @property {Date} dateCreated \n * @property {Date} dateModified \n * @property {Date} validFrom \n * @property {Date} validThrough \n * @property {User|any} student \n */\n@EdmMapping.entityType('StudentAccommodationCard')\nclass StudentAccommodationCard extends DataObject {\n /**\n * @constructor\n */\n constructor() {\n super();\n }\n /**\n * POST StudentAccommodationCards/:id/Cancel\n */\n @EdmMapping.param('data', 'Object', false, true)\n @EdmMapping.action('cancel', 'StudentAccommodationCard')\n\n async cancel(data) {\n\n if (!data.cancelReason) {\n throw new DataError('E_CANCEL_REASON', 'Cancel Reason should be provided');\n }\n\n await this.context.executeInTransactionAsync(async () => {\n // find StudentAccommodationCard from id\n const StudentAccommodationCard = await this.context.model('StudentAccommodationCard')\n .where('id')\n .equal(this.getId())\n .select('id', 'active', 'action', 'student', 'academicPeriod', 'academicYear')\n .flatten()\n .getItem();\n\n // validate existance and permission\n if (StudentAccommodationCard == null) {\n throw new DataNotFoundError('The specified Student Accommodation Card cannot be found or is inaccessible');\n }\n // StudentAccommodationCard already cancelled throw error\n if (StudentAccommodationCard.active === false) {\n throw new DataError('E_ACTIVE', 'The specified Student Accommodation Card is already cancelled')\n }\n\n //validate AccommodationRequestAction\n if (StudentAccommodationCard.action == null) {\n throw new DataError('E_ACTION', 'The Student Accommodation Card is not linked to a Accommodation Request Action')\n }\n\n // cancel StudentAccommodationCard\n StudentAccommodationCard.cardStatus = {alternateName: \"CancelledActionStatus\"};\n StudentAccommodationCard.cancelReason = data.cancelReason;\n await this.context.model('StudentAccommodationCard').save(StudentAccommodationCard);\n\n const action = await this.context.model('AccommodationRequestAction').where('id').equal(StudentAccommodationCard.action).select('id', 'actionStatus/alternateName as requestStatus').getItem();\n //validate AccommodationRequestAction\n if (action == null) {\n throw new DataError('E_ACTION', 'The specified AccommodationRequestAction cannot be found or is inaccessible')\n }\n\n if (action.requestStatus !== 'CompletedActionStatus') {\n throw new DataError('E_ACTION', 'The specified AccommodationRequestAction is not in Completed state')\n }\n\n action.actionStatus = {\n alternateName: \"ActiveActionStatus\"\n }\n\n delete action.requestStatus;\n await this.context.model('AccommodationRequestAction').save(action);\n });\n }\n\n\n}\n\nmodule.exports = StudentAccommodationCard;"],"mappings":";AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA,oBAA8D,IAAAE,IAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,OAAA,UAAAC,0BAAAC,MAAA,EAAAC,QAAA,EAAAC,UAAA,EAAAC,UAAA,EAAAC,OAAA,OAAAC,IAAA,MAAAC,MAAA,CAAAC,IAAA,CAAAJ,UAAA,EAAAK,OAAA,WAAAC,GAAA,GAAAJ,IAAA,CAAAI,GAAA,IAAAN,UAAA,CAAAM,GAAA,KAAAJ,IAAA,CAAAK,UAAA,KAAAL,IAAA,CAAAK,UAAA,CAAAL,IAAA,CAAAM,YAAA,KAAAN,IAAA,CAAAM,YAAA,gBAAAN,IAAA,IAAAA,IAAA,CAAAO,WAAA,GAAAP,IAAA,CAAAQ,QAAA,SAAAR,IAAA,GAAAH,UAAA,CAAAY,KAAA,GAAAC,OAAA,GAAAC,MAAA,WAAAX,IAAA,EAAAY,SAAA,UAAAA,SAAA,CAAAjB,MAAA,EAAAC,QAAA,EAAAI,IAAA,KAAAA,IAAA,IAAAA,IAAA,MAAAD,OAAA,IAAAC,IAAA,CAAAO,WAAA,cAAAP,IAAA,CAAAa,KAAA,GAAAb,IAAA,CAAAO,WAAA,GAAAP,IAAA,CAAAO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,CAAC;IACvE,CAAC,CAAC;EACN;;;AAGJ,CAAC,GAAA3B,yBAAA,CAAAD,OAAA,CAAAkD,SAAA,aAAArD,KAAA,EAAAC,KAAA,GAAAU,MAAA,CAAA2C,wBAAA,CAAAnD,OAAA,CAAAkD,SAAA,aAAAlD,OAAA,CAAAkD,SAAA,IAAAlD,OAAA,MAAAD,MAAA;;AAEDqD,MAAM,CAACC,OAAO,GAAG7B,wBAAwB"}
|
|
1
|
+
{"version":3,"file":"StudentAccommodationCard.js","names":["_data","require","_common","_EnableAttachmentModel","_interopRequireDefault","_dec","_dec2","_dec3","_dec4","_dec5","_dec6","_dec7","_dec8","_dec9","_class","_class2","obj","__esModule","default","_applyDecoratedDescriptor","target","property","decorators","descriptor","context","desc","Object","keys","forEach","key","enumerable","configurable","initializer","writable","slice","reverse","reduce","decorator","value","call","undefined","defineProperty","StudentAccommodationCard","EdmMapping","entityType","param","action","EnableAttachmentModel","constructor","cancel","data","Args","notEmpty","cancelReason","LangUtils","isDate","dateCancelled","DataError","executeInTransactionAsync","_currentStudentAccomm","_currentStudentAccomm2","currentStudentAccommodationCard","model","where","equal","getId","select","expand","getItem","notNull","cardStatus","alternateName","save","room","accommodationRoom","id","notNumber","calculateOccupancy","err","TraceUtils","log","changeRoom","_data$accommodationRo","validThrough","_currentStudentAccomm3","_currentStudentAccomm4","newCard","student","academicYear","validFrom","currentAccommodationRoom","addToRoom","_data$accommodationRo2","_currentStudentAccomm5","revertToPending","_currentStudentAccomm6","_currentStudentAccomm7","prototype","getOwnPropertyDescriptor","currentOccupancy","and","groupBy","silent","totalOccupancy","total","maxOccupancy","module","exports"],"sources":["../../src/models/StudentAccommodationCard.js"],"sourcesContent":["\nimport { EdmMapping } from '@themost/data';\nimport { DataError, DataNotFoundError, Args, TraceUtils, LangUtils } from \"@themost/common\"\nimport EnableAttachmentModel from './EnableAttachmentModel';\n\n/**\n * @class\n \n * @property {number} id \n * @property {number} serialNumber \n * @property {boolean} active \n * @property {string} cancelReason \n * @property {string} notes \n * @property {AccommodationRequestAction|any} action \n * @property {AcademicYear|any} academicYear\n * @property {AcademicPeriod|any} academicPeriod\n * @property {Date} dateCreated \n * @property {Date} dateModified \n * @property {Date} validFrom \n * @property {Date} validThrough \n * @property {User|any} student \n */\n@EdmMapping.entityType('StudentAccommodationCard')\nclass StudentAccommodationCard extends EnableAttachmentModel {\n /**\n * @constructor\n */\n constructor() {\n super();\n }\n /**\n * POST StudentAccommodationCards/:id/Cancel\n */\n @EdmMapping.param('data', 'Object', false, true)\n @EdmMapping.action('cancel', 'StudentAccommodationCard')\n\n async cancel(data) {\n\n Args.notEmpty(data.cancelReason, 'Cancel Reason');\n\n if ( !LangUtils.isDate(data.dateCancelled) ) {\n throw new DataError('E_STATE', 'Cancel date can not be empty or invalid date');\n }\n await this.context.executeInTransactionAsync(async () => {\n // find StudentAccommodationCard from id\n const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard')\n .where('id')\n .equal(this.getId())\n .select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom')\n .expand('cardStatus')\n .getItem();\n\n Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card' )\n // StudentAccommodationCard already cancelled throw error\n if ( currentStudentAccommodationCard?.cardStatus?.alternateName === 'CompletedActionStatus') {\n throw new DataError('E_ACTIVE', 'The specified Student Accommodation Card in not active')\n }\n // cancel StudentAccommodationCard\n currentStudentAccommodationCard.cardStatus = { alternateName: 'CompletedActionStatus' };\n currentStudentAccommodationCard.cancelReason = data.cancelReason;\n currentStudentAccommodationCard.dateCancelled = data.dateCancelled;\n await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);\n const room = currentStudentAccommodationCard.accommodationRoom?.id || currentStudentAccommodationCard?.accommodationRoom;\n Args.notNull(room, 'Accommodation room can not be empty');\n Args.notNumber(room, 'Accommodation room should be a number');\n await calculateOccupancy(this.context, room);\n },(err)=>{\n TraceUtils.log(err);\n });\n }\n\n @EdmMapping.param('data', 'Object', false, true)\n @EdmMapping.action('changeRoom', 'StudentAccommodationCard')\n\n async changeRoom(data) {\n\n const room = data.accommodationRoom?.id || data?.accommodationRoom;\n Args.notNull(room, 'Accommodation room can not be empty');\n Args.notNumber(room, 'Accommodation room should be a number');\n\n if ( !LangUtils.isDate(data.validThrough) ) {\n throw new DataError('E_STATE', 'Valid through date can not be empty or it is not a valid date');\n }\n \n Args.notEmpty(data.cancelReason, 'Cancel Reason cannot be empty');\n\n if ( !LangUtils.isDate(data.dateCancelled) ) {\n throw new DataError('E_STATE', 'Cancel date can not be empty or invalid date');\n }\n\n await this.context.executeInTransactionAsync(async () => {\n const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard')\n .where('id')\n .equal(this.getId())\n .select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom')\n .expand('cardStatus')\n .getItem();\n\n Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');\n\n if (currentStudentAccommodationCard?.cardStatus?.alternateName !== 'ActiveActionStatus') {\n throw new DataError('E_STATE', 'The accommodation room cannot be changed for inactive accommodation card');\n }\n const newCard = {\n action: currentStudentAccommodationCard.action,\n student: currentStudentAccommodationCard.student,\n accommodationRoom: room,\n academicYear: currentStudentAccommodationCard.academicYear,\n validFrom: data.validThrough,\n validThrough: currentStudentAccommodationCard.validThrough,\n cardStatus: {\n alternateName: 'ActiveActionStatus'\n }\n }\n\n currentStudentAccommodationCard.cancelReason = data.cancelReason;\n currentStudentAccommodationCard.dateCancelled = data.dateCancelled;\n currentStudentAccommodationCard.validThrough = data.dateCancelled;\n delete currentStudentAccommodationCard.cardStatus ;\n currentStudentAccommodationCard.cardStatus= { alternateName : 'CompletedActionStatus'};\n\n await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);\n const currentAccommodationRoom = currentStudentAccommodationCard.accommodationRoom?.id || currentStudentAccommodationCard?.accommodationRoom;\n Args.notNull(currentAccommodationRoom, 'The specified Student Accommodation Card does not contain any room');\n await calculateOccupancy(this.context, currentAccommodationRoom);\n await this.context.model('StudentAccommodationCards').save(newCard);\n await calculateOccupancy(this.context, room);\n },(err)=>{\n TraceUtils.log(err);\n });\n }\n\n @EdmMapping.param('data', 'Object', false, true)\n @EdmMapping.action('addToRoom', 'StudentAccommodationCard')\n\n async addToRoom(data) {\n const room = data.accommodationRoom?.id || data?.accommodationRoom;\n Args.notNull(room, 'Accommodation room can not be empty');\n Args.notNumber(room, 'Accommodation room should be a number');\n if (!LangUtils.isDate(data.validFrom)) {\n throw new DataError('E_STATE', 'Valid through date can not be empty or it is not a valid date');\n }\n await this.context.executeInTransactionAsync(async () => {\n const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard')\n .where('id')\n .equal(this.getId())\n .select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough')\n .expand('cardStatus')\n .getItem();\n Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');\n if (currentStudentAccommodationCard?.cardStatus?.alternateName !== 'ActiveActionStatus') {\n throw new DataError('E_STATE', 'Add to room action can only be applied when student accommodation card status is Active');\n }\n currentStudentAccommodationCard.accommodationRoom = room;\n currentStudentAccommodationCard.validFrom = data.validFrom;\n await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);\n await calculateOccupancy(this.context, room); // calculate occupancy after new room updated \n }, (err) => {\n TraceUtils.log(err);\n });\n }\n\n @EdmMapping.param('data', 'Object', false, true)\n @EdmMapping.action('revertToPending', 'StudentAccommodationCard')\n\n async revertToPending(data) {\n await this.context.executeInTransactionAsync(async () => {\n const currentStudentAccommodationCard = await this.context.model('StudentAccommodationCard')\n .where('id')\n .equal(this.getId())\n .select('id', 'serialNumber', 'action', 'student', 'cardStatus', 'academicYear', 'isActive', 'validThrough', 'accommodationRoom')\n .expand('cardStatus')\n .getItem();\n\n Args.notNull(currentStudentAccommodationCard, 'The specified Student Accommodation Card cannot be found or is inaccessible');\n if (currentStudentAccommodationCard?.cardStatus?.alternateName !== 'ActiveActionStatus') {\n throw new DataError('E_STATE', 'Inactive accommodation card');\n }\n\n const accommodationRoom = currentStudentAccommodationCard.accommodationRoom?.id || currentStudentAccommodationCard?.accommodationRoom;\n currentStudentAccommodationCard.cardStatus = { alternateName: 'ActiveActionStatus' };\n currentStudentAccommodationCard.accommodationRoom = null;\n await this.context.model('StudentAccommodationCard').save(currentStudentAccommodationCard);\n await calculateOccupancy(this.context, accommodationRoom);\n });\n }\n\n\n}\nasync function calculateOccupancy(context, accommodationRoom) {\n if (accommodationRoom == null) {\n return;\n }\n const currentOccupancy = await context.model('StudentAccommodationCard')\n .where('accommodationRoom').equal(accommodationRoom)\n .and('cardStatus/alternateName').equal('ActiveActionStatus')\n .and('accommodationRoom/outOfService').equal(0)\n .and('accommodationRoom/roomType/accessibleType').equal(1)\n .select('count(id) as total', 'accommodationRoom/occupancy as maxOccupancy')\n .groupBy('accommodationRoom/occupancy')\n .silent()\n .getItem();\n\n const totalOccupancy = (currentOccupancy && currentOccupancy.total) || 0;\n if (totalOccupancy && totalOccupancy > currentOccupancy.maxOccupancy) {\n throw new DataError('E_STATE', 'No room space for new resident');\n }\n\n await context.model('AccommodationRoom').save({\n id: accommodationRoom,\n currentOccupancy: totalOccupancy\n });\n}\n\nmodule.exports = StudentAccommodationCard;"],"mappings":";AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA,6BAA4D,IAAAI,IAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,KAAA,EAAAC,MAAA,EAAAC,OAAA,UAAAX,uBAAAY,GAAA,UAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAA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