@driveup/schema 0.2.3 → 0.2.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/lib/catalog/addon/addon.entity.js +4 -8
- package/lib/catalog/addon/addon.entity.js.map +1 -1
- package/lib/catalog/addon/country.entity.d.ts +2 -2
- package/lib/catalog/addon/country.entity.js +6 -10
- package/lib/catalog/addon/country.entity.js.map +1 -1
- package/lib/catalog/priceplan/priceplan.entity.js +2 -4
- package/lib/catalog/priceplan/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/country.entity.js +4 -8
- package/lib/catalog/product/country.entity.js.map +1 -1
- package/lib/catalog/product/priceplan.entity.js +4 -8
- package/lib/catalog/product/priceplan.entity.js.map +1 -1
- package/lib/catalog/product/product.entity.js +4 -8
- package/lib/catalog/product/product.entity.js.map +1 -1
- package/lib/catalog/program/program.entity.js +4 -8
- package/lib/catalog/program/program.entity.js.map +1 -1
- package/lib/catalog/seed/assets/asset.entity.js +2 -4
- package/lib/catalog/seed/assets/asset.entity.js.map +1 -1
- package/lib/catalog/seed/courses/course.entity.js +2 -4
- package/lib/catalog/seed/courses/course.entity.js.map +1 -1
- package/lib/catalog/seed/courses/lesson.entity.js +2 -4
- package/lib/catalog/seed/courses/lesson.entity.js.map +1 -1
- package/lib/catalog/seed/courses/topic.entity.js +2 -4
- package/lib/catalog/seed/courses/topic.entity.js.map +1 -1
- package/lib/catalog/seed/expense/category.entity.js +2 -4
- package/lib/catalog/seed/expense/category.entity.js.map +1 -1
- package/lib/profile/agent/agent.entity.d.ts +2 -4
- package/lib/profile/agent/agent.entity.js +8 -12
- package/lib/profile/agent/agent.entity.js.map +1 -1
- package/lib/profile/agent/payout.entity.js +2 -4
- package/lib/profile/agent/payout.entity.js.map +1 -1
- package/lib/profile/agent/promotion.entity.js +2 -4
- package/lib/profile/agent/promotion.entity.js.map +1 -1
- package/lib/profile/company/company.entity.d.ts +5 -3
- package/lib/profile/company/company.entity.js +17 -12
- package/lib/profile/company/company.entity.js.map +1 -1
- package/lib/profile/company/course/appointment.entity.d.ts +96 -6
- package/lib/profile/company/course/appointment.entity.js +336 -29
- package/lib/profile/company/course/appointment.entity.js.map +1 -1
- package/lib/profile/company/course/course.entity.d.ts +5 -3
- package/lib/profile/company/course/course.entity.js +21 -28
- package/lib/profile/company/course/course.entity.js.map +1 -1
- package/lib/profile/company/course/lesson.entity.d.ts +11 -3
- package/lib/profile/company/course/lesson.entity.js +41 -10
- package/lib/profile/company/course/lesson.entity.js.map +1 -1
- package/lib/profile/company/course/topic.entity.d.ts +7 -0
- package/lib/profile/company/course/topic.entity.js +35 -6
- package/lib/profile/company/course/topic.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/bill.entity.js +2 -4
- package/lib/profile/company/finances/billing/bill.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/item.entity.d.ts +2 -2
- package/lib/profile/company/finances/billing/item.entity.js +3 -5
- package/lib/profile/company/finances/billing/item.entity.js.map +1 -1
- package/lib/profile/company/finances/billing/transaction.entity.js +3 -3
- package/lib/profile/company/finances/billing/transaction.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/category.entity.js +2 -4
- package/lib/profile/company/finances/expense/category.entity.js.map +1 -1
- package/lib/profile/company/finances/expense/expense.entity.js +4 -8
- package/lib/profile/company/finances/expense/expense.entity.js.map +1 -1
- package/lib/profile/company/finances/handover/handover.entity.js +1 -2
- package/lib/profile/company/finances/handover/handover.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/invoice.entity.js +5 -10
- package/lib/profile/company/finances/invoice/invoice.entity.js.map +1 -1
- package/lib/profile/company/finances/invoice/item.entity.js +2 -4
- package/lib/profile/company/finances/invoice/item.entity.js.map +1 -1
- package/lib/profile/company/finances/payment/method.entity.js +2 -4
- package/lib/profile/company/finances/payment/method.entity.js.map +1 -1
- package/lib/profile/company/instructor/activity.entity.d.ts +11 -1
- package/lib/profile/company/instructor/activity.entity.js +14 -0
- package/lib/profile/company/instructor/activity.entity.js.map +1 -1
- package/lib/profile/company/instructor/instructor.entity.d.ts +6 -7
- package/lib/profile/company/instructor/instructor.entity.js +26 -20
- package/lib/profile/company/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/company/instructor/task.entity.js +2 -4
- package/lib/profile/company/instructor/task.entity.js.map +1 -1
- package/lib/profile/company/medical/examination.entity.js +2 -4
- package/lib/profile/company/medical/examination.entity.js.map +1 -1
- package/lib/profile/company/medical/product.entity.js +2 -4
- package/lib/profile/company/medical/product.entity.js.map +1 -1
- package/lib/profile/company/product/addon.entity.d.ts +7 -8
- package/lib/profile/company/product/addon.entity.js +41 -38
- package/lib/profile/company/product/addon.entity.js.map +1 -1
- package/lib/profile/company/product/priceplan.entity.js +2 -4
- package/lib/profile/company/product/priceplan.entity.js.map +1 -1
- package/lib/profile/company/product/product.entity.d.ts +9 -3
- package/lib/profile/company/product/product.entity.js +29 -13
- package/lib/profile/company/product/product.entity.js.map +1 -1
- package/lib/profile/company/product/vehicle.entity.js +2 -4
- package/lib/profile/company/product/vehicle.entity.js.map +1 -1
- package/lib/profile/instructor/instructor.entity.d.ts +2 -4
- package/lib/profile/instructor/instructor.entity.js +8 -12
- package/lib/profile/instructor/instructor.entity.js.map +1 -1
- package/lib/profile/student/program/licence/licence.entity.js +2 -4
- package/lib/profile/student/program/licence/licence.entity.js.map +1 -1
- package/lib/profile/student/program/medical/certificate.entity.js +2 -4
- package/lib/profile/student/program/medical/certificate.entity.js.map +1 -1
- package/lib/profile/student/program/medical/examination.entity.js +2 -4
- package/lib/profile/student/program/medical/examination.entity.js.map +1 -1
- package/lib/profile/student/program/program.entity.js +6 -5
- package/lib/profile/student/program/program.entity.js.map +1 -1
- package/lib/profile/student/program/training/appointment.entity.d.ts +12 -8
- package/lib/profile/student/program/training/appointment.entity.js +21 -9
- package/lib/profile/student/program/training/appointment.entity.js.map +1 -1
- package/lib/profile/student/program/training/exam.entity.js +2 -4
- package/lib/profile/student/program/training/exam.entity.js.map +1 -1
- package/lib/profile/student/program/training/lesson.entity.js +2 -4
- package/lib/profile/student/program/training/lesson.entity.js.map +1 -1
- package/lib/profile/student/program/training/request.entity.js +4 -8
- package/lib/profile/student/program/training/request.entity.js.map +1 -1
- package/lib/profile/student/program/training/topic.entity.js +3 -6
- package/lib/profile/student/program/training/topic.entity.js.map +1 -1
- package/lib/profile/student/program/training/training.entity.d.ts +13 -1
- package/lib/profile/student/program/training/training.entity.js +27 -14
- package/lib/profile/student/program/training/training.entity.js.map +1 -1
- package/lib/profile/student/program/training/transaction.entity.js +2 -4
- package/lib/profile/student/program/training/transaction.entity.js.map +1 -1
- package/lib/profile/student/student.entity.d.ts +15 -4
- package/lib/profile/student/student.entity.js +44 -12
- package/lib/profile/student/student.entity.js.map +1 -1
- package/lib/system/campaign/campaign.entity.js +2 -4
- package/lib/system/campaign/campaign.entity.js.map +1 -1
- package/lib/system/campaign/gifcode.entity.d.ts +1 -1
- package/lib/system/campaign/gifcode.entity.js +4 -6
- package/lib/system/campaign/gifcode.entity.js.map +1 -1
- package/lib/system/country/country.entity.js +4 -8
- package/lib/system/country/country.entity.js.map +1 -1
- package/lib/system/currency/currency.entity.js +2 -4
- package/lib/system/currency/currency.entity.js.map +1 -1
- package/lib/system/driving/category.entity.js +4 -8
- package/lib/system/driving/category.entity.js.map +1 -1
- package/lib/system/driving/vehicle.entity.js +2 -4
- package/lib/system/driving/vehicle.entity.js.map +1 -1
- package/lib/system/event/event.entity.js +3 -4
- package/lib/system/event/event.entity.js.map +1 -1
- package/lib/system/event/log.entity.d.ts +12 -12
- package/lib/system/event/log.entity.js +12 -12
- package/lib/system/event/log.entity.js.map +1 -1
- package/lib/system/policy/policy.entity.js +4 -8
- package/lib/system/policy/policy.entity.js.map +1 -1
- package/lib/system/staff/staff.entity.js +2 -4
- package/lib/system/staff/staff.entity.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/user/alert.entity.js +4 -5
- package/lib/user/alert.entity.js.map +1 -1
- package/lib/user/blocked.entity.js +1 -4
- package/lib/user/blocked.entity.js.map +1 -1
- package/lib/user/device.entity.js +2 -4
- package/lib/user/device.entity.js.map +1 -1
- package/lib/user/notification.entity.js +2 -4
- package/lib/user/notification.entity.js.map +1 -1
- package/lib/user/ticket.entity.js +4 -8
- package/lib/user/ticket.entity.js.map +1 -1
- package/lib/user/user.entity.d.ts +0 -4
- package/lib/user/user.entity.js +2 -12
- package/lib/user/user.entity.js.map +1 -1
- package/lib/user/verification.entity.js +2 -4
- package/lib/user/verification.entity.js.map +1 -1
- package/lib/utils/activity.helper.d.ts +1 -1
- package/lib/utils/activity.helper.js +9 -9
- package/lib/utils/activity.helper.js.map +1 -1
- package/package.json +6 -6
- package/lib/profile/student/program/medical/examination.model.d.ts +0 -63
- package/lib/profile/student/program/medical/examination.model.js +0 -158
- package/lib/profile/student/program/medical/examination.model.js.map +0 -1
- package/lib/system/campaigne/campaign.entity.d.ts +0 -69
- package/lib/system/campaigne/campaign.entity.js +0 -153
- package/lib/system/campaigne/campaign.entity.js.map +0 -1
- package/lib/system/campaigne/gifcode.entity.d.ts +0 -54
- package/lib/system/campaigne/gifcode.entity.js +0 -102
- package/lib/system/campaigne/gifcode.entity.js.map +0 -1
- package/lib/system/event/business.entity.d.ts +0 -75
- package/lib/system/event/business.entity.js +0 -128
- package/lib/system/event/business.entity.js.map +0 -1
- package/lib/utils/index.d.ts +0 -4
- package/lib/utils/index.js +0 -21
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/json-metrics.transform.d.ts +0 -35
- package/lib/utils/json-metrics.transform.js +0 -83
- package/lib/utils/json-metrics.transform.js.map +0 -1
- package/lib/utils/trackable.entity.d.ts +0 -82
- package/lib/utils/trackable.entity.js +0 -69
- package/lib/utils/trackable.entity.js.map +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Activity, Campaigne, Content, Language } from '@driveup/common';
|
|
2
|
-
import { ProductType } from '@driveup/common';
|
|
3
|
-
import { CampaigneGiftCodeEntity } from './gifcode.entity';
|
|
4
|
-
import { TrackableEntity } from '../../utils/trackable';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a marketing campaign in the system.
|
|
7
|
-
* Campaigns offer promotional discounts through gift codes that users can redeem.
|
|
8
|
-
* Each campaign targets specific products and has an expiration date.
|
|
9
|
-
* Gift amounts are credited to the user's product wallet upon redemption.
|
|
10
|
-
*
|
|
11
|
-
* @extends TrackableEntity
|
|
12
|
-
*/
|
|
13
|
-
export declare class CampaigneEntity extends TrackableEntity<Campaigne> {
|
|
14
|
-
/**
|
|
15
|
-
* Product types this campaign applies to
|
|
16
|
-
* @default []
|
|
17
|
-
*/
|
|
18
|
-
products: ProductType[];
|
|
19
|
-
/**
|
|
20
|
-
* Localized content for the campaign (title, description, etc.)
|
|
21
|
-
*/
|
|
22
|
-
translations: Content[];
|
|
23
|
-
/**
|
|
24
|
-
* URL to the campaign's promotional image
|
|
25
|
-
*/
|
|
26
|
-
imageUrl: string;
|
|
27
|
-
/**
|
|
28
|
-
* Campaign discount amount
|
|
29
|
-
* This amount will be stored on product credit
|
|
30
|
-
*/
|
|
31
|
-
giftAmount: number;
|
|
32
|
-
/**
|
|
33
|
-
* Campaign expiration date - after this date, codes cannot be redeemed
|
|
34
|
-
*/
|
|
35
|
-
exipryDate: Date;
|
|
36
|
-
/**
|
|
37
|
-
* Gift codes associated with this campaign
|
|
38
|
-
*/
|
|
39
|
-
giftCodes: Promise<CampaigneGiftCodeEntity[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a new CampaignEntity instance
|
|
42
|
-
* @param props - Partial properties to initialize the entity
|
|
43
|
-
*/
|
|
44
|
-
constructor(props?: Partial<CampaigneEntity>);
|
|
45
|
-
/**
|
|
46
|
-
* Converts the entity to a Campaigne model instance
|
|
47
|
-
* @param lang - Optional language for translations
|
|
48
|
-
* @returns Campaigne model with localized content
|
|
49
|
-
*/
|
|
50
|
-
toModel(lang?: Language): Campaigne;
|
|
51
|
-
toSummary(lang?: Language): Campaigne;
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves all gift codes for this campaign
|
|
54
|
-
* @returns Promise resolving to array of GiftCode models
|
|
55
|
-
*/
|
|
56
|
-
getCodes(): Promise<import("@driveup/common").GiftCode[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Gets the localized translation for the campaign
|
|
59
|
-
* @param lang - Optional language code; defaults to current i18n context
|
|
60
|
-
* @returns Content instance with translated title and description
|
|
61
|
-
*/
|
|
62
|
-
getTranslation(lang?: Language): Content;
|
|
63
|
-
/**
|
|
64
|
-
* Gets all available translations for the campaign
|
|
65
|
-
* @returns Array of Content instances for all languages
|
|
66
|
-
*/
|
|
67
|
-
getTranslations(): Content[];
|
|
68
|
-
getActivities(): Promise<Activity[]>;
|
|
69
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
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.CampaigneEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
15
|
-
const common_1 = require("@driveup/common");
|
|
16
|
-
const common_2 = require("@driveup/common");
|
|
17
|
-
const gifcode_entity_1 = require("./gifcode.entity");
|
|
18
|
-
const staff_entity_1 = require("../staff/staff.entity");
|
|
19
|
-
const trackable_1 = require("../../utils/trackable");
|
|
20
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
21
|
-
/**
|
|
22
|
-
* Represents a marketing campaign in the system.
|
|
23
|
-
* Campaigns offer promotional discounts through gift codes that users can redeem.
|
|
24
|
-
* Each campaign targets specific products and has an expiration date.
|
|
25
|
-
* Gift amounts are credited to the user's product wallet upon redemption.
|
|
26
|
-
*
|
|
27
|
-
* @extends TrackableEntity
|
|
28
|
-
*/
|
|
29
|
-
let CampaigneEntity = class CampaigneEntity extends trackable_1.TrackableEntity {
|
|
30
|
-
/**
|
|
31
|
-
* Creates a new CampaignEntity instance
|
|
32
|
-
* @param props - Partial properties to initialize the entity
|
|
33
|
-
*/
|
|
34
|
-
constructor(props) {
|
|
35
|
-
super();
|
|
36
|
-
Object.assign(this, props);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Converts the entity to a Campaigne model instance
|
|
40
|
-
* @param lang - Optional language for translations
|
|
41
|
-
* @returns Campaigne model with localized content
|
|
42
|
-
*/
|
|
43
|
-
toModel(lang) {
|
|
44
|
-
const transaltion = this.getTranslation(lang);
|
|
45
|
-
return new common_1.Campaigne({
|
|
46
|
-
id: this.id,
|
|
47
|
-
title: transaltion.title,
|
|
48
|
-
description: transaltion.description,
|
|
49
|
-
giftAmount: this.giftAmount,
|
|
50
|
-
imageUrl: transaltion.imageUrl || this.imageUrl,
|
|
51
|
-
exipryDate: this.exipryDate,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
toSummary(lang) {
|
|
55
|
-
return this.toModel(lang);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves all gift codes for this campaign
|
|
59
|
-
* @returns Promise resolving to array of GiftCode models
|
|
60
|
-
*/
|
|
61
|
-
async getCodes() {
|
|
62
|
-
return await Promise.all((await this.giftCodes).map(async (codeEntity) => codeEntity.toModel()));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Gets the localized translation for the campaign
|
|
66
|
-
* @param lang - Optional language code; defaults to current i18n context
|
|
67
|
-
* @returns Content instance with translated title and description
|
|
68
|
-
*/
|
|
69
|
-
getTranslation(lang) {
|
|
70
|
-
const language = lang || nestjs_i18n_1.I18nContext.current()?.lang;
|
|
71
|
-
const translation = this.translations?.find(t => t.language === language);
|
|
72
|
-
return new common_1.Content({
|
|
73
|
-
title: translation?.title,
|
|
74
|
-
description: translation?.description,
|
|
75
|
-
content: translation?.content,
|
|
76
|
-
imageUrl: translation?.imageUrl,
|
|
77
|
-
link: translation?.link,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Gets all available translations for the campaign
|
|
82
|
-
* @returns Array of Content instances for all languages
|
|
83
|
-
*/
|
|
84
|
-
getTranslations() {
|
|
85
|
-
return this.translations?.map(t => new common_1.Content({
|
|
86
|
-
title: t.title,
|
|
87
|
-
description: t.description,
|
|
88
|
-
content: t.content,
|
|
89
|
-
imageUrl: t.imageUrl,
|
|
90
|
-
link: t.link,
|
|
91
|
-
language: t.language
|
|
92
|
-
}));
|
|
93
|
-
}
|
|
94
|
-
async getActivities() {
|
|
95
|
-
const activities = [];
|
|
96
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
97
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
98
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy, staff_entity_1.StaffEntity));
|
|
99
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
100
|
-
return activities.filter(a => a);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
exports.CampaigneEntity = CampaigneEntity;
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, typeorm_1.Column)({
|
|
106
|
-
type: 'set',
|
|
107
|
-
enum: common_2.ProductType,
|
|
108
|
-
default: [],
|
|
109
|
-
nullable: false
|
|
110
|
-
}),
|
|
111
|
-
__metadata("design:type", Array)
|
|
112
|
-
], CampaigneEntity.prototype, "products", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
(0, typeorm_1.Column)({
|
|
115
|
-
type: 'simple-json',
|
|
116
|
-
nullable: true,
|
|
117
|
-
default: null
|
|
118
|
-
}),
|
|
119
|
-
__metadata("design:type", Array)
|
|
120
|
-
], CampaigneEntity.prototype, "translations", void 0);
|
|
121
|
-
__decorate([
|
|
122
|
-
(0, typeorm_1.Column)({
|
|
123
|
-
nullable: true,
|
|
124
|
-
default: null
|
|
125
|
-
}),
|
|
126
|
-
__metadata("design:type", String)
|
|
127
|
-
], CampaigneEntity.prototype, "imageUrl", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
(0, typeorm_1.Column)({
|
|
130
|
-
type: 'decimal',
|
|
131
|
-
precision: 10,
|
|
132
|
-
scale: 2,
|
|
133
|
-
nullable: false,
|
|
134
|
-
default: 0
|
|
135
|
-
}),
|
|
136
|
-
__metadata("design:type", Number)
|
|
137
|
-
], CampaigneEntity.prototype, "giftAmount", void 0);
|
|
138
|
-
__decorate([
|
|
139
|
-
(0, typeorm_1.Column)({
|
|
140
|
-
nullable: true,
|
|
141
|
-
default: null
|
|
142
|
-
}),
|
|
143
|
-
__metadata("design:type", Date)
|
|
144
|
-
], CampaigneEntity.prototype, "exipryDate", void 0);
|
|
145
|
-
__decorate([
|
|
146
|
-
(0, typeorm_1.OneToMany)(() => gifcode_entity_1.CampaigneGiftCodeEntity, giftCode => giftCode.campaign),
|
|
147
|
-
__metadata("design:type", Promise)
|
|
148
|
-
], CampaigneEntity.prototype, "giftCodes", void 0);
|
|
149
|
-
exports.CampaigneEntity = CampaigneEntity = __decorate([
|
|
150
|
-
(0, typeorm_1.Entity)('systemCampaigns'),
|
|
151
|
-
__metadata("design:paramtypes", [Object])
|
|
152
|
-
], CampaigneEntity);
|
|
153
|
-
//# sourceMappingURL=campaign.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"campaign.entity.js","sourceRoot":"","sources":["../../../src/system/campaigne/campaign.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAoD;AACpD,6CAA0C;AAC1C,4CAAuF;AACvF,4CAA8C;AAC9C,qDAA2D;AAC3D,wDAAoD;AACpD,qDAAwD;AACxD,iEAAyD;AAEzD;;;;;;;GAOG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAA0B;IA6D9D;;;OAGG;IACH,YAAY,KAAgC;QAC3C,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAe;QACtB,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,IAAI,kBAAS,CAAC;YACpB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,QAAQ,EAAE,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;YAC/C,UAAU,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,IAAe;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACb,OAAO,MAAM,OAAO,CAAC,GAAG,CACvB,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,EAAC,UAAU,EAAC,EAAE,CAAC,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|
1
|
-
import { Activity, GiftCode, ProfileType } from '@driveup/common';
|
|
2
|
-
import { CampaigneEntity } from './campaign.entity';
|
|
3
|
-
import { TrackableEntity } from '../../utils/trackable';
|
|
4
|
-
/**
|
|
5
|
-
* Campaign gift code entity representing promotional codes for campaigns.
|
|
6
|
-
* Extends TrackableEntity to track creation and update information.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CampaigneGiftCodeEntity extends TrackableEntity<GiftCode> {
|
|
9
|
-
/**
|
|
10
|
-
* The ID of the campaign this gift code belongs to
|
|
11
|
-
*/
|
|
12
|
-
campaignId: number;
|
|
13
|
-
/**
|
|
14
|
-
* Unique 8-character gift code
|
|
15
|
-
*/
|
|
16
|
-
code: string;
|
|
17
|
-
/**
|
|
18
|
-
* Profile type that can use this gift code (Company, Student, Agent)
|
|
19
|
-
*/
|
|
20
|
-
profile: ProfileType;
|
|
21
|
-
/**
|
|
22
|
-
* ID of the user who registered/used this gift code
|
|
23
|
-
*/
|
|
24
|
-
registredBy: number;
|
|
25
|
-
/**
|
|
26
|
-
* Timestamp when this gift code was registered/used
|
|
27
|
-
*/
|
|
28
|
-
registredOn: Date;
|
|
29
|
-
/**
|
|
30
|
-
* The campaign associated with this gift code
|
|
31
|
-
*/
|
|
32
|
-
campaign: CampaigneEntity;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a new CampaigneGiftCodeEntity instance
|
|
35
|
-
* @param props - Partial properties to initialize the entity with
|
|
36
|
-
*/
|
|
37
|
-
constructor(props?: Partial<CampaigneGiftCodeEntity>);
|
|
38
|
-
/**
|
|
39
|
-
* Converts the entity to a GiftCode model instance
|
|
40
|
-
* @returns GiftCode model with basic gift code information
|
|
41
|
-
*/
|
|
42
|
-
toModel(): GiftCode;
|
|
43
|
-
/**
|
|
44
|
-
* Returns a summary representation of the gift code
|
|
45
|
-
* @returns GiftCode model instance (same as toModel())
|
|
46
|
-
*/
|
|
47
|
-
toSummary(): GiftCode;
|
|
48
|
-
/**
|
|
49
|
-
* Retrieves all tracked activities for this gift code
|
|
50
|
-
* Includes creation, registration timestamps and associated staff members
|
|
51
|
-
* @returns Array of Activity objects
|
|
52
|
-
*/
|
|
53
|
-
getActivities(): Promise<Activity[]>;
|
|
54
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
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.CampaigneGiftCodeEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const common_1 = require("@driveup/common");
|
|
15
|
-
const campaign_entity_1 = require("./campaign.entity");
|
|
16
|
-
const staff_entity_1 = require("../staff/staff.entity");
|
|
17
|
-
const trackable_1 = require("../../utils/trackable");
|
|
18
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
19
|
-
/**
|
|
20
|
-
* Campaign gift code entity representing promotional codes for campaigns.
|
|
21
|
-
* Extends TrackableEntity to track creation and update information.
|
|
22
|
-
*/
|
|
23
|
-
let CampaigneGiftCodeEntity = class CampaigneGiftCodeEntity extends trackable_1.TrackableEntity {
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new CampaigneGiftCodeEntity instance
|
|
26
|
-
* @param props - Partial properties to initialize the entity with
|
|
27
|
-
*/
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super();
|
|
30
|
-
Object.assign(this, props);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Converts the entity to a GiftCode model instance
|
|
34
|
-
* @returns GiftCode model with basic gift code information
|
|
35
|
-
*/
|
|
36
|
-
toModel() {
|
|
37
|
-
return new common_1.GiftCode({
|
|
38
|
-
id: this.id,
|
|
39
|
-
code: this.code,
|
|
40
|
-
profile: this.profile
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Returns a summary representation of the gift code
|
|
45
|
-
* @returns GiftCode model instance (same as toModel())
|
|
46
|
-
*/
|
|
47
|
-
toSummary() {
|
|
48
|
-
return this.toModel();
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Retrieves all tracked activities for this gift code
|
|
52
|
-
* Includes creation, registration timestamps and associated staff members
|
|
53
|
-
* @returns Array of Activity objects
|
|
54
|
-
*/
|
|
55
|
-
async getActivities() {
|
|
56
|
-
const activities = [];
|
|
57
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy, staff_entity_1.StaffEntity));
|
|
58
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
59
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.registredBy, common_1.ActivityType.registredBy));
|
|
60
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.registredOn, common_1.ActivityType.registredOn));
|
|
61
|
-
return activities;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
exports.CampaigneGiftCodeEntity = CampaigneGiftCodeEntity;
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, typeorm_1.Column)(),
|
|
67
|
-
__metadata("design:type", Number)
|
|
68
|
-
], CampaigneGiftCodeEntity.prototype, "campaignId", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, typeorm_1.Column)({
|
|
71
|
-
nullable: false,
|
|
72
|
-
unique: true,
|
|
73
|
-
length: 8
|
|
74
|
-
}),
|
|
75
|
-
__metadata("design:type", String)
|
|
76
|
-
], CampaigneGiftCodeEntity.prototype, "code", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, typeorm_1.Column)({
|
|
79
|
-
type: 'enum',
|
|
80
|
-
enum: common_1.ProfileType,
|
|
81
|
-
default: common_1.ProfileType.Company,
|
|
82
|
-
nullable: true,
|
|
83
|
-
}),
|
|
84
|
-
__metadata("design:type", String)
|
|
85
|
-
], CampaigneGiftCodeEntity.prototype, "profile", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
88
|
-
__metadata("design:type", Number)
|
|
89
|
-
], CampaigneGiftCodeEntity.prototype, "registredBy", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
92
|
-
__metadata("design:type", Date)
|
|
93
|
-
], CampaigneGiftCodeEntity.prototype, "registredOn", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
(0, typeorm_1.ManyToMany)(() => campaign_entity_1.CampaigneEntity, campaign => campaign.giftCodes),
|
|
96
|
-
__metadata("design:type", campaign_entity_1.CampaigneEntity)
|
|
97
|
-
], CampaigneGiftCodeEntity.prototype, "campaign", void 0);
|
|
98
|
-
exports.CampaigneGiftCodeEntity = CampaigneGiftCodeEntity = __decorate([
|
|
99
|
-
(0, typeorm_1.Entity)('systemCampaigneGiftCodes'),
|
|
100
|
-
__metadata("design:paramtypes", [Object])
|
|
101
|
-
], CampaigneGiftCodeEntity);
|
|
102
|
-
//# sourceMappingURL=gifcode.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gifcode.entity.js","sourceRoot":"","sources":["../../../src/system/campaigne/gifcode.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAqD;AACrD,4CA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AQ,EAAE,KAAK;QACf,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,CAAC;KACT,CAAC;;qDACW;AAWb;IANC,IAAA,gBAAM,EAAC;QACP,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,oBAAW;QACjB,OAAO,EAAE,oBAAW,CAAC,OAAO;QAC5B,QAAQ,EAAE,IAAI;KACd,CAAC;;wDACmB;AAMrB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4DACtB;AAMpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC7B,IAAI;4DAAC;AAMlB;IADC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,iCAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;8BACxD,iCAAe;yDAAC;kCA7Cd,uBAAuB;IADnC,IAAA,gBAAM,EAAC,0BAA0B,CAAC;;GACtB,uBAAuB,CAyFnC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Activity, ColorContext, Content, NotificationChannel, ProfileType } from '@driveup/common';
|
|
2
|
-
import { TrackableEntity } from '../../utils/trackable';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a business event configuration in the system.
|
|
5
|
-
* Business events define system actions that can trigger notifications
|
|
6
|
-
* (e.g., account created, appointment scheduled, payment received).
|
|
7
|
-
* Each event can be configured with default preferences and notification channels.
|
|
8
|
-
*
|
|
9
|
-
* @extends TrackableEntity
|
|
10
|
-
*/
|
|
11
|
-
export declare class BusinessEvent extends TrackableEntity<BusinessEvent> {
|
|
12
|
-
/**
|
|
13
|
-
* Profile type that this event applies to
|
|
14
|
-
* @default ProfileType.Company
|
|
15
|
-
*/
|
|
16
|
-
scope: ProfileType;
|
|
17
|
-
/**
|
|
18
|
-
* This name is used to identify the event setting in the system.
|
|
19
|
-
* @description The event name should be unique and descriptive.
|
|
20
|
-
* @example 'user.account.closed'
|
|
21
|
-
* @see @driveup/common for a list of predefined event names.
|
|
22
|
-
*/
|
|
23
|
-
event: string;
|
|
24
|
-
/**
|
|
25
|
-
* Translations for the notification content.
|
|
26
|
-
* Exlain user what the notification is about in different languages.
|
|
27
|
-
*/
|
|
28
|
-
translations: Content[];
|
|
29
|
-
/**
|
|
30
|
-
* Color context for the notification.
|
|
31
|
-
* @type {Context}
|
|
32
|
-
* @default Context.Info
|
|
33
|
-
*/
|
|
34
|
-
color: ColorContext;
|
|
35
|
-
/**
|
|
36
|
-
* Notification channel
|
|
37
|
-
* @type {NotificationChannel}
|
|
38
|
-
* @default NotificationChannel.App
|
|
39
|
-
*/
|
|
40
|
-
channel: NotificationChannel;
|
|
41
|
-
/**
|
|
42
|
-
* Indicates if the notification setting is enabled by default.
|
|
43
|
-
* This is used to set the initial preference for users.
|
|
44
|
-
* If true, users will have this notification setting enabled by default.
|
|
45
|
-
* @default true
|
|
46
|
-
*/
|
|
47
|
-
isPrefered: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Sort order for the notification setting.
|
|
50
|
-
* This can be used to order the settings in the user interface.
|
|
51
|
-
* Lower numbers appear first.
|
|
52
|
-
* @default null
|
|
53
|
-
*/
|
|
54
|
-
sort: number;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a new BusinessEvent instance
|
|
57
|
-
* @param props - Partial properties to initialize the entity
|
|
58
|
-
*/
|
|
59
|
-
constructor(props?: Partial<BusinessEvent>);
|
|
60
|
-
/**
|
|
61
|
-
* Converts the entity to a BusinessEvent model instance
|
|
62
|
-
* @returns BusinessEvent model with all business event properties
|
|
63
|
-
*/
|
|
64
|
-
toModel(): BusinessEvent;
|
|
65
|
-
/**
|
|
66
|
-
* Returns a summary representation of the business event
|
|
67
|
-
* @returns BusinessEvent model instance (same as toModel())
|
|
68
|
-
*/
|
|
69
|
-
toSummary(): BusinessEvent;
|
|
70
|
-
/**
|
|
71
|
-
* Retrieves activity history for this business event
|
|
72
|
-
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
73
|
-
*/
|
|
74
|
-
getActivities(): Promise<Activity[]>;
|
|
75
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
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
|
-
var BusinessEvent_1;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.BusinessEvent = void 0;
|
|
14
|
-
const typeorm_1 = require("typeorm");
|
|
15
|
-
const common_1 = require("@driveup/common");
|
|
16
|
-
const trackable_1 = require("../../utils/trackable");
|
|
17
|
-
const activity_helper_1 = require("../../utils/activity.helper");
|
|
18
|
-
/**
|
|
19
|
-
* Represents a business event configuration in the system.
|
|
20
|
-
* Business events define system actions that can trigger notifications
|
|
21
|
-
* (e.g., account created, appointment scheduled, payment received).
|
|
22
|
-
* Each event can be configured with default preferences and notification channels.
|
|
23
|
-
*
|
|
24
|
-
* @extends TrackableEntity
|
|
25
|
-
*/
|
|
26
|
-
let BusinessEvent = BusinessEvent_1 = class BusinessEvent extends trackable_1.TrackableEntity {
|
|
27
|
-
/**
|
|
28
|
-
* Creates a new BusinessEvent instance
|
|
29
|
-
* @param props - Partial properties to initialize the entity
|
|
30
|
-
*/
|
|
31
|
-
constructor(props) {
|
|
32
|
-
super();
|
|
33
|
-
Object.assign(this, props);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Converts the entity to a BusinessEvent model instance
|
|
37
|
-
* @returns BusinessEvent model with all business event properties
|
|
38
|
-
*/
|
|
39
|
-
toModel() {
|
|
40
|
-
return new BusinessEvent_1({
|
|
41
|
-
id: this.id,
|
|
42
|
-
scope: this.scope,
|
|
43
|
-
event: this.event,
|
|
44
|
-
translations: this.translations,
|
|
45
|
-
color: this.color,
|
|
46
|
-
channel: this.channel,
|
|
47
|
-
isPrefered: this.isPrefered,
|
|
48
|
-
sort: this.sort
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns a summary representation of the business event
|
|
53
|
-
* @returns BusinessEvent model instance (same as toModel())
|
|
54
|
-
*/
|
|
55
|
-
toSummary() {
|
|
56
|
-
return this.toModel();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Retrieves activity history for this business event
|
|
60
|
-
* @returns Promise resolving to array of Activity instances tracking creation and updates
|
|
61
|
-
*/
|
|
62
|
-
async getActivities() {
|
|
63
|
-
const activities = [];
|
|
64
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdBy, common_1.ActivityType.createdBy));
|
|
65
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.createdOn, common_1.ActivityType.createdOn));
|
|
66
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedBy, common_1.ActivityType.updatedBy));
|
|
67
|
-
activities.push(await (0, activity_helper_1.toActivity)(this.updatedOn, common_1.ActivityType.updatedOn));
|
|
68
|
-
return activities.filter(a => a);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
exports.BusinessEvent = BusinessEvent;
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, typeorm_1.Column)({
|
|
74
|
-
type: 'enum',
|
|
75
|
-
enum: common_1.ProfileType,
|
|
76
|
-
default: common_1.ProfileType.Company,
|
|
77
|
-
nullable: true
|
|
78
|
-
}),
|
|
79
|
-
__metadata("design:type", String)
|
|
80
|
-
], BusinessEvent.prototype, "scope", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, typeorm_1.Column)({ unique: true }),
|
|
83
|
-
__metadata("design:type", String)
|
|
84
|
-
], BusinessEvent.prototype, "event", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
(0, typeorm_1.Column)({
|
|
87
|
-
type: 'simple-json',
|
|
88
|
-
nullable: true,
|
|
89
|
-
default: null
|
|
90
|
-
}),
|
|
91
|
-
__metadata("design:type", Array)
|
|
92
|
-
], BusinessEvent.prototype, "translations", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
(0, typeorm_1.Column)({
|
|
95
|
-
type: 'enum',
|
|
96
|
-
enum: common_1.ColorContext,
|
|
97
|
-
default: common_1.ColorContext.Info,
|
|
98
|
-
nullable: true
|
|
99
|
-
}),
|
|
100
|
-
__metadata("design:type", String)
|
|
101
|
-
], BusinessEvent.prototype, "color", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
(0, typeorm_1.Column)({
|
|
104
|
-
type: 'enum',
|
|
105
|
-
enum: common_1.NotificationChannel,
|
|
106
|
-
default: common_1.NotificationChannel.App
|
|
107
|
-
}),
|
|
108
|
-
__metadata("design:type", String)
|
|
109
|
-
], BusinessEvent.prototype, "channel", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
(0, typeorm_1.Column)({
|
|
112
|
-
nullable: false,
|
|
113
|
-
default: true
|
|
114
|
-
}),
|
|
115
|
-
__metadata("design:type", Boolean)
|
|
116
|
-
], BusinessEvent.prototype, "isPrefered", void 0);
|
|
117
|
-
__decorate([
|
|
118
|
-
(0, typeorm_1.Column)({
|
|
119
|
-
nullable: true,
|
|
120
|
-
default: null
|
|
121
|
-
}),
|
|
122
|
-
__metadata("design:type", Number)
|
|
123
|
-
], BusinessEvent.prototype, "sort", void 0);
|
|
124
|
-
exports.BusinessEvent = BusinessEvent = BusinessEvent_1 = __decorate([
|
|
125
|
-
(0, typeorm_1.Entity)('systemBusinessEvents'),
|
|
126
|
-
__metadata("design:paramtypes", [Object])
|
|
127
|
-
], BusinessEvent);
|
|
128
|
-
//# sourceMappingURL=business.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"business.entity.js","sourceRoot":"","sources":["../../../src/system/event/business.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAyC;AACzC,4CAAkH;AAClH,qDAAwD;AACxD,iEAAyD;AAEzD;;;;;;;GAOG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,2BAA8B;IAmFhE;;;OAGG;IACH,YAAY,KAA8B;QACzC,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,OAAO;QACN,OAAO,IAAI,eAAa,CAAC;YACxB,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,SAAS;QACR,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa;QAClB,MAAM,UAAU,GAAe,EAAE,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,MAAM,IAAA,4BAAU,EAAC,IAAI,CAAC,SAAS,EAAE,qBAAY,CAAC,SAAS,CAAC,CAAC,CAAC;Q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B;IAJC,IAAA,gBAAM,EAAC;QACP,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KACb,CAAC;;2CACW;wBAjFD,aAAa;IADzB,IAAA,gBAAM,EAAC,sBAAsB,CAAC;;GAClB,aAAa,CAiIzB"}
|
package/lib/utils/index.d.ts
DELETED
package/lib/utils/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./activity.helper"), exports);
|
|
18
|
-
__exportStar(require("./json-metrics.transform"), exports);
|
|
19
|
-
__exportStar(require("./numeric.transform"), exports);
|
|
20
|
-
__exportStar(require("./trackable"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,8CAA4B"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ValueTransformer } from 'typeorm';
|
|
2
|
-
/**
|
|
3
|
-
* TypeORM value transformer for JSON metrics columns.
|
|
4
|
-
* Converts metric values in JSON objects to numeric types, ensuring all values
|
|
5
|
-
* are valid numbers (defaulting to 0 for invalid or null values).
|
|
6
|
-
* Useful for database columns that store metrics as JSON key-value pairs.
|
|
7
|
-
*
|
|
8
|
-
* @implements {ValueTransformer}
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Column({
|
|
12
|
-
* type: 'json',
|
|
13
|
-
* transformer: new ColumnJsonMetricsTransformer()
|
|
14
|
-
* })
|
|
15
|
-
* metrics: Record<string, number>;
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class ColumnJsonMetricsTransformer implements ValueTransformer {
|
|
19
|
-
/**
|
|
20
|
-
* Transforms a JSON object before persisting to the database.
|
|
21
|
-
* Converts all values in the JSON object to numbers, defaulting to 0 for invalid values.
|
|
22
|
-
*
|
|
23
|
-
* @param json - The JSON object to transform
|
|
24
|
-
* @returns Transformed JSON object with numeric values, or null if input is null/undefined
|
|
25
|
-
*/
|
|
26
|
-
to(json?: Record<string, any> | null): Record<string, any> | null;
|
|
27
|
-
/**
|
|
28
|
-
* Transforms a JSON object when loading from the database.
|
|
29
|
-
* Converts all values in the JSON object to numbers, defaulting to 0 for invalid values.
|
|
30
|
-
*
|
|
31
|
-
* @param json - The JSON object loaded from the database
|
|
32
|
-
* @returns Transformed JSON object with numeric values, or null if input is null/undefined
|
|
33
|
-
*/
|
|
34
|
-
from(json?: Record<string, any> | null): Record<string, any> | null;
|
|
35
|
-
}
|