mblabs-roccato-backend-commons 1.0.21 → 1.0.23
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/database/entities/group.d.ts +2 -1
- package/dist/database/entities/group.js +10 -5
- package/dist/database/entities/index.d.ts +1 -2
- package/dist/database/entities/index.js +1 -3
- package/dist/database/entities/profile-module.d.ts +3 -3
- package/dist/database/entities/profile-module.js +3 -3
- package/dist/database/entities/profile.d.ts +2 -0
- package/dist/database/entities/profile.js +10 -0
- package/dist/database/migrations/1748448589743-CreateProfilesTable.js +10 -0
- package/dist/database/migrations/1749142281608-CreateGroupTable.js +2 -5
- package/dist/interfaces/aws.d.ts +1 -0
- package/dist/services/aws/s3.js +4 -1
- package/package.json +1 -1
- package/src/database/entities/group.ts +7 -4
- package/src/database/entities/index.ts +0 -2
- package/src/database/entities/profile-module.ts +6 -6
- package/src/database/entities/profile.ts +6 -0
- package/src/database/migrations/1748448589743-CreateProfilesTable.ts +10 -0
- package/src/database/migrations/1749142281608-CreateGroupTable.ts +2 -5
- package/src/interfaces/aws.ts +1 -0
- package/src/services/aws/s3.ts +4 -1
- package/dist/database/entities/module.d.ts +0 -7
- package/dist/database/entities/module.js +0 -42
- package/src/database/entities/module.ts +0 -20
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import AccountGroupEntity from './account-group';
|
|
2
2
|
import BaseEntity from './base';
|
|
3
3
|
export default class GroupEntity extends BaseEntity {
|
|
4
|
-
name?: string;
|
|
5
4
|
tenantId?: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
description?: string;
|
|
7
|
+
isDefault?: boolean;
|
|
7
8
|
accountGroups?: AccountGroupEntity[];
|
|
8
9
|
constructor(partial: Partial<GroupEntity>);
|
|
9
10
|
}
|
|
@@ -16,27 +16,32 @@ const typeorm_1 = require("typeorm");
|
|
|
16
16
|
const account_group_1 = __importDefault(require("./account-group"));
|
|
17
17
|
const base_1 = __importDefault(require("./base"));
|
|
18
18
|
let GroupEntity = class GroupEntity extends base_1.default {
|
|
19
|
-
name;
|
|
20
19
|
tenantId;
|
|
20
|
+
name;
|
|
21
21
|
description;
|
|
22
|
+
isDefault;
|
|
22
23
|
accountGroups;
|
|
23
24
|
constructor(partial) {
|
|
24
25
|
super();
|
|
25
26
|
Object.assign(this, partial);
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)({ type: 'varchar', nullable: false }),
|
|
30
|
-
__metadata("design:type", String)
|
|
31
|
-
], GroupEntity.prototype, "name", void 0);
|
|
32
29
|
__decorate([
|
|
33
30
|
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
|
|
34
31
|
__metadata("design:type", String)
|
|
35
32
|
], GroupEntity.prototype, "tenantId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: false }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], GroupEntity.prototype, "name", void 0);
|
|
36
37
|
__decorate([
|
|
37
38
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
38
39
|
__metadata("design:type", String)
|
|
39
40
|
], GroupEntity.prototype, "description", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
|
|
43
|
+
__metadata("design:type", Boolean)
|
|
44
|
+
], GroupEntity.prototype, "isDefault", void 0);
|
|
40
45
|
__decorate([
|
|
41
46
|
(0, typeorm_1.OneToMany)(() => account_group_1.default, ag => ag.group),
|
|
42
47
|
__metadata("design:type", Array)
|
|
@@ -4,7 +4,6 @@ import AccountModuleEntity from './account-module';
|
|
|
4
4
|
import AddressEntity from './address';
|
|
5
5
|
import GroupEntity from './group';
|
|
6
6
|
import GroupModuleEntity from './group-module';
|
|
7
|
-
import ModuleEntity from './module';
|
|
8
7
|
import ProfileEntity from './profile';
|
|
9
8
|
import ProfileModuleEntity from './profile-module';
|
|
10
|
-
export { AccountEntity, AccountGroupEntity, AccountModuleEntity, GroupEntity, GroupModuleEntity,
|
|
9
|
+
export { AccountEntity, AccountGroupEntity, AccountModuleEntity, GroupEntity, GroupModuleEntity, ProfileEntity, AddressEntity, ProfileModuleEntity, };
|
|
@@ -3,7 +3,7 @@ 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.ProfileModuleEntity = exports.AddressEntity = exports.ProfileEntity = exports.
|
|
6
|
+
exports.ProfileModuleEntity = exports.AddressEntity = exports.ProfileEntity = exports.GroupModuleEntity = exports.GroupEntity = exports.AccountModuleEntity = exports.AccountGroupEntity = exports.AccountEntity = void 0;
|
|
7
7
|
const account_1 = __importDefault(require("./account"));
|
|
8
8
|
exports.AccountEntity = account_1.default;
|
|
9
9
|
const account_group_1 = __importDefault(require("./account-group"));
|
|
@@ -16,8 +16,6 @@ const group_1 = __importDefault(require("./group"));
|
|
|
16
16
|
exports.GroupEntity = group_1.default;
|
|
17
17
|
const group_module_1 = __importDefault(require("./group-module"));
|
|
18
18
|
exports.GroupModuleEntity = group_module_1.default;
|
|
19
|
-
const module_1 = __importDefault(require("./module"));
|
|
20
|
-
exports.ModuleEntity = module_1.default;
|
|
21
19
|
const profile_1 = __importDefault(require("./profile"));
|
|
22
20
|
exports.ProfileEntity = profile_1.default;
|
|
23
21
|
const profile_module_1 = __importDefault(require("./profile-module"));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import BaseEntity from './base';
|
|
2
2
|
import ProfileEntity from './profile';
|
|
3
3
|
export default class ProfileModuleEntity extends BaseEntity {
|
|
4
|
-
moduleId
|
|
5
|
-
profileId
|
|
6
|
-
profile
|
|
4
|
+
moduleId?: string;
|
|
5
|
+
profileId?: string;
|
|
6
|
+
profile?: ProfileEntity;
|
|
7
7
|
canCreate?: boolean;
|
|
8
8
|
canView?: boolean;
|
|
9
9
|
canEdit?: boolean;
|
|
@@ -31,15 +31,15 @@ let ProfileModuleEntity = class ProfileModuleEntity extends base_1.default {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
__decorate([
|
|
34
|
-
(0, typeorm_1.Column)({ type: 'uuid', nullable:
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
36
|
], ProfileModuleEntity.prototype, "moduleId", void 0);
|
|
37
37
|
__decorate([
|
|
38
|
-
(0, typeorm_1.Column)({ type: 'uuid', nullable:
|
|
38
|
+
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
|
|
39
39
|
__metadata("design:type", String)
|
|
40
40
|
], ProfileModuleEntity.prototype, "profileId", void 0);
|
|
41
41
|
__decorate([
|
|
42
|
-
(0, typeorm_1.ManyToOne)(() => profile_1.default, { nullable:
|
|
42
|
+
(0, typeorm_1.ManyToOne)(() => profile_1.default, { nullable: true }),
|
|
43
43
|
(0, typeorm_1.JoinColumn)({ name: 'profileId', referencedColumnName: 'id' }),
|
|
44
44
|
__metadata("design:type", profile_1.default)
|
|
45
45
|
], ProfileModuleEntity.prototype, "profile", void 0);
|
|
@@ -17,6 +17,8 @@ const base_1 = __importDefault(require("./base"));
|
|
|
17
17
|
let ProfileEntity = class ProfileEntity extends base_1.default {
|
|
18
18
|
tenantId;
|
|
19
19
|
name;
|
|
20
|
+
slug;
|
|
21
|
+
isDefault;
|
|
20
22
|
constructor(partial) {
|
|
21
23
|
super();
|
|
22
24
|
Object.assign(this, partial);
|
|
@@ -30,6 +32,14 @@ __decorate([
|
|
|
30
32
|
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
31
33
|
__metadata("design:type", String)
|
|
32
34
|
], ProfileEntity.prototype, "name", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ProfileEntity.prototype, "slug", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: 'boolean', nullable: true }),
|
|
41
|
+
__metadata("design:type", Boolean)
|
|
42
|
+
], ProfileEntity.prototype, "isDefault", void 0);
|
|
33
43
|
ProfileEntity = __decorate([
|
|
34
44
|
(0, typeorm_1.Entity)('profile'),
|
|
35
45
|
__metadata("design:paramtypes", [Object])
|
|
@@ -31,6 +31,16 @@ class CreateProfilesTable1748448589743 {
|
|
|
31
31
|
type: 'varchar',
|
|
32
32
|
isNullable: true,
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: 'slug',
|
|
36
|
+
type: 'varchar',
|
|
37
|
+
isNullable: true,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'isDefault',
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
isNullable: true,
|
|
43
|
+
},
|
|
34
44
|
{
|
|
35
45
|
name: 'createdBy',
|
|
36
46
|
type: 'varchar',
|
|
@@ -15,13 +15,10 @@ class CreateGroupTable1748449000000 {
|
|
|
15
15
|
name: 'group',
|
|
16
16
|
columns: [
|
|
17
17
|
{ name: 'id', type: 'uuid', isPrimary: true, generationStrategy: 'uuid', default: 'uuid_generate_v4()' },
|
|
18
|
+
{ name: 'tenantId', type: 'uuid', isNullable: true },
|
|
18
19
|
{ name: 'name', type: 'varchar', isNullable: false, isUnique: true },
|
|
19
20
|
{ name: 'description', type: 'text', isNullable: true },
|
|
20
|
-
{
|
|
21
|
-
name: 'tenantId',
|
|
22
|
-
type: 'uuid',
|
|
23
|
-
isNullable: true,
|
|
24
|
-
},
|
|
21
|
+
{ name: 'isDefault', type: 'boolean', isNullable: true },
|
|
25
22
|
{ name: 'createdBy', type: 'varchar', isNullable: true },
|
|
26
23
|
{ name: 'createdAt', type: 'timestamptz', default: 'now()' },
|
|
27
24
|
{ name: 'updatedBy', type: 'varchar', isNullable: true },
|
package/dist/interfaces/aws.d.ts
CHANGED
package/dist/services/aws/s3.js
CHANGED
|
@@ -117,8 +117,11 @@ class AmazonS3Service {
|
|
|
117
117
|
region: credentials.region,
|
|
118
118
|
});
|
|
119
119
|
const payload = {
|
|
120
|
-
Key: this.getBucketPath(data.filename, data.folder),
|
|
121
120
|
Bucket: data.bucket,
|
|
121
|
+
Key: this.getBucketPath(data.filename, data.folder),
|
|
122
|
+
...(data.isUpload && data?.contentType && ({
|
|
123
|
+
ContentType: data.contentType,
|
|
124
|
+
})),
|
|
122
125
|
};
|
|
123
126
|
const method = data.isUpload
|
|
124
127
|
? new client_s3_1.PutObjectCommand(payload)
|
package/package.json
CHANGED
|
@@ -9,15 +9,18 @@ import BaseEntity from './base';
|
|
|
9
9
|
|
|
10
10
|
@Entity('group')
|
|
11
11
|
export default class GroupEntity extends BaseEntity {
|
|
12
|
-
@Column({ type: 'varchar', nullable: false })
|
|
13
|
-
public name?: string;
|
|
14
|
-
|
|
15
12
|
@Column({ type: 'uuid', nullable: true })
|
|
16
13
|
public tenantId?: string;
|
|
17
14
|
|
|
15
|
+
@Column({ type: 'varchar', nullable: false })
|
|
16
|
+
public name?: string;
|
|
17
|
+
|
|
18
18
|
@Column({ type: 'text', nullable: true })
|
|
19
19
|
public description?: string;
|
|
20
20
|
|
|
21
|
+
@Column({ type: 'boolean', nullable: true })
|
|
22
|
+
public isDefault?: boolean;
|
|
23
|
+
|
|
21
24
|
@OneToMany(() => AccountGroupEntity, ag => ag.group)
|
|
22
25
|
public accountGroups?: AccountGroupEntity[];
|
|
23
26
|
|
|
@@ -25,4 +28,4 @@ export default class GroupEntity extends BaseEntity {
|
|
|
25
28
|
super();
|
|
26
29
|
Object.assign(this, partial);
|
|
27
30
|
}
|
|
28
|
-
}
|
|
31
|
+
}
|
|
@@ -4,7 +4,6 @@ import AccountModuleEntity from './account-module';
|
|
|
4
4
|
import AddressEntity from './address';
|
|
5
5
|
import GroupEntity from './group';
|
|
6
6
|
import GroupModuleEntity from './group-module';
|
|
7
|
-
import ModuleEntity from './module';
|
|
8
7
|
import ProfileEntity from './profile';
|
|
9
8
|
import ProfileModuleEntity from './profile-module';
|
|
10
9
|
|
|
@@ -14,7 +13,6 @@ export {
|
|
|
14
13
|
AccountModuleEntity,
|
|
15
14
|
GroupEntity,
|
|
16
15
|
GroupModuleEntity,
|
|
17
|
-
ModuleEntity,
|
|
18
16
|
ProfileEntity,
|
|
19
17
|
AddressEntity,
|
|
20
18
|
ProfileModuleEntity,
|
|
@@ -11,18 +11,18 @@ import ProfileEntity from './profile';
|
|
|
11
11
|
|
|
12
12
|
@Entity('profile_module')
|
|
13
13
|
export default class ProfileModuleEntity extends BaseEntity {
|
|
14
|
-
@Column({ type: 'uuid', nullable:
|
|
15
|
-
public moduleId
|
|
14
|
+
@Column({ type: 'uuid', nullable: true })
|
|
15
|
+
public moduleId?: string;
|
|
16
16
|
|
|
17
|
-
@Column({ type: 'uuid', nullable:
|
|
18
|
-
public profileId
|
|
17
|
+
@Column({ type: 'uuid', nullable: true })
|
|
18
|
+
public profileId?: string;
|
|
19
19
|
|
|
20
20
|
@ManyToOne(
|
|
21
21
|
(): ObjectType<ProfileEntity> => ProfileEntity,
|
|
22
|
-
{ nullable:
|
|
22
|
+
{ nullable: true }
|
|
23
23
|
)
|
|
24
24
|
@JoinColumn({ name: 'profileId', referencedColumnName: 'id' })
|
|
25
|
-
public profile
|
|
25
|
+
public profile?: ProfileEntity;
|
|
26
26
|
|
|
27
27
|
@Column({ type: 'boolean', nullable: true })
|
|
28
28
|
public canCreate?: boolean;
|
|
@@ -13,6 +13,12 @@ export default class ProfileEntity extends BaseEntity {
|
|
|
13
13
|
@Column({ type: 'varchar', nullable: true })
|
|
14
14
|
public name?: string;
|
|
15
15
|
|
|
16
|
+
@Column({ type: 'varchar', nullable: true })
|
|
17
|
+
public slug?: string;
|
|
18
|
+
|
|
19
|
+
@Column({ type: 'boolean', nullable: true })
|
|
20
|
+
public isDefault?: boolean;
|
|
21
|
+
|
|
16
22
|
constructor (partial: Partial<ProfileEntity>) {
|
|
17
23
|
super();
|
|
18
24
|
|
|
@@ -30,6 +30,16 @@ export class CreateProfilesTable1748448589743 implements MigrationInterface {
|
|
|
30
30
|
type: 'varchar',
|
|
31
31
|
isNullable: true,
|
|
32
32
|
},
|
|
33
|
+
{
|
|
34
|
+
name: 'slug',
|
|
35
|
+
type: 'varchar',
|
|
36
|
+
isNullable: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'isDefault',
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
isNullable: true,
|
|
42
|
+
},
|
|
33
43
|
{
|
|
34
44
|
name: 'createdBy',
|
|
35
45
|
type: 'varchar',
|
|
@@ -13,13 +13,10 @@ export class CreateGroupTable1748449000000 implements MigrationInterface {
|
|
|
13
13
|
name: 'group',
|
|
14
14
|
columns: [
|
|
15
15
|
{ name: 'id', type: 'uuid', isPrimary: true, generationStrategy: 'uuid', default: 'uuid_generate_v4()' },
|
|
16
|
+
{ name: 'tenantId', type: 'uuid', isNullable: true },
|
|
16
17
|
{ name: 'name', type: 'varchar', isNullable: false, isUnique: true },
|
|
17
18
|
{ name: 'description', type: 'text', isNullable: true },
|
|
18
|
-
{
|
|
19
|
-
name: 'tenantId',
|
|
20
|
-
type: 'uuid',
|
|
21
|
-
isNullable: true,
|
|
22
|
-
},
|
|
19
|
+
{ name: 'isDefault', type: 'boolean', isNullable: true },
|
|
23
20
|
{ name: 'createdBy', type: 'varchar', isNullable: true },
|
|
24
21
|
{ name: 'createdAt', type: 'timestamptz', default: 'now()' },
|
|
25
22
|
{ name: 'updatedBy', type: 'varchar', isNullable: true },
|
package/src/interfaces/aws.ts
CHANGED
package/src/services/aws/s3.ts
CHANGED
|
@@ -141,8 +141,11 @@ class AmazonS3Service implements IAmazonS3Service {
|
|
|
141
141
|
});
|
|
142
142
|
|
|
143
143
|
const payload = {
|
|
144
|
-
Key: this.getBucketPath(data.filename, data.folder),
|
|
145
144
|
Bucket: data.bucket,
|
|
145
|
+
Key: this.getBucketPath(data.filename, data.folder),
|
|
146
|
+
...(data.isUpload && data?.contentType && ({
|
|
147
|
+
ContentType: data.contentType,
|
|
148
|
+
})),
|
|
146
149
|
};
|
|
147
150
|
|
|
148
151
|
const method = data.isUpload
|
|
@@ -1,42 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const typeorm_1 = require("typeorm");
|
|
16
|
-
const base_1 = __importDefault(require("./base"));
|
|
17
|
-
let ModuleEntity = class ModuleEntity extends base_1.default {
|
|
18
|
-
parentId;
|
|
19
|
-
name;
|
|
20
|
-
description;
|
|
21
|
-
constructor(partial) {
|
|
22
|
-
super();
|
|
23
|
-
Object.assign(this, partial);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], ModuleEntity.prototype, "parentId", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, typeorm_1.Column)({ type: 'varchar', nullable: false }),
|
|
32
|
-
__metadata("design:type", String)
|
|
33
|
-
], ModuleEntity.prototype, "name", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], ModuleEntity.prototype, "description", void 0);
|
|
38
|
-
ModuleEntity = __decorate([
|
|
39
|
-
(0, typeorm_1.Entity)('module'),
|
|
40
|
-
__metadata("design:paramtypes", [Object])
|
|
41
|
-
], ModuleEntity);
|
|
42
|
-
exports.default = ModuleEntity;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Column, Entity } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
import BaseEntity from './base';
|
|
4
|
-
|
|
5
|
-
@Entity('module')
|
|
6
|
-
export default class ModuleEntity extends BaseEntity {
|
|
7
|
-
@Column({ type: 'uuid', nullable: true })
|
|
8
|
-
public parentId?: string;
|
|
9
|
-
|
|
10
|
-
@Column({ type: 'varchar', nullable: false })
|
|
11
|
-
public name?: string;
|
|
12
|
-
|
|
13
|
-
@Column({ type: 'text', nullable: true })
|
|
14
|
-
public description?: string;
|
|
15
|
-
|
|
16
|
-
constructor (partial: Partial<ModuleEntity>) {
|
|
17
|
-
super();
|
|
18
|
-
Object.assign(this, partial);
|
|
19
|
-
}
|
|
20
|
-
}
|