@driveup/schema 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -0
- package/lib/catalog/addon/addon.entity.d.ts +109 -0
- package/lib/catalog/addon/addon.entity.js +260 -0
- package/lib/catalog/addon/addon.entity.js.map +1 -0
- package/lib/catalog/addon/country.entity.d.ts +112 -0
- package/lib/catalog/addon/country.entity.js +246 -0
- package/lib/catalog/addon/country.entity.js.map +1 -0
- package/lib/catalog/driving/category.entity.d.ts +122 -0
- package/lib/catalog/driving/category.entity.js +217 -0
- package/lib/catalog/driving/category.entity.js.map +1 -0
- package/lib/catalog/driving/vehicle.entity.d.ts +49 -0
- package/lib/catalog/driving/vehicle.entity.js +97 -0
- package/lib/catalog/driving/vehicle.entity.js.map +1 -0
- package/lib/catalog/priceplan/priceplan.entity.d.ts +123 -0
- package/lib/catalog/priceplan/priceplan.entity.js +288 -0
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/country.entity.d.ts +109 -0
- package/lib/catalog/product/country.entity.js +233 -0
- package/lib/catalog/product/country.entity.js.map +1 -0
- package/lib/catalog/product/priceplan.entity.d.ts +113 -0
- package/lib/catalog/product/priceplan.entity.js +251 -0
- package/lib/catalog/product/priceplan.entity.js.map +1 -0
- package/lib/catalog/product/product.entity.d.ts +104 -0
- package/lib/catalog/product/product.entity.js +262 -0
- package/lib/catalog/product/product.entity.js.map +1 -0
- package/lib/catalog/program/program.entity.d.ts +107 -0
- package/lib/catalog/program/program.entity.js +247 -0
- package/lib/catalog/program/program.entity.js.map +1 -0
- package/lib/catalog/seed/assets/asset.entity.d.ts +68 -0
- package/lib/catalog/seed/assets/asset.entity.js +163 -0
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -0
- package/lib/catalog/seed/courses/course.entity.d.ts +98 -0
- package/lib/catalog/seed/courses/course.entity.js +216 -0
- package/lib/catalog/seed/courses/course.entity.js.map +1 -0
- package/lib/catalog/seed/courses/lesson.entity.d.ts +90 -0
- package/lib/catalog/seed/courses/lesson.entity.js +214 -0
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -0
- package/lib/catalog/seed/courses/topic.entity.d.ts +77 -0
- package/lib/catalog/seed/courses/topic.entity.js +185 -0
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -0
- package/lib/catalog/seed/expense/category.entity.d.ts +61 -0
- package/lib/catalog/seed/expense/category.entity.js +153 -0
- package/lib/catalog/seed/expense/category.entity.js.map +1 -0
- package/lib/index.d.ts +67 -0
- package/lib/index.js +89 -0
- package/lib/index.js.map +1 -0
- package/lib/profile/agent/agent.entity.d.ts +95 -0
- package/lib/profile/agent/agent.entity.js +223 -0
- package/lib/profile/agent/agent.entity.js.map +1 -0
- package/lib/profile/agent/payout.entity.d.ts +70 -0
- package/lib/profile/agent/payout.entity.js +160 -0
- package/lib/profile/agent/payout.entity.js.map +1 -0
- package/lib/profile/agent/promotion.entity.d.ts +82 -0
- package/lib/profile/agent/promotion.entity.js +174 -0
- package/lib/profile/agent/promotion.entity.js.map +1 -0
- package/lib/profile/company/company.entity.d.ts +234 -0
- package/lib/profile/company/company.entity.js +558 -0
- package/lib/profile/company/company.entity.js.map +1 -0
- package/lib/profile/company/course/appointment.entity.d.ts +111 -0
- package/lib/profile/company/course/appointment.entity.js +240 -0
- package/lib/profile/company/course/appointment.entity.js.map +1 -0
- package/lib/profile/company/course/course.entity.d.ts +156 -0
- package/lib/profile/company/course/course.entity.js +365 -0
- package/lib/profile/company/course/course.entity.js.map +1 -0
- package/lib/profile/company/course/lesson.entity.d.ts +123 -0
- package/lib/profile/company/course/lesson.entity.js +288 -0
- package/lib/profile/company/course/lesson.entity.js.map +1 -0
- package/lib/profile/company/course/topic.entity.d.ts +55 -0
- package/lib/profile/company/course/topic.entity.js +147 -0
- package/lib/profile/company/course/topic.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/bill.entity.d.ts +145 -0
- package/lib/profile/company/finances/billing/bill.entity.js +338 -0
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/item.entity.d.ts +75 -0
- package/lib/profile/company/finances/billing/item.entity.js +219 -0
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -0
- package/lib/profile/company/finances/billing/transaction.entity.d.ts +44 -0
- package/lib/profile/company/finances/billing/transaction.entity.js +158 -0
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/category.entity.d.ts +55 -0
- package/lib/profile/company/finances/expense/category.entity.js +117 -0
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -0
- package/lib/profile/company/finances/expense/expense.entity.d.ts +48 -0
- package/lib/profile/company/finances/expense/expense.entity.js +171 -0
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -0
- package/lib/profile/company/finances/handover/handover.entity.d.ts +44 -0
- package/lib/profile/company/finances/handover/handover.entity.js +202 -0
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/invoice.entity.d.ts +65 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js +296 -0
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -0
- package/lib/profile/company/finances/invoice/item.entity.d.ts +25 -0
- package/lib/profile/company/finances/invoice/item.entity.js +148 -0
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -0
- package/lib/profile/company/finances/payment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/payment/method.entity.js +143 -0
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment/method.entity.d.ts +35 -0
- package/lib/profile/company/finances/peyment/method.entity.js +143 -0
- package/lib/profile/company/finances/peyment/method.entity.js.map +1 -0
- package/lib/profile/company/finances/peyment-method/payment-method.d.ts +34 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js +118 -0
- package/lib/profile/company/finances/peyment-method/payment-method.js.map +1 -0
- package/lib/profile/company/instructor/instructor.entity.d.ts +85 -0
- package/lib/profile/company/instructor/instructor.entity.js +254 -0
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/company/instructor/task.entity.d.ts +60 -0
- package/lib/profile/company/instructor/task.entity.js +133 -0
- package/lib/profile/company/instructor/task.entity.js.map +1 -0
- package/lib/profile/company/medical/examination.entity.d.ts +59 -0
- package/lib/profile/company/medical/examination.entity.js +175 -0
- package/lib/profile/company/medical/examination.entity.js.map +1 -0
- package/lib/profile/company/medical/product.entity.d.ts +99 -0
- package/lib/profile/company/medical/product.entity.js +270 -0
- package/lib/profile/company/medical/product.entity.js.map +1 -0
- package/lib/profile/company/metrics/company.metric.d.ts +21 -0
- package/lib/profile/company/metrics/company.metric.js +122 -0
- package/lib/profile/company/metrics/company.metric.js.map +1 -0
- package/lib/profile/company/product/addon.entity.d.ts +93 -0
- package/lib/profile/company/product/addon.entity.js +234 -0
- package/lib/profile/company/product/addon.entity.js.map +1 -0
- package/lib/profile/company/product/priceplan.entity.d.ts +57 -0
- package/lib/profile/company/product/priceplan.entity.js +167 -0
- package/lib/profile/company/product/priceplan.entity.js.map +1 -0
- package/lib/profile/company/product/product.entity.d.ts +171 -0
- package/lib/profile/company/product/product.entity.js +383 -0
- package/lib/profile/company/product/product.entity.js.map +1 -0
- package/lib/profile/company/product/vehicle.entity.d.ts +46 -0
- package/lib/profile/company/product/vehicle.entity.js +144 -0
- package/lib/profile/company/product/vehicle.entity.js.map +1 -0
- package/lib/profile/instructor/instructor.entity.d.ts +80 -0
- package/lib/profile/instructor/instructor.entity.js +186 -0
- package/lib/profile/instructor/instructor.entity.js.map +1 -0
- package/lib/profile/student/program/licence/licence.entity.d.ts +66 -0
- package/lib/profile/student/program/licence/licence.entity.js +187 -0
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -0
- package/lib/profile/student/program/medical/certificate.entity.d.ts +84 -0
- package/lib/profile/student/program/medical/certificate.entity.js +244 -0
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -0
- package/lib/profile/student/program/medical/examination.model.d.ts +65 -0
- package/lib/profile/student/program/medical/examination.model.js +209 -0
- package/lib/profile/student/program/medical/examination.model.js.map +1 -0
- package/lib/profile/student/program/program.entity.d.ts +78 -0
- package/lib/profile/student/program/program.entity.js +225 -0
- package/lib/profile/student/program/program.entity.js.map +1 -0
- package/lib/profile/student/program/training/appointment.entity.d.ts +151 -0
- package/lib/profile/student/program/training/appointment.entity.js +441 -0
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -0
- package/lib/profile/student/program/training/exam.entity.d.ts +41 -0
- package/lib/profile/student/program/training/exam.entity.js +141 -0
- package/lib/profile/student/program/training/exam.entity.js.map +1 -0
- package/lib/profile/student/program/training/lesson.entity.d.ts +84 -0
- package/lib/profile/student/program/training/lesson.entity.js +221 -0
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -0
- package/lib/profile/student/program/training/request.entity.d.ts +56 -0
- package/lib/profile/student/program/training/request.entity.js +159 -0
- package/lib/profile/student/program/training/request.entity.js.map +1 -0
- package/lib/profile/student/program/training/topic.entity.d.ts +109 -0
- package/lib/profile/student/program/training/topic.entity.js +255 -0
- package/lib/profile/student/program/training/topic.entity.js.map +1 -0
- package/lib/profile/student/program/training/training.entity.d.ts +167 -0
- package/lib/profile/student/program/training/training.entity.js +501 -0
- package/lib/profile/student/program/training/training.entity.js.map +1 -0
- package/lib/profile/student/program/training/transaction.entity.d.ts +111 -0
- package/lib/profile/student/program/training/transaction.entity.js +266 -0
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -0
- package/lib/profile/student/student.entity.d.ts +89 -0
- package/lib/profile/student/student.entity.js +183 -0
- package/lib/profile/student/student.entity.js.map +1 -0
- package/lib/system/campaign/campaign.entity.d.ts +68 -0
- package/lib/system/campaign/campaign.entity.js +150 -0
- package/lib/system/campaign/campaign.entity.js.map +1 -0
- package/lib/system/campaign/gifcode.entity.d.ts +14 -0
- package/lib/system/campaign/gifcode.entity.js +77 -0
- package/lib/system/campaign/gifcode.entity.js.map +1 -0
- package/lib/system/campaigne/campaign.entity.d.ts +69 -0
- package/lib/system/campaigne/campaign.entity.js +179 -0
- package/lib/system/campaigne/campaign.entity.js.map +1 -0
- package/lib/system/campaigne/gifcode.entity.d.ts +54 -0
- package/lib/system/campaigne/gifcode.entity.js +126 -0
- package/lib/system/campaigne/gifcode.entity.js.map +1 -0
- package/lib/system/country/country.entity.d.ts +121 -0
- package/lib/system/country/country.entity.js +284 -0
- package/lib/system/country/country.entity.js.map +1 -0
- package/lib/system/country/country.metric.d.ts +12 -0
- package/lib/system/country/country.metric.js +68 -0
- package/lib/system/country/country.metric.js.map +1 -0
- package/lib/system/currency/currency.entity.d.ts +46 -0
- package/lib/system/currency/currency.entity.js +112 -0
- package/lib/system/currency/currency.entity.js.map +1 -0
- package/lib/system/driving/category.entity.d.ts +146 -0
- package/lib/system/driving/category.entity.js +321 -0
- package/lib/system/driving/category.entity.js.map +1 -0
- package/lib/system/driving/vehicle.entity.d.ts +54 -0
- package/lib/system/driving/vehicle.entity.js +130 -0
- package/lib/system/driving/vehicle.entity.js.map +1 -0
- package/lib/system/event/business.entity.d.ts +75 -0
- package/lib/system/event/business.entity.js +170 -0
- package/lib/system/event/business.entity.js.map +1 -0
- package/lib/system/event/log.entity.d.ts +103 -0
- package/lib/system/event/log.entity.js +202 -0
- package/lib/system/event/log.entity.js.map +1 -0
- package/lib/system/policy/policy.entity.d.ts +90 -0
- package/lib/system/policy/policy.entity.js +226 -0
- package/lib/system/policy/policy.entity.js.map +1 -0
- package/lib/system/staff/staff.entity.d.ts +72 -0
- package/lib/system/staff/staff.entity.js +186 -0
- package/lib/system/staff/staff.entity.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/user/alert.entity.d.ts +95 -0
- package/lib/user/alert.entity.js +223 -0
- package/lib/user/alert.entity.js.map +1 -0
- package/lib/user/blocked.entity.d.ts +42 -0
- package/lib/user/blocked.entity.js +83 -0
- package/lib/user/blocked.entity.js.map +1 -0
- package/lib/user/device.entity.d.ts +72 -0
- package/lib/user/device.entity.js +182 -0
- package/lib/user/device.entity.js.map +1 -0
- package/lib/user/notification.entity.d.ts +87 -0
- package/lib/user/notification.entity.js +219 -0
- package/lib/user/notification.entity.js.map +1 -0
- package/lib/user/ticket.entity.d.ts +85 -0
- package/lib/user/ticket.entity.js +231 -0
- package/lib/user/ticket.entity.js.map +1 -0
- package/lib/user/user.entity.d.ts +235 -0
- package/lib/user/user.entity.js +573 -0
- package/lib/user/user.entity.js.map +1 -0
- package/lib/user/verification.entity.d.ts +75 -0
- package/lib/user/verification.entity.js +142 -0
- package/lib/user/verification.entity.js.map +1 -0
- package/lib/utils/activity.helper.d.ts +26 -0
- package/lib/utils/activity.helper.js +39 -0
- package/lib/utils/activity.helper.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +21 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/json-metrics.transform.d.ts +35 -0
- package/lib/utils/json-metrics.transform.js +83 -0
- package/lib/utils/json-metrics.transform.js.map +1 -0
- package/lib/utils/numeric.transform.d.ts +38 -0
- package/lib/utils/numeric.transform.js +74 -0
- package/lib/utils/numeric.transform.js.map +1 -0
- package/lib/utils/trackable.entity.d.ts +82 -0
- package/lib/utils/trackable.entity.js +100 -0
- package/lib/utils/trackable.entity.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserDeviceEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const user_entity_1 = require("./user.entity");
|
|
15
|
+
const common_1 = require("@driveup/common");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
/**
|
|
18
|
+
* Represents a user's registered device for push notifications and authentication.
|
|
19
|
+
* Tracks device information including model, OS, and unique identifiers.
|
|
20
|
+
* Used for sending FCM notifications and device management.
|
|
21
|
+
*
|
|
22
|
+
* @extends TrackableEntity
|
|
23
|
+
*/
|
|
24
|
+
let UserDeviceEntity = class UserDeviceEntity extends utils_1.TrackableEntity {
|
|
25
|
+
/**
|
|
26
|
+
* Reference to the user who owns this device
|
|
27
|
+
*/
|
|
28
|
+
userId;
|
|
29
|
+
/**
|
|
30
|
+
* Global unique identifier for the device
|
|
31
|
+
*/
|
|
32
|
+
guid;
|
|
33
|
+
/**
|
|
34
|
+
* FCM token or device signature for push notifications
|
|
35
|
+
*/
|
|
36
|
+
signature;
|
|
37
|
+
/**
|
|
38
|
+
* Device model (e.g., "iPhone 12", "Samsung Galaxy S21")
|
|
39
|
+
*/
|
|
40
|
+
model;
|
|
41
|
+
/**
|
|
42
|
+
* Device name as set by the user
|
|
43
|
+
*/
|
|
44
|
+
name;
|
|
45
|
+
/**
|
|
46
|
+
* Device manufacturer brand
|
|
47
|
+
*/
|
|
48
|
+
brand;
|
|
49
|
+
/**
|
|
50
|
+
* Operating system (e.g., "iOS 15", "Android 12")
|
|
51
|
+
*/
|
|
52
|
+
os;
|
|
53
|
+
/**
|
|
54
|
+
* Device language setting
|
|
55
|
+
*/
|
|
56
|
+
language;
|
|
57
|
+
/**
|
|
58
|
+
* User custom description for the device
|
|
59
|
+
*/
|
|
60
|
+
description;
|
|
61
|
+
/**
|
|
62
|
+
* Reference to the device owner
|
|
63
|
+
*/
|
|
64
|
+
user;
|
|
65
|
+
/**
|
|
66
|
+
* Creates an instance of UserDeviceEntity
|
|
67
|
+
* @param props - Partial properties to initialize the entity
|
|
68
|
+
*/
|
|
69
|
+
constructor(props) {
|
|
70
|
+
super();
|
|
71
|
+
Object.assign(this, props);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Converts the entity to a Device model instance
|
|
75
|
+
* @returns Device model with all device information
|
|
76
|
+
*/
|
|
77
|
+
toModel() {
|
|
78
|
+
return new common_1.Device({
|
|
79
|
+
id: this.id,
|
|
80
|
+
guid: this.guid,
|
|
81
|
+
signature: this.signature,
|
|
82
|
+
model: this.model,
|
|
83
|
+
name: this.name,
|
|
84
|
+
brand: this.brand,
|
|
85
|
+
os: this.os,
|
|
86
|
+
description: this.description,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns a summary representation of the device
|
|
91
|
+
* @returns Model instance (same as toModel())
|
|
92
|
+
*/
|
|
93
|
+
toSummary() {
|
|
94
|
+
return new common_1.Device({
|
|
95
|
+
id: this.id,
|
|
96
|
+
model: this.model,
|
|
97
|
+
name: this.name,
|
|
98
|
+
brand: this.brand
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Retrieves all activity records for this device
|
|
103
|
+
* @returns Array of Activity objects
|
|
104
|
+
*/
|
|
105
|
+
async getActivities() {
|
|
106
|
+
const activities = [];
|
|
107
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
|
|
108
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
109
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
|
|
110
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
111
|
+
return activities.filter(a => a);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.UserDeviceEntity = UserDeviceEntity;
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, typeorm_1.Column)(),
|
|
117
|
+
__metadata("design:type", Number)
|
|
118
|
+
], UserDeviceEntity.prototype, "userId", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
(0, typeorm_1.Column)({
|
|
121
|
+
nullable: true,
|
|
122
|
+
default: null
|
|
123
|
+
}),
|
|
124
|
+
__metadata("design:type", String)
|
|
125
|
+
], UserDeviceEntity.prototype, "guid", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({
|
|
128
|
+
nullable: true,
|
|
129
|
+
default: null
|
|
130
|
+
}),
|
|
131
|
+
__metadata("design:type", String)
|
|
132
|
+
], UserDeviceEntity.prototype, "signature", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, typeorm_1.Column)({
|
|
135
|
+
nullable: true,
|
|
136
|
+
default: null
|
|
137
|
+
}),
|
|
138
|
+
__metadata("design:type", String)
|
|
139
|
+
], UserDeviceEntity.prototype, "model", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, typeorm_1.Column)({
|
|
142
|
+
nullable: false
|
|
143
|
+
}),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], UserDeviceEntity.prototype, "name", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typeorm_1.Column)({
|
|
148
|
+
nullable: true,
|
|
149
|
+
default: null
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", String)
|
|
152
|
+
], UserDeviceEntity.prototype, "brand", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, typeorm_1.Column)({
|
|
155
|
+
nullable: true,
|
|
156
|
+
default: null
|
|
157
|
+
}),
|
|
158
|
+
__metadata("design:type", String)
|
|
159
|
+
], UserDeviceEntity.prototype, "os", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, typeorm_1.Column)({
|
|
162
|
+
nullable: true,
|
|
163
|
+
default: null
|
|
164
|
+
}),
|
|
165
|
+
__metadata("design:type", String)
|
|
166
|
+
], UserDeviceEntity.prototype, "language", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, typeorm_1.Column)({
|
|
169
|
+
nullable: true,
|
|
170
|
+
default: null
|
|
171
|
+
}),
|
|
172
|
+
__metadata("design:type", String)
|
|
173
|
+
], UserDeviceEntity.prototype, "description", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.UserEntity, user => user.devices),
|
|
176
|
+
__metadata("design:type", Promise)
|
|
177
|
+
], UserDeviceEntity.prototype, "user", void 0);
|
|
178
|
+
exports.UserDeviceEntity = UserDeviceEntity = __decorate([
|
|
179
|
+
(0, typeorm_1.Entity)('userDevices'),
|
|
180
|
+
__metadata("design:paramtypes", [Object])
|
|
181
|
+
], UserDeviceEntity);
|
|
182
|
+
//# sourceMappingURL=device.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.entity.js","sourceRoot":"","sources":["../../src/user/device.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AAEpD,+CAA2C;AAC3C,4CAAiE;AACjE,oCAAuD;AAEvD;;;;;;GAMG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,uBAAuB;IAE5D;;OAEG;IAEH,MAAM,CAAS;IAEf;;OAEG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAKH,SAAS,CAAS;IAElB;;OAEG;IAKH,KAAK,CAAS;IAEd;;OAEG;IAIH,IAAI,CAAS;IAEb;;OAEG;IAKH,KAAK,CAAS;IAEd;;OAEG;IAKH,EAAE,CAAS;IAEX;;OAEG;IAKH,QAAQ,CAAS;IAEjB;;OAEG;IAKH,WAAW,CAAS;IAEpB;;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';
|
|
2
|
+
import { Activity, Person, SelectedProfile } from '@driveup/common';
|
|
3
|
+
import { UserEntity } from './user.entity';
|
|
4
|
+
import { TrackableEntity } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a user notification sent through various channels.
|
|
7
|
+
* Notifications inform users about events, updates, or actions required.
|
|
8
|
+
* Tracks seen/dismissed status and can be associated with specific profiles.
|
|
9
|
+
*
|
|
10
|
+
* @extends TrackableEntity
|
|
11
|
+
*/
|
|
12
|
+
export declare class UserNotificationEntity extends TrackableEntity<Notification> {
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the user who receives this notification
|
|
15
|
+
*/
|
|
16
|
+
userId: number;
|
|
17
|
+
/**
|
|
18
|
+
* Notification title
|
|
19
|
+
*/
|
|
20
|
+
title: string;
|
|
21
|
+
/**
|
|
22
|
+
* Notification message content
|
|
23
|
+
*/
|
|
24
|
+
message: string;
|
|
25
|
+
/**
|
|
26
|
+
* UI color context for displaying the notification
|
|
27
|
+
* @default ColorContext.Info
|
|
28
|
+
*/
|
|
29
|
+
color: ColorContext;
|
|
30
|
+
/**
|
|
31
|
+
* Delivery channel (App, Email, SMS, Push)
|
|
32
|
+
* @default NotificationChannel.App
|
|
33
|
+
*/
|
|
34
|
+
channel: NotificationChannel;
|
|
35
|
+
/**
|
|
36
|
+
* This name is used to identify the notification setting in the system.
|
|
37
|
+
* @description This field is used only to identify the user notification in the system.
|
|
38
|
+
*/
|
|
39
|
+
event: string;
|
|
40
|
+
/**
|
|
41
|
+
* The profile type and company associated with the log entry.
|
|
42
|
+
* This is used to filter logs by profile and/or company.
|
|
43
|
+
*/
|
|
44
|
+
profile: SelectedProfile;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the user has seen this notification
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
seen: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the user has dismissed this notification
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
dismissed: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Deep link or URL associated with the notification
|
|
57
|
+
*/
|
|
58
|
+
link: string;
|
|
59
|
+
/**
|
|
60
|
+
* Person who triggered or authored the notification
|
|
61
|
+
*/
|
|
62
|
+
author: Person;
|
|
63
|
+
/**
|
|
64
|
+
* Target person or entity the notification is about
|
|
65
|
+
*/
|
|
66
|
+
target: Person;
|
|
67
|
+
/**
|
|
68
|
+
* Reference to the user receiving the notification
|
|
69
|
+
*/
|
|
70
|
+
user: Promise<UserEntity>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates an instance of UserNotificationEntity
|
|
73
|
+
* @param props - Partial properties to initialize the entity
|
|
74
|
+
*/
|
|
75
|
+
constructor(props?: Partial<UserNotificationEntity>);
|
|
76
|
+
/**
|
|
77
|
+
* Converts the entity to a Notification model instance
|
|
78
|
+
* @returns Notification model with all notification information
|
|
79
|
+
*/
|
|
80
|
+
toModel(): Notification;
|
|
81
|
+
/**
|
|
82
|
+
* Returns a summary representation of the notification
|
|
83
|
+
* @returns Model instance (same as toModel())
|
|
84
|
+
*/
|
|
85
|
+
toSummary(): Notification;
|
|
86
|
+
getActivities(): Promise<Activity[]>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserNotificationEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const common_1 = require("@driveup/common");
|
|
15
|
+
const common_2 = require("@driveup/common");
|
|
16
|
+
const user_entity_1 = require("./user.entity");
|
|
17
|
+
const utils_1 = require("../utils");
|
|
18
|
+
/**
|
|
19
|
+
* Represents a user notification sent through various channels.
|
|
20
|
+
* Notifications inform users about events, updates, or actions required.
|
|
21
|
+
* Tracks seen/dismissed status and can be associated with specific profiles.
|
|
22
|
+
*
|
|
23
|
+
* @extends TrackableEntity
|
|
24
|
+
*/
|
|
25
|
+
let UserNotificationEntity = class UserNotificationEntity extends utils_1.TrackableEntity {
|
|
26
|
+
/**
|
|
27
|
+
* Reference to the user who receives this notification
|
|
28
|
+
*/
|
|
29
|
+
userId;
|
|
30
|
+
/**
|
|
31
|
+
* Notification title
|
|
32
|
+
*/
|
|
33
|
+
title;
|
|
34
|
+
/**
|
|
35
|
+
* Notification message content
|
|
36
|
+
*/
|
|
37
|
+
message;
|
|
38
|
+
/**
|
|
39
|
+
* UI color context for displaying the notification
|
|
40
|
+
* @default ColorContext.Info
|
|
41
|
+
*/
|
|
42
|
+
color;
|
|
43
|
+
/**
|
|
44
|
+
* Delivery channel (App, Email, SMS, Push)
|
|
45
|
+
* @default NotificationChannel.App
|
|
46
|
+
*/
|
|
47
|
+
channel;
|
|
48
|
+
/**
|
|
49
|
+
* This name is used to identify the notification setting in the system.
|
|
50
|
+
* @description This field is used only to identify the user notification in the system.
|
|
51
|
+
*/
|
|
52
|
+
event;
|
|
53
|
+
/**
|
|
54
|
+
* The profile type and company associated with the log entry.
|
|
55
|
+
* This is used to filter logs by profile and/or company.
|
|
56
|
+
*/
|
|
57
|
+
profile;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the user has seen this notification
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
seen;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the user has dismissed this notification
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
dismissed;
|
|
68
|
+
/**
|
|
69
|
+
* Deep link or URL associated with the notification
|
|
70
|
+
*/
|
|
71
|
+
link;
|
|
72
|
+
/**
|
|
73
|
+
* Person who triggered or authored the notification
|
|
74
|
+
*/
|
|
75
|
+
author;
|
|
76
|
+
/**
|
|
77
|
+
* Target person or entity the notification is about
|
|
78
|
+
*/
|
|
79
|
+
target;
|
|
80
|
+
/**
|
|
81
|
+
* Reference to the user receiving the notification
|
|
82
|
+
*/
|
|
83
|
+
user;
|
|
84
|
+
/**
|
|
85
|
+
* Creates an instance of UserNotificationEntity
|
|
86
|
+
* @param props - Partial properties to initialize the entity
|
|
87
|
+
*/
|
|
88
|
+
constructor(props) {
|
|
89
|
+
super();
|
|
90
|
+
Object.assign(this, props);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Converts the entity to a Notification model instance
|
|
94
|
+
* @returns Notification model with all notification information
|
|
95
|
+
*/
|
|
96
|
+
toModel() {
|
|
97
|
+
return new common_1.Notification({
|
|
98
|
+
id: this.id,
|
|
99
|
+
title: this.title,
|
|
100
|
+
message: this.message,
|
|
101
|
+
color: this.color,
|
|
102
|
+
channel: this.channel,
|
|
103
|
+
seen: this.seen,
|
|
104
|
+
link: this.link,
|
|
105
|
+
author: this.author ? common_2.Person.toInstance(this.author) : null,
|
|
106
|
+
target: this.target ? common_2.Person.toInstance(this.target) : null,
|
|
107
|
+
createdOn: this.createdOn,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Returns a summary representation of the notification
|
|
112
|
+
* @returns Model instance (same as toModel())
|
|
113
|
+
*/
|
|
114
|
+
toSummary() {
|
|
115
|
+
return this.toModel();
|
|
116
|
+
}
|
|
117
|
+
async getActivities() {
|
|
118
|
+
const activities = [];
|
|
119
|
+
activities.push(await (0, utils_1.toActivity)(this.createdBy, common_2.ActivityType.createdBy));
|
|
120
|
+
activities.push(await (0, utils_1.toActivity)(this.createdOn, common_2.ActivityType.createdOn));
|
|
121
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedBy, common_2.ActivityType.updatedBy));
|
|
122
|
+
activities.push(await (0, utils_1.toActivity)(this.updatedOn, common_2.ActivityType.updatedOn));
|
|
123
|
+
return activities.filter(a => a);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
exports.UserNotificationEntity = UserNotificationEntity;
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typeorm_1.Column)(),
|
|
129
|
+
__metadata("design:type", Number)
|
|
130
|
+
], UserNotificationEntity.prototype, "userId", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, typeorm_1.Column)({
|
|
133
|
+
nullable: true,
|
|
134
|
+
default: null
|
|
135
|
+
}),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], UserNotificationEntity.prototype, "title", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({
|
|
140
|
+
type: 'text',
|
|
141
|
+
nullable: false
|
|
142
|
+
}),
|
|
143
|
+
__metadata("design:type", String)
|
|
144
|
+
], UserNotificationEntity.prototype, "message", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, typeorm_1.Column)({
|
|
147
|
+
type: 'enum',
|
|
148
|
+
enum: common_1.ColorContext,
|
|
149
|
+
default: common_1.ColorContext.Info,
|
|
150
|
+
nullable: false
|
|
151
|
+
}),
|
|
152
|
+
__metadata("design:type", String)
|
|
153
|
+
], UserNotificationEntity.prototype, "color", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typeorm_1.Column)({
|
|
156
|
+
type: 'enum',
|
|
157
|
+
enum: common_1.NotificationChannel,
|
|
158
|
+
default: common_1.NotificationChannel.App
|
|
159
|
+
}),
|
|
160
|
+
__metadata("design:type", String)
|
|
161
|
+
], UserNotificationEntity.prototype, "channel", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
164
|
+
__metadata("design:type", String)
|
|
165
|
+
], UserNotificationEntity.prototype, "event", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, typeorm_1.Column)({
|
|
168
|
+
type: 'simple-json',
|
|
169
|
+
nullable: true,
|
|
170
|
+
default: null
|
|
171
|
+
}),
|
|
172
|
+
__metadata("design:type", Object)
|
|
173
|
+
], UserNotificationEntity.prototype, "profile", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, typeorm_1.Column)({
|
|
176
|
+
nullable: false,
|
|
177
|
+
default: false
|
|
178
|
+
}),
|
|
179
|
+
__metadata("design:type", Boolean)
|
|
180
|
+
], UserNotificationEntity.prototype, "seen", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
(0, typeorm_1.Column)({
|
|
183
|
+
nullable: false,
|
|
184
|
+
default: false
|
|
185
|
+
}),
|
|
186
|
+
__metadata("design:type", Boolean)
|
|
187
|
+
], UserNotificationEntity.prototype, "dismissed", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
(0, typeorm_1.Column)({
|
|
190
|
+
nullable: true,
|
|
191
|
+
default: null
|
|
192
|
+
}),
|
|
193
|
+
__metadata("design:type", String)
|
|
194
|
+
], UserNotificationEntity.prototype, "link", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
(0, typeorm_1.Column)({
|
|
197
|
+
type: 'simple-json',
|
|
198
|
+
nullable: true,
|
|
199
|
+
default: null
|
|
200
|
+
}),
|
|
201
|
+
__metadata("design:type", common_2.Person)
|
|
202
|
+
], UserNotificationEntity.prototype, "author", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, typeorm_1.Column)({
|
|
205
|
+
type: 'simple-json',
|
|
206
|
+
nullable: true,
|
|
207
|
+
default: null
|
|
208
|
+
}),
|
|
209
|
+
__metadata("design:type", common_2.Person)
|
|
210
|
+
], UserNotificationEntity.prototype, "target", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.UserEntity, user => user.notifications),
|
|
213
|
+
__metadata("design:type", Promise)
|
|
214
|
+
], UserNotificationEntity.prototype, "user", void 0);
|
|
215
|
+
exports.UserNotificationEntity = UserNotificationEntity = __decorate([
|
|
216
|
+
(0, typeorm_1.Entity)('userNotifications'),
|
|
217
|
+
__metadata("design:paramtypes", [Object])
|
|
218
|
+
], UserNotificationEntity);
|
|
219
|
+
//# sourceMappingURL=notification.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.entity.js","sourceRoot":"","sources":["../../src/user/notification.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,4CAAkF;AAClF,4CAAkF;AAClF,+CAA2C;AAC3C,oCAAuD;AAEvD;;;;;;GAMG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uBAA6B;IAExE;;OAEG;IAEH,MAAM,CAAS;IAEf;;OAEG;IAKH,KAAK,CAAS;IAEd;;OAEG;IAKH,OAAO,CAAS;IAEhB;;;OAGG;IAOH,KAAK,CAAe;IAEpB;;;OAGG;IAMH,OAAO,CAAsB;IAE7B;;;OAGG;IAEH,KAAK,CAAS;IAEd;;;OAGG;IAMH,OAAO,CAAkB;IAEzB;;;OAGG;IAKH,IAAI,CAAU;IAEd;;;OAGG;IAKH,SAAS,CAAU;IAEnB;;OAEG;IAKH,IAAI,CAAS;IAEb;;OAEG;IAMH,MAAM,CAAS;IAEf;;OAEG;IAMH,MAAM,CAAS;IAEf;;OAEG;IAEH,IAAI,CAAsB;IAE1B;;;OAGG;IACH,YAAY,KAAuC;QAClD,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAA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KACb,CAAC;8BACM,eAAM;sDAAC;AAUf;IALC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;8BACM,eAAM;sDAAC;AAMf;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,wBAAU,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC;;oDAC9B;iCAxHd,sBAAsB;IADlC,IAAA,gBAAM,EAAC,mBAAmB,CAAC;;GACf,sBAAsB,CAsKlC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Asset, PriorityType, Person } from '@driveup/common';
|
|
2
|
+
import { Activity, StatusType, Ticket, TicketType } from '@driveup/common';
|
|
3
|
+
import { UserEntity } from './user.entity';
|
|
4
|
+
import { TrackableEntity } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Represents a support ticket created by or for a user.
|
|
7
|
+
* Tickets track customer support requests, account recovery, and other issues.
|
|
8
|
+
* Each ticket has a type, priority, status, and can include attachments.
|
|
9
|
+
*
|
|
10
|
+
* @extends TrackableEntity
|
|
11
|
+
*/
|
|
12
|
+
export declare class UserTicketEntity extends TrackableEntity<Ticket> {
|
|
13
|
+
/**
|
|
14
|
+
* Reference to the user who created or is associated with this ticket
|
|
15
|
+
* Nullable for guest tickets
|
|
16
|
+
*/
|
|
17
|
+
userId: number;
|
|
18
|
+
/**
|
|
19
|
+
* Type of ticket (Recovery, Support, Bug, etc.)
|
|
20
|
+
* @default TicketType.Recovery
|
|
21
|
+
*/
|
|
22
|
+
type: TicketType;
|
|
23
|
+
/**
|
|
24
|
+
* Priority level (Low, Medium, High, Urgent)
|
|
25
|
+
* @default PriorityType.Low
|
|
26
|
+
*/
|
|
27
|
+
priority: PriorityType;
|
|
28
|
+
/**
|
|
29
|
+
* Current status of the ticket
|
|
30
|
+
* @default StatusType.Pending
|
|
31
|
+
*/
|
|
32
|
+
status: StatusType;
|
|
33
|
+
/**
|
|
34
|
+
* Ticket title or subject
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* Detailed description of the issue or request
|
|
39
|
+
*/
|
|
40
|
+
description: string;
|
|
41
|
+
/**
|
|
42
|
+
* Contact information for guest tickets (when userId is null)
|
|
43
|
+
*/
|
|
44
|
+
person: Person;
|
|
45
|
+
/**
|
|
46
|
+
* Files or images attached to the ticket
|
|
47
|
+
*/
|
|
48
|
+
attachments: Asset[];
|
|
49
|
+
/**
|
|
50
|
+
* ID of the staff member who completed the ticket
|
|
51
|
+
*/
|
|
52
|
+
completedBy: number;
|
|
53
|
+
/**
|
|
54
|
+
* Timestamp when the ticket was completed
|
|
55
|
+
*/
|
|
56
|
+
completedOn: Date;
|
|
57
|
+
/**
|
|
58
|
+
* ID of the staff member who canceled the ticket
|
|
59
|
+
*/
|
|
60
|
+
canceledBy: number;
|
|
61
|
+
/**
|
|
62
|
+
* Timestamp when the ticket was canceled
|
|
63
|
+
*/
|
|
64
|
+
canceledOn: Date;
|
|
65
|
+
/**
|
|
66
|
+
* Reference to the user (if not a guest ticket)
|
|
67
|
+
*/
|
|
68
|
+
user: Promise<UserEntity>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates an instance of UserTicketEntity
|
|
71
|
+
* @param props - Partial properties to initialize the entity
|
|
72
|
+
*/
|
|
73
|
+
constructor(props?: Partial<UserTicketEntity>);
|
|
74
|
+
/**
|
|
75
|
+
* Converts the entity to a Ticket model instance
|
|
76
|
+
* @returns Promise resolving to Ticket model
|
|
77
|
+
*/
|
|
78
|
+
toModel(): Promise<Ticket>;
|
|
79
|
+
/**
|
|
80
|
+
* Converts the entity to a Ticket model instance
|
|
81
|
+
* @returns Promise resolving to Ticket model
|
|
82
|
+
*/
|
|
83
|
+
toSummary(): Promise<Ticket>;
|
|
84
|
+
getActivities(): Promise<Activity[]>;
|
|
85
|
+
}
|