@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,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ColumnJsonMetricsTransformer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Type guard that checks if a value is null or undefined.
|
|
6
|
-
*
|
|
7
|
-
* @template T - The type of the value being checked
|
|
8
|
-
* @param obj - The value to check
|
|
9
|
-
* @returns True if the value is null or undefined, false otherwise
|
|
10
|
-
*/
|
|
11
|
-
function isNullOrUndefined(obj) {
|
|
12
|
-
return typeof obj === 'undefined' || obj === null;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* TypeORM value transformer for JSON metrics columns.
|
|
16
|
-
* Converts metric values in JSON objects to numeric types, ensuring all values
|
|
17
|
-
* are valid numbers (defaulting to 0 for invalid or null values).
|
|
18
|
-
* Useful for database columns that store metrics as JSON key-value pairs.
|
|
19
|
-
*
|
|
20
|
-
* @implements {ValueTransformer}
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* @Column({
|
|
24
|
-
* type: 'json',
|
|
25
|
-
* transformer: new ColumnJsonMetricsTransformer()
|
|
26
|
-
* })
|
|
27
|
-
* metrics: Record<string, number>;
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
class ColumnJsonMetricsTransformer {
|
|
31
|
-
/**
|
|
32
|
-
* Transforms a JSON object before persisting to the database.
|
|
33
|
-
* Converts all values in the JSON object to numbers, defaulting to 0 for invalid values.
|
|
34
|
-
*
|
|
35
|
-
* @param json - The JSON object to transform
|
|
36
|
-
* @returns Transformed JSON object with numeric values, or null if input is null/undefined
|
|
37
|
-
*/
|
|
38
|
-
to(json) {
|
|
39
|
-
if (!isNullOrUndefined(json)) {
|
|
40
|
-
for (const key in json) {
|
|
41
|
-
if (Object.prototype.hasOwnProperty.call(json, key)) {
|
|
42
|
-
const value = json[key];
|
|
43
|
-
if (!isNullOrUndefined(value)) {
|
|
44
|
-
const res = parseFloat(value);
|
|
45
|
-
json[key] = isNaN(res) ? 0 : res;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
json[key] = 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return json;
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Transforms a JSON object when loading from the database.
|
|
58
|
-
* Converts all values in the JSON object to numbers, defaulting to 0 for invalid values.
|
|
59
|
-
*
|
|
60
|
-
* @param json - The JSON object loaded from the database
|
|
61
|
-
* @returns Transformed JSON object with numeric values, or null if input is null/undefined
|
|
62
|
-
*/
|
|
63
|
-
from(json) {
|
|
64
|
-
if (!isNullOrUndefined(json)) {
|
|
65
|
-
for (const key in json) {
|
|
66
|
-
if (Object.prototype.hasOwnProperty.call(json, key)) {
|
|
67
|
-
const value = json[key];
|
|
68
|
-
if (!isNullOrUndefined(value)) {
|
|
69
|
-
const res = parseFloat(value);
|
|
70
|
-
json[key] = isNaN(res) ? 0 : res;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
json[key] = 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return json;
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.ColumnJsonMetricsTransformer = ColumnJsonMetricsTransformer;
|
|
83
|
-
//# sourceMappingURL=json-metrics.transform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-metrics.transform.js","sourceRoot":"","sources":["../../src/utils/json-metrics.transform.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAI,GAAyB;IACtD,OAAO,OAAO,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAa,4BAA4B;IACxC;;;;;;OAMG;IACH,EAAE,CAAC,IAAiC;QACnC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACxB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;oBACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;oBACxB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,KAAY,CAAC,CAAC;wBACrC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;oBAClC,CAAC;yBAAM,CAAC;wBACP,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBACf,CAAC;gBACF,CAAC;YACF,CAAC;YACD,OAAO,IAAW,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,IAAiC;QACrC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACxB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;oBACrD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;oBACxB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;wBAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,KAAY,CAAC,CAAC;wBACrC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;oBAClC,CAAC;yBAAM,CAAC;wBACP,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBACf,CAAC;gBACF,CAAC;YACF,CAAC;YACD,OAAO,IAAW,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAlDD,oEAkDC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Activity, Language } from '@driveup/common';
|
|
2
|
-
import { BaseEntity } from 'typeorm';
|
|
3
|
-
/**
|
|
4
|
-
* Abstract base entity with comprehensive audit tracking properties.
|
|
5
|
-
* Provides automatic tracking of creation, updates, and soft deletion with user attribution.
|
|
6
|
-
* All entities requiring an audit trail should extend this class.
|
|
7
|
-
*
|
|
8
|
-
* @template T - The model type that the entity converts to
|
|
9
|
-
* @extends BaseEntity
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* @Entity('users')
|
|
14
|
-
* export class UserEntity extends TrackableEntity<User> {
|
|
15
|
-
* // entity properties
|
|
16
|
-
*
|
|
17
|
-
* toModel() {
|
|
18
|
-
* return new User({ id: this.id, ... });
|
|
19
|
-
* }
|
|
20
|
-
*
|
|
21
|
-
* async getActivities() {
|
|
22
|
-
* return [];
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare abstract class TrackableEntity<T = any> extends BaseEntity {
|
|
28
|
-
/**
|
|
29
|
-
* Primary key - auto-generated sequential ID
|
|
30
|
-
*/
|
|
31
|
-
id: number;
|
|
32
|
-
/**
|
|
33
|
-
* ID of the user who created this entity
|
|
34
|
-
*/
|
|
35
|
-
createdBy: number;
|
|
36
|
-
/**
|
|
37
|
-
* Timestamp when the entity was created
|
|
38
|
-
* Automatically set by TypeORM
|
|
39
|
-
*/
|
|
40
|
-
createdOn: Date;
|
|
41
|
-
/**
|
|
42
|
-
* ID of the user who last updated this entity
|
|
43
|
-
*/
|
|
44
|
-
updatedBy: number;
|
|
45
|
-
/**
|
|
46
|
-
* Timestamp when the entity was last updated
|
|
47
|
-
* Automatically updated by TypeORM
|
|
48
|
-
*/
|
|
49
|
-
updatedOn: Date;
|
|
50
|
-
/**
|
|
51
|
-
* ID of the user who soft-deleted this entity
|
|
52
|
-
*/
|
|
53
|
-
deletedBy: number;
|
|
54
|
-
/**
|
|
55
|
-
* Timestamp when the entity was soft-deleted
|
|
56
|
-
* When set, the entity is excluded from normal queries
|
|
57
|
-
*/
|
|
58
|
-
deletedOn: Date;
|
|
59
|
-
/**
|
|
60
|
-
* Converts the entity to its corresponding model instance.
|
|
61
|
-
* Must be implemented by child classes to define transformation logic.
|
|
62
|
-
*
|
|
63
|
-
* @param lang - Optional language for localized content
|
|
64
|
-
* @returns Model instance or Promise resolving to model instance
|
|
65
|
-
*/
|
|
66
|
-
abstract toModel(lang?: Language): T | Promise<T>;
|
|
67
|
-
/**
|
|
68
|
-
* Converts the entity to a summary representation.
|
|
69
|
-
* Must be implemented by child classes to define summary transformation logic.
|
|
70
|
-
*
|
|
71
|
-
* @param lang - Optional language for localized content
|
|
72
|
-
* @returns Summary model instance or Promise resolving to summary model instance
|
|
73
|
-
*/
|
|
74
|
-
abstract toSummary(lang?: Language): T | Promise<T>;
|
|
75
|
-
/**
|
|
76
|
-
* Retrieves all activity records associated with this entity.
|
|
77
|
-
* Must be implemented by child classes to return their specific activity relations.
|
|
78
|
-
*
|
|
79
|
-
* @returns Promise resolving to array of Activity objects
|
|
80
|
-
*/
|
|
81
|
-
abstract getActivities(): Promise<Activity[]>;
|
|
82
|
-
}
|
|
@@ -1,69 +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.TrackableEntity = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
/**
|
|
15
|
-
* Abstract base entity with comprehensive audit tracking properties.
|
|
16
|
-
* Provides automatic tracking of creation, updates, and soft deletion with user attribution.
|
|
17
|
-
* All entities requiring an audit trail should extend this class.
|
|
18
|
-
*
|
|
19
|
-
* @template T - The model type that the entity converts to
|
|
20
|
-
* @extends BaseEntity
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* @Entity('users')
|
|
25
|
-
* export class UserEntity extends TrackableEntity<User> {
|
|
26
|
-
* // entity properties
|
|
27
|
-
*
|
|
28
|
-
* toModel() {
|
|
29
|
-
* return new User({ id: this.id, ... });
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* async getActivities() {
|
|
33
|
-
* return [];
|
|
34
|
-
* }
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
class TrackableEntity extends typeorm_1.BaseEntity {
|
|
39
|
-
}
|
|
40
|
-
exports.TrackableEntity = TrackableEntity;
|
|
41
|
-
__decorate([
|
|
42
|
-
(0, typeorm_1.PrimaryGeneratedColumn)(),
|
|
43
|
-
__metadata("design:type", Number)
|
|
44
|
-
], TrackableEntity.prototype, "id", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
47
|
-
__metadata("design:type", Number)
|
|
48
|
-
], TrackableEntity.prototype, "createdBy", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, typeorm_1.CreateDateColumn)({ nullable: true, default: null }),
|
|
51
|
-
__metadata("design:type", Date)
|
|
52
|
-
], TrackableEntity.prototype, "createdOn", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
55
|
-
__metadata("design:type", Number)
|
|
56
|
-
], TrackableEntity.prototype, "updatedBy", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
(0, typeorm_1.UpdateDateColumn)({ nullable: true, default: null }),
|
|
59
|
-
__metadata("design:type", Date)
|
|
60
|
-
], TrackableEntity.prototype, "updatedOn", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
(0, typeorm_1.Column)({ nullable: true, default: null }),
|
|
63
|
-
__metadata("design:type", Number)
|
|
64
|
-
], TrackableEntity.prototype, "deletedBy", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, typeorm_1.DeleteDateColumn)({ nullable: true, default: null }),
|
|
67
|
-
__metadata("design:type", Date)
|
|
68
|
-
], TrackableEntity.prototype, "deletedOn", void 0);
|
|
69
|
-
//# sourceMappingURL=trackable.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trackable.entity.js","sourceRoot":"","sources":["../../src/utils/trackable.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAA2H;AAE3H;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAsB,eAAuB,SAAQ,oBAAU;CAyE9D;AAzED,0CAyEC;AAnEA;IADC,IAAA,gCAAsB,GAAE;;2CACd;AAMX;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDACxB;AAOlB;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;kDAAC;AAMhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDACxB;AAOlB;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;kDAAC;AAMhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDACxB;AAOlB;IADC,IAAA,0BAAgB,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BACzC,IAAI;kDAAC"}
|