mblabs-roccato-backend-commons 1.0.67 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.js +3 -1
- package/dist/constants/storage.d.ts +8 -0
- package/dist/constants/storage.js +11 -0
- package/dist/database/entities/account.d.ts +2 -1
- package/dist/database/entities/account.js +11 -6
- package/dist/database/migrations/1748448589934-CreateAccountsTable.js +11 -2
- package/dist/services/date.d.ts +2 -0
- package/dist/services/date.js +7 -1
- package/package.json +1 -1
- package/src/constants/index.ts +2 -0
- package/src/constants/storage.ts +11 -0
- package/src/database/entities/account.ts +7 -4
- package/src/database/migrations/1748448589934-CreateAccountsTable.ts +11 -2
- package/src/services/date.ts +9 -1
package/dist/constants/index.js
CHANGED
|
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LOCALES = exports.DATE = void 0;
|
|
6
|
+
exports.STORAGE = exports.LOCALES = exports.DATE = void 0;
|
|
7
7
|
const date_1 = __importDefault(require("./date"));
|
|
8
8
|
exports.DATE = date_1.default;
|
|
9
9
|
const locales_1 = __importDefault(require("./locales"));
|
|
10
10
|
exports.LOCALES = locales_1.default;
|
|
11
|
+
const storage_1 = __importDefault(require("./storage"));
|
|
12
|
+
exports.STORAGE = storage_1.default;
|
|
@@ -10,9 +10,10 @@ export default class AccountEntity extends BaseEntity {
|
|
|
10
10
|
email?: string;
|
|
11
11
|
personalDocument?: string;
|
|
12
12
|
businessDocument?: string;
|
|
13
|
-
profile?: Relation<ProfileEntity>;
|
|
14
13
|
lastAccessAt?: Date;
|
|
14
|
+
metadata?: unknown;
|
|
15
15
|
accountModules?: Relation<AccountModuleEntity>[];
|
|
16
16
|
accountGroups?: Relation<AccountGroupEntity>[];
|
|
17
|
+
profile?: Relation<ProfileEntity>;
|
|
17
18
|
constructor(partial: Partial<AccountEntity>);
|
|
18
19
|
}
|
|
@@ -24,10 +24,11 @@ let AccountEntity = class AccountEntity extends base_1.default {
|
|
|
24
24
|
email;
|
|
25
25
|
personalDocument;
|
|
26
26
|
businessDocument;
|
|
27
|
-
profile;
|
|
28
27
|
lastAccessAt;
|
|
28
|
+
metadata;
|
|
29
29
|
accountModules;
|
|
30
30
|
accountGroups;
|
|
31
|
+
profile;
|
|
31
32
|
constructor(partial) {
|
|
32
33
|
super();
|
|
33
34
|
Object.assign(this, partial);
|
|
@@ -57,15 +58,14 @@ __decorate([
|
|
|
57
58
|
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
58
59
|
__metadata("design:type", String)
|
|
59
60
|
], AccountEntity.prototype, "businessDocument", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typeorm_1.ManyToOne)(() => profile_1.default),
|
|
62
|
-
(0, typeorm_1.JoinColumn)({ name: 'profileId', referencedColumnName: 'id' }),
|
|
63
|
-
__metadata("design:type", Object)
|
|
64
|
-
], AccountEntity.prototype, "profile", void 0);
|
|
65
61
|
__decorate([
|
|
66
62
|
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
67
63
|
__metadata("design:type", Date)
|
|
68
64
|
], AccountEntity.prototype, "lastAccessAt", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], AccountEntity.prototype, "metadata", void 0);
|
|
69
69
|
__decorate([
|
|
70
70
|
(0, typeorm_1.OneToMany)(() => account_module_1.default, am => am.account),
|
|
71
71
|
__metadata("design:type", Array)
|
|
@@ -74,6 +74,11 @@ __decorate([
|
|
|
74
74
|
(0, typeorm_1.OneToMany)(() => account_group_1.default, am => am.account),
|
|
75
75
|
__metadata("design:type", Array)
|
|
76
76
|
], AccountEntity.prototype, "accountGroups", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.ManyToOne)(() => profile_1.default),
|
|
79
|
+
(0, typeorm_1.JoinColumn)({ name: 'profileId', referencedColumnName: 'id' }),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], AccountEntity.prototype, "profile", void 0);
|
|
77
82
|
AccountEntity = __decorate([
|
|
78
83
|
(0, typeorm_1.Entity)('account'),
|
|
79
84
|
__metadata("design:paramtypes", [Object])
|
|
@@ -57,8 +57,8 @@ class CreateAccountsTable1748448589934 {
|
|
|
57
57
|
isNullable: true,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
|
-
name: '
|
|
61
|
-
type: '
|
|
60
|
+
name: 'metadata',
|
|
61
|
+
type: 'jsonb',
|
|
62
62
|
isNullable: true,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -66,6 +66,11 @@ class CreateAccountsTable1748448589934 {
|
|
|
66
66
|
type: 'timestamptz',
|
|
67
67
|
isNullable: true,
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
name: 'createdBy',
|
|
71
|
+
type: 'varchar',
|
|
72
|
+
isNullable: true,
|
|
73
|
+
},
|
|
69
74
|
{
|
|
70
75
|
name: 'createdAt',
|
|
71
76
|
type: 'timestamptz',
|
|
@@ -105,10 +110,14 @@ class CreateAccountsTable1748448589934 {
|
|
|
105
110
|
columnNames: [
|
|
106
111
|
'id',
|
|
107
112
|
'tenantId',
|
|
113
|
+
'chainLinkId',
|
|
108
114
|
'name',
|
|
109
115
|
'email',
|
|
110
116
|
'cellphone',
|
|
117
|
+
'personalDocument',
|
|
118
|
+
'businessDocument',
|
|
111
119
|
'profileId',
|
|
120
|
+
'lastAccessAt',
|
|
112
121
|
],
|
|
113
122
|
}),
|
|
114
123
|
],
|
package/dist/services/date.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ declare class DateService {
|
|
|
16
16
|
addMinutes(start: Date, toAdd: number): Date;
|
|
17
17
|
minusHours(start: Date, toRemove: number): Date;
|
|
18
18
|
minusMinutes(start: Date, toRemove: number): Date;
|
|
19
|
+
minusMonths(start: Date, toRemove: number): Date;
|
|
20
|
+
minusYears(start: Date, toRemove: number): Date;
|
|
19
21
|
isValidDate(inp: string, format?: string): boolean;
|
|
20
22
|
getStartAndEndOfDay(inp?: string | Date, useUTC?: boolean): {
|
|
21
23
|
startOfDay: Date;
|
package/dist/services/date.js
CHANGED
|
@@ -68,7 +68,13 @@ class DateService {
|
|
|
68
68
|
return luxon_1.DateTime.fromJSDate(start).minus({ hours: toRemove }).toJSDate();
|
|
69
69
|
}
|
|
70
70
|
minusMinutes(start, toRemove) {
|
|
71
|
-
return luxon_1.DateTime.fromJSDate(start).
|
|
71
|
+
return luxon_1.DateTime.fromJSDate(start).minus({ minutes: toRemove }).toJSDate();
|
|
72
|
+
}
|
|
73
|
+
minusMonths(start, toRemove) {
|
|
74
|
+
return luxon_1.DateTime.fromJSDate(start).minus({ months: toRemove }).toJSDate();
|
|
75
|
+
}
|
|
76
|
+
minusYears(start, toRemove) {
|
|
77
|
+
return luxon_1.DateTime.fromJSDate(start).minus({ years: toRemove }).toJSDate();
|
|
72
78
|
}
|
|
73
79
|
isValidDate(inp, format = 'yyyy-MM-dd') {
|
|
74
80
|
return luxon_1.DateTime.fromFormat(inp, format).isValid;
|
package/package.json
CHANGED
package/src/constants/index.ts
CHANGED
|
@@ -33,19 +33,22 @@ export default class AccountEntity extends BaseEntity {
|
|
|
33
33
|
@Column({ type: 'varchar', nullable: true })
|
|
34
34
|
public businessDocument?: string;
|
|
35
35
|
|
|
36
|
-
@ManyToOne((): ObjectType<ProfileEntity> => ProfileEntity)
|
|
37
|
-
@JoinColumn({ name: 'profileId', referencedColumnName: 'id' })
|
|
38
|
-
public profile?: Relation<ProfileEntity>;
|
|
39
|
-
|
|
40
36
|
@Column({ type: 'timestamptz', nullable: true })
|
|
41
37
|
public lastAccessAt?: Date;
|
|
42
38
|
|
|
39
|
+
@Column({ type: 'jsonb', nullable: true })
|
|
40
|
+
public metadata?: unknown;
|
|
41
|
+
|
|
43
42
|
@OneToMany(() => AccountModuleEntity, am => am.account)
|
|
44
43
|
public accountModules?: Relation<AccountModuleEntity>[];
|
|
45
44
|
|
|
46
45
|
@OneToMany(() => AccountGroupEntity, am => am.account)
|
|
47
46
|
public accountGroups?: Relation<AccountGroupEntity>[];
|
|
48
47
|
|
|
48
|
+
@ManyToOne((): ObjectType<ProfileEntity> => ProfileEntity)
|
|
49
|
+
@JoinColumn({ name: 'profileId', referencedColumnName: 'id' })
|
|
50
|
+
public profile?: Relation<ProfileEntity>;
|
|
51
|
+
|
|
49
52
|
constructor (partial: Partial<AccountEntity>) {
|
|
50
53
|
super();
|
|
51
54
|
Object.assign(this, partial);
|
|
@@ -56,8 +56,8 @@ export class CreateAccountsTable1748448589934 implements MigrationInterface {
|
|
|
56
56
|
isNullable: true,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
name: '
|
|
60
|
-
type: '
|
|
59
|
+
name: 'metadata',
|
|
60
|
+
type: 'jsonb',
|
|
61
61
|
isNullable: true,
|
|
62
62
|
},
|
|
63
63
|
{
|
|
@@ -65,6 +65,11 @@ export class CreateAccountsTable1748448589934 implements MigrationInterface {
|
|
|
65
65
|
type: 'timestamptz',
|
|
66
66
|
isNullable: true,
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
name: 'createdBy',
|
|
70
|
+
type: 'varchar',
|
|
71
|
+
isNullable: true,
|
|
72
|
+
},
|
|
68
73
|
{
|
|
69
74
|
name: 'createdAt',
|
|
70
75
|
type: 'timestamptz',
|
|
@@ -104,10 +109,14 @@ export class CreateAccountsTable1748448589934 implements MigrationInterface {
|
|
|
104
109
|
columnNames: [
|
|
105
110
|
'id',
|
|
106
111
|
'tenantId',
|
|
112
|
+
'chainLinkId',
|
|
107
113
|
'name',
|
|
108
114
|
'email',
|
|
109
115
|
'cellphone',
|
|
116
|
+
'personalDocument',
|
|
117
|
+
'businessDocument',
|
|
110
118
|
'profileId',
|
|
119
|
+
'lastAccessAt',
|
|
111
120
|
],
|
|
112
121
|
}),
|
|
113
122
|
],
|
package/src/services/date.ts
CHANGED
|
@@ -89,7 +89,15 @@ class DateService {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
public minusMinutes (start: Date, toRemove: number): Date {
|
|
92
|
-
return DateTime.fromJSDate(start).
|
|
92
|
+
return DateTime.fromJSDate(start).minus({ minutes: toRemove }).toJSDate();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public minusMonths (start: Date, toRemove: number): Date {
|
|
96
|
+
return DateTime.fromJSDate(start).minus({ months: toRemove }).toJSDate();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public minusYears (start: Date, toRemove: number): Date {
|
|
100
|
+
return DateTime.fromJSDate(start).minus({ years: toRemove }).toJSDate();
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
public isValidDate (inp: string, format = 'yyyy-MM-dd'): boolean {
|