@venturialstd/user 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1357 -0
- package/dist/constants/user.constant.d.ts +8 -0
- package/dist/constants/user.constant.d.ts.map +1 -0
- package/dist/constants/user.constant.js +12 -0
- package/dist/constants/user.constant.js.map +1 -0
- package/dist/constants/user.settings.constant.d.ts +8 -0
- package/dist/constants/user.settings.constant.d.ts.map +1 -0
- package/dist/constants/user.settings.constant.js +5 -0
- package/dist/constants/user.settings.constant.js.map +1 -0
- package/dist/decorators/acl.decorator.d.ts +5 -0
- package/dist/decorators/acl.decorator.d.ts.map +1 -0
- package/dist/decorators/acl.decorator.js +11 -0
- package/dist/decorators/acl.decorator.js.map +1 -0
- package/dist/decorators/roles.decorator.d.ts +3 -0
- package/dist/decorators/roles.decorator.d.ts.map +1 -0
- package/dist/decorators/roles.decorator.js +7 -0
- package/dist/decorators/roles.decorator.js.map +1 -0
- package/dist/decorators/user.decorator.d.ts +3 -0
- package/dist/decorators/user.decorator.d.ts.map +1 -0
- package/dist/decorators/user.decorator.js +13 -0
- package/dist/decorators/user.decorator.js.map +1 -0
- package/dist/entities/permission.entity.d.ts +12 -0
- package/dist/entities/permission.entity.d.ts.map +1 -0
- package/dist/entities/permission.entity.js +80 -0
- package/dist/entities/permission.entity.js.map +1 -0
- package/dist/entities/role-permission.entity.d.ts +13 -0
- package/dist/entities/role-permission.entity.d.ts.map +1 -0
- package/dist/entities/role-permission.entity.js +79 -0
- package/dist/entities/role-permission.entity.js.map +1 -0
- package/dist/entities/role.entity.d.ts +15 -0
- package/dist/entities/role.entity.d.ts.map +1 -0
- package/dist/entities/role.entity.js +91 -0
- package/dist/entities/role.entity.js.map +1 -0
- package/dist/entities/user-role.entity.d.ts +14 -0
- package/dist/entities/user-role.entity.d.ts.map +1 -0
- package/dist/entities/user-role.entity.js +82 -0
- package/dist/entities/user-role.entity.js.map +1 -0
- package/dist/entities/user.entity.d.ts +18 -0
- package/dist/entities/user.entity.d.ts.map +1 -0
- package/dist/entities/user.entity.js +129 -0
- package/dist/entities/user.entity.js.map +1 -0
- package/dist/guards/acl.guard.d.ts +16 -0
- package/dist/guards/acl.guard.d.ts.map +1 -0
- package/dist/guards/acl.guard.js +85 -0
- package/dist/guards/acl.guard.js.map +1 -0
- package/dist/guards/user.guard.d.ts +8 -0
- package/dist/guards/user.guard.d.ts.map +1 -0
- package/dist/guards/user.guard.js +39 -0
- package/dist/guards/user.guard.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/services/acl.service.d.ts +39 -0
- package/dist/services/acl.service.d.ts.map +1 -0
- package/dist/services/acl.service.js +307 -0
- package/dist/services/acl.service.js.map +1 -0
- package/dist/services/user.service.d.ts +28 -0
- package/dist/services/user.service.d.ts.map +1 -0
- package/dist/services/user.service.js +173 -0
- package/dist/services/user.service.js.map +1 -0
- package/dist/settings/user.settings.d.ts +8 -0
- package/dist/settings/user.settings.d.ts.map +1 -0
- package/dist/settings/user.settings.js +3 -0
- package/dist/settings/user.settings.js.map +1 -0
- package/dist/user.module.d.ts +12 -0
- package/dist/user.module.d.ts.map +1 -0
- package/dist/user.module.js +48 -0
- package/dist/user.module.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.constant.d.ts","sourceRoot":"","sources":["../../src/constants/user.constant.ts"],"names":[],"mappings":"AAIA,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;CAC9C;AAMD,eAAO,MAAM,qBAAqB,eAA6B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_USER_STATUSES = exports.USER_STATUS = void 0;
|
|
4
|
+
var USER_STATUS;
|
|
5
|
+
(function (USER_STATUS) {
|
|
6
|
+
USER_STATUS["ACTIVE"] = "ACTIVE";
|
|
7
|
+
USER_STATUS["INACTIVE"] = "INACTIVE";
|
|
8
|
+
USER_STATUS["SUSPENDED"] = "SUSPENDED";
|
|
9
|
+
USER_STATUS["PENDING_VERIFICATION"] = "PENDING_VERIFICATION";
|
|
10
|
+
})(USER_STATUS || (exports.USER_STATUS = USER_STATUS = {}));
|
|
11
|
+
exports.DEFAULT_USER_STATUSES = Object.values(USER_STATUS);
|
|
12
|
+
//# sourceMappingURL=user.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.constant.js","sourceRoot":"","sources":["../../src/constants/user.constant.ts"],"names":[],"mappings":";;;AAIA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,sCAAuB,CAAA;IACvB,4DAA6C,CAAA;AAC/C,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAMY,QAAA,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const USER_SETTINGS_KEY = "USER_SETTINGS";
|
|
2
|
+
export interface UserSettingsConfig {
|
|
3
|
+
defaultTimezone?: string;
|
|
4
|
+
defaultLocale?: string;
|
|
5
|
+
allowPublicProfile?: boolean;
|
|
6
|
+
notificationsEnabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=user.settings.constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.settings.constant.d.ts","sourceRoot":"","sources":["../../src/constants/user.settings.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.settings.constant.js","sourceRoot":"","sources":["../../src/constants/user.settings.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PERMISSIONS_KEY = "permissions";
|
|
2
|
+
export declare const ROLES_KEY = "roles";
|
|
3
|
+
export declare const RequirePermissions: (...permissions: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
4
|
+
export declare const RequireAclRoles: (...roles: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
5
|
+
//# sourceMappingURL=acl.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acl.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/acl.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAC7C,eAAO,MAAM,SAAS,UAAU,CAAC;AAYjC,eAAO,MAAM,kBAAkB,GAAI,GAAG,aAAa,MAAM,EAAE,qDAChB,CAAC;AAY5C,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,MAAM,EAAE,qDAAkC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequireAclRoles = exports.RequirePermissions = exports.ROLES_KEY = exports.PERMISSIONS_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.PERMISSIONS_KEY = 'permissions';
|
|
6
|
+
exports.ROLES_KEY = 'roles';
|
|
7
|
+
const RequirePermissions = (...permissions) => (0, common_1.SetMetadata)(exports.PERMISSIONS_KEY, permissions);
|
|
8
|
+
exports.RequirePermissions = RequirePermissions;
|
|
9
|
+
const RequireAclRoles = (...roles) => (0, common_1.SetMetadata)(exports.ROLES_KEY, roles);
|
|
10
|
+
exports.RequireAclRoles = RequireAclRoles;
|
|
11
|
+
//# sourceMappingURL=acl.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acl.decorator.js","sourceRoot":"","sources":["../../src/decorators/acl.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,eAAe,GAAG,aAAa,CAAC;AAChC,QAAA,SAAS,GAAG,OAAO,CAAC;AAY1B,MAAM,kBAAkB,GAAG,CAAC,GAAG,WAAqB,EAAE,EAAE,CAC7D,IAAA,oBAAW,EAAC,uBAAe,EAAE,WAAW,CAAC,CAAC;AAD/B,QAAA,kBAAkB,sBACa;AAYrC,MAAM,eAAe,GAAG,CAAC,GAAG,KAAe,EAAE,EAAE,CAAC,IAAA,oBAAW,EAAC,iBAAS,EAAE,KAAK,CAAC,CAAC;AAAxE,QAAA,eAAe,mBAAyD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/roles.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAavD,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,SAAS,EAAE,qDAAgC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequireRoles = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const RequireRoles = (...roles) => (0, common_1.SetMetadata)('roles', roles);
|
|
6
|
+
exports.RequireRoles = RequireRoles;
|
|
7
|
+
//# sourceMappingURL=roles.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.decorator.js","sourceRoot":"","sources":["../../src/decorators/roles.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAetC,MAAM,YAAY,GAAG,CAAC,GAAG,KAAkB,EAAE,EAAE,CAAC,IAAA,oBAAW,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAAtE,QAAA,YAAY,gBAA0D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/user.decorator.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,mDAKzB,CAAC;AAWF,eAAO,MAAM,WAAW,mDAGtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrentUser = exports.CurrentUserId = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.CurrentUserId = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
+
const request = ctx.switchToHttp().getRequest();
|
|
7
|
+
return request.user?.id || request.userId;
|
|
8
|
+
});
|
|
9
|
+
exports.CurrentUser = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
10
|
+
const request = ctx.switchToHttp().getRequest();
|
|
11
|
+
return request.user;
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=user.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.decorator.js","sourceRoot":"","sources":["../../src/decorators/user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAW3D,QAAA,aAAa,GAAG,IAAA,6BAAoB,EAC/C,CAAC,IAAa,EAAE,GAAqB,EAAU,EAAE;IAC/C,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC;AAC5C,CAAC,CACF,CAAC;AAWW,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAAC,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACvF,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RolePermission } from './role-permission.entity';
|
|
2
|
+
export declare class Permission {
|
|
3
|
+
id: string;
|
|
4
|
+
resource: string;
|
|
5
|
+
action: string;
|
|
6
|
+
description: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
rolePermissions: RolePermission[];
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=permission.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAO1D,qBAEa,UAAU;IAErB,EAAE,EAAE,MAAM,CAAC;IAMX,QAAQ,EAAE,MAAM,CAAC;IAKjB,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAMpB,IAAI,EAAE,MAAM,CAAC;IAIb,eAAe,EAAE,cAAc,EAAE,CAAC;IAQlC,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.Permission = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const role_permission_entity_1 = require("./role-permission.entity");
|
|
16
|
+
let Permission = class Permission {
|
|
17
|
+
id;
|
|
18
|
+
resource;
|
|
19
|
+
action;
|
|
20
|
+
description;
|
|
21
|
+
slug;
|
|
22
|
+
rolePermissions;
|
|
23
|
+
createdAt;
|
|
24
|
+
updatedAt;
|
|
25
|
+
};
|
|
26
|
+
exports.Permission = Permission;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], Permission.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
34
|
+
(0, typeorm_1.Column)({ length: 100 }),
|
|
35
|
+
(0, typeorm_1.Index)(),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], Permission.prototype, "resource", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsString)(),
|
|
40
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
41
|
+
(0, typeorm_1.Column)({ length: 50 }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Permission.prototype, "action", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsString)(),
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], Permission.prototype, "description", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ unique: true, length: 150 }),
|
|
51
|
+
(0, typeorm_1.Index)(),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], Permission.prototype, "slug", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.OneToMany)(() => role_permission_entity_1.RolePermission, (rp) => rp.permission),
|
|
56
|
+
__metadata("design:type", Array)
|
|
57
|
+
], Permission.prototype, "rolePermissions", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
60
|
+
name: 'createdAt',
|
|
61
|
+
nullable: false,
|
|
62
|
+
type: 'timestamptz',
|
|
63
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Date)
|
|
66
|
+
], Permission.prototype, "createdAt", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.UpdateDateColumn)({
|
|
69
|
+
name: 'updatedAt',
|
|
70
|
+
nullable: false,
|
|
71
|
+
type: 'timestamptz',
|
|
72
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
73
|
+
}),
|
|
74
|
+
__metadata("design:type", Date)
|
|
75
|
+
], Permission.prototype, "updatedAt", void 0);
|
|
76
|
+
exports.Permission = Permission = __decorate([
|
|
77
|
+
(0, typeorm_1.Entity)('user_permission'),
|
|
78
|
+
(0, typeorm_1.Index)(['resource', 'action'], { unique: true })
|
|
79
|
+
], Permission);
|
|
80
|
+
//# sourceMappingURL=permission.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../src/entities/permission.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AACvD,qCAQiB;AAEjB,qEAA0D;AASnD,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB,EAAE,CAAS;IAMX,QAAQ,CAAS;IAKjB,MAAM,CAAS;IAIf,WAAW,CAAS;IAMpB,IAAI,CAAS;IAIb,eAAe,CAAmB;IAQlC,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AA5CY,gCAAU;AAErB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAMX;IAJC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IACvB,IAAA,eAAK,GAAE;;4CACS;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;0CACR;AAIf;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACrB;AAMpB;IAFC,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IACrC,IAAA,eAAK,GAAE;;wCACK;AAIb;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC;;mDACrB;AAQlC;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;6CAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;6CAAC;qBA3CL,UAAU;IAFtB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;IACzB,IAAA,eAAK,EAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACnC,UAAU,CA4CtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Permission } from './permission.entity';
|
|
2
|
+
import { Role } from './role.entity';
|
|
3
|
+
export declare class RolePermission {
|
|
4
|
+
id: string;
|
|
5
|
+
roleId: string;
|
|
6
|
+
permissionId: string;
|
|
7
|
+
conditions: Record<string, unknown>;
|
|
8
|
+
role: Role;
|
|
9
|
+
permission: Permission;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=role-permission.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-permission.entity.d.ts","sourceRoot":"","sources":["../../src/entities/role-permission.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMrC,qBAEa,cAAc;IAEzB,EAAE,EAAE,MAAM,CAAC;IAIX,MAAM,EAAE,MAAM,CAAC;IAIf,YAAY,EAAE,MAAM,CAAC;IAKrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKpC,IAAI,EAAE,IAAI,CAAC;IAMX,UAAU,EAAE,UAAU,CAAC;IAQvB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.RolePermission = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const permission_entity_1 = require("./permission.entity");
|
|
15
|
+
const role_entity_1 = require("./role.entity");
|
|
16
|
+
let RolePermission = class RolePermission {
|
|
17
|
+
id;
|
|
18
|
+
roleId;
|
|
19
|
+
permissionId;
|
|
20
|
+
conditions;
|
|
21
|
+
role;
|
|
22
|
+
permission;
|
|
23
|
+
createdAt;
|
|
24
|
+
updatedAt;
|
|
25
|
+
};
|
|
26
|
+
exports.RolePermission = RolePermission;
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], RolePermission.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)(),
|
|
33
|
+
(0, typeorm_1.Index)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], RolePermission.prototype, "roleId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
(0, typeorm_1.Index)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], RolePermission.prototype, "permissionId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], RolePermission.prototype, "conditions", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.ManyToOne)(() => role_entity_1.Role, (role) => role.permissions, { onDelete: 'CASCADE' }),
|
|
47
|
+
(0, typeorm_1.JoinColumn)({ name: 'roleId' }),
|
|
48
|
+
__metadata("design:type", role_entity_1.Role)
|
|
49
|
+
], RolePermission.prototype, "role", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.ManyToOne)(() => permission_entity_1.Permission, (permission) => permission.rolePermissions, {
|
|
52
|
+
onDelete: 'CASCADE',
|
|
53
|
+
}),
|
|
54
|
+
(0, typeorm_1.JoinColumn)({ name: 'permissionId' }),
|
|
55
|
+
__metadata("design:type", permission_entity_1.Permission)
|
|
56
|
+
], RolePermission.prototype, "permission", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
59
|
+
name: 'createdAt',
|
|
60
|
+
nullable: false,
|
|
61
|
+
type: 'timestamptz',
|
|
62
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
63
|
+
}),
|
|
64
|
+
__metadata("design:type", Date)
|
|
65
|
+
], RolePermission.prototype, "createdAt", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.UpdateDateColumn)({
|
|
68
|
+
name: 'updatedAt',
|
|
69
|
+
nullable: false,
|
|
70
|
+
type: 'timestamptz',
|
|
71
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
72
|
+
}),
|
|
73
|
+
__metadata("design:type", Date)
|
|
74
|
+
], RolePermission.prototype, "updatedAt", void 0);
|
|
75
|
+
exports.RolePermission = RolePermission = __decorate([
|
|
76
|
+
(0, typeorm_1.Entity)('user_role_permission'),
|
|
77
|
+
(0, typeorm_1.Index)(['roleId', 'permissionId'], { unique: true })
|
|
78
|
+
], RolePermission);
|
|
79
|
+
//# sourceMappingURL=role-permission.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-permission.entity.js","sourceRoot":"","sources":["../../src/entities/role-permission.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AAEjB,2DAAiD;AACjD,+CAAqC;AAQ9B,IAAM,cAAc,GAApB,MAAM,cAAc;IAEzB,EAAE,CAAS;IAIX,MAAM,CAAS;IAIf,YAAY,CAAS;IAKrB,UAAU,CAA0B;IAKpC,IAAI,CAAO;IAMX,UAAU,CAAa;IAQvB,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AA3CY,wCAAc;AAEzB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;0CACpB;AAIX;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;8CACO;AAIf;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;oDACa;AAKrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACN;AAKpC;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC1E,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACzB,kBAAI;4CAAC;AAMX;IAJC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE;QACvE,QAAQ,EAAE,SAAS;KACpB,CAAC;IACD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;8BACzB,8BAAU;kDAAC;AAQvB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;iDAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;iDAAC;yBA1CL,cAAc;IAF1B,IAAA,gBAAM,EAAC,sBAAsB,CAAC;IAC9B,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACvC,cAAc,CA2C1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RolePermission } from './role-permission.entity';
|
|
2
|
+
import { UserRole } from './user-role.entity';
|
|
3
|
+
export declare class Role {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
isSystem: boolean;
|
|
9
|
+
priority: number;
|
|
10
|
+
permissions: RolePermission[];
|
|
11
|
+
userRoles: UserRole[];
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=role.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.entity.d.ts","sourceRoot":"","sources":["../../src/entities/role.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAM9C,qBAEa,IAAI;IAEf,EAAE,EAAE,MAAM,CAAC;IAKX,IAAI,EAAE,MAAM,CAAC;IAKb,WAAW,EAAE,MAAM,CAAC;IAKpB,QAAQ,EAAE,OAAO,CAAC;IAIlB,QAAQ,EAAE,OAAO,CAAC;IAGlB,QAAQ,EAAE,MAAM,CAAC;IAIjB,WAAW,EAAE,cAAc,EAAE,CAAC;IAG9B,SAAS,EAAE,QAAQ,EAAE,CAAC;IAQtB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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.Role = void 0;
|
|
13
|
+
const class_validator_1 = require("class-validator");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const role_permission_entity_1 = require("./role-permission.entity");
|
|
16
|
+
const user_role_entity_1 = require("./user-role.entity");
|
|
17
|
+
let Role = class Role {
|
|
18
|
+
id;
|
|
19
|
+
name;
|
|
20
|
+
description;
|
|
21
|
+
isActive;
|
|
22
|
+
isSystem;
|
|
23
|
+
priority;
|
|
24
|
+
permissions;
|
|
25
|
+
userRoles;
|
|
26
|
+
createdAt;
|
|
27
|
+
updatedAt;
|
|
28
|
+
};
|
|
29
|
+
exports.Role = Role;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], Role.prototype, "id", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
37
|
+
(0, typeorm_1.Column)({ unique: true, length: 50 }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Role.prototype, "name", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsOptional)(),
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], Role.prototype, "description", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsBoolean)(),
|
|
48
|
+
(0, typeorm_1.Column)({ default: true }),
|
|
49
|
+
(0, typeorm_1.Index)(),
|
|
50
|
+
__metadata("design:type", Boolean)
|
|
51
|
+
], Role.prototype, "isActive", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsBoolean)(),
|
|
54
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], Role.prototype, "isSystem", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ type: 'int', default: 0 }),
|
|
59
|
+
__metadata("design:type", Number)
|
|
60
|
+
], Role.prototype, "priority", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.OneToMany)(() => role_permission_entity_1.RolePermission, (rp) => rp.role),
|
|
63
|
+
__metadata("design:type", Array)
|
|
64
|
+
], Role.prototype, "permissions", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.OneToMany)(() => user_role_entity_1.UserRole, (ur) => ur.role),
|
|
67
|
+
__metadata("design:type", Array)
|
|
68
|
+
], Role.prototype, "userRoles", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
71
|
+
name: 'createdAt',
|
|
72
|
+
nullable: false,
|
|
73
|
+
type: 'timestamptz',
|
|
74
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Date)
|
|
77
|
+
], Role.prototype, "createdAt", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.UpdateDateColumn)({
|
|
80
|
+
name: 'updatedAt',
|
|
81
|
+
nullable: false,
|
|
82
|
+
type: 'timestamptz',
|
|
83
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
84
|
+
}),
|
|
85
|
+
__metadata("design:type", Date)
|
|
86
|
+
], Role.prototype, "updatedAt", void 0);
|
|
87
|
+
exports.Role = Role = __decorate([
|
|
88
|
+
(0, typeorm_1.Entity)('user_role'),
|
|
89
|
+
(0, typeorm_1.Index)(['name'], { unique: true })
|
|
90
|
+
], Role);
|
|
91
|
+
//# sourceMappingURL=role.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.entity.js","sourceRoot":"","sources":["../../src/entities/role.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA8E;AAC9E,qCAQiB;AAEjB,qEAA0D;AAC1D,yDAA8C;AAQvC,IAAM,IAAI,GAAV,MAAM,IAAI;IAEf,EAAE,CAAS;IAKX,IAAI,CAAS;IAKb,WAAW,CAAS;IAKpB,QAAQ,CAAU;IAIlB,QAAQ,CAAU;IAGlB,QAAQ,CAAS;IAIjB,WAAW,CAAmB;IAG9B,SAAS,CAAa;IAQtB,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AAhDY,oBAAI;AAEf;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;gCACpB;AAKX;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;kCACxB;AAKb;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACrB;AAKpB;IAHC,IAAA,2BAAS,GAAE;IACX,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,eAAK,GAAE;;sCACU;AAIlB;IAFC,IAAA,2BAAS,GAAE;IACX,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;sCACT;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;sCACnB;AAIjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;;yCACnB;AAG9B;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;;uCACrB;AAQtB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;uCAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;uCAAC;eA/CL,IAAI;IAFhB,IAAA,gBAAM,EAAC,WAAW,CAAC;IACnB,IAAA,eAAK,EAAC,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACrB,IAAI,CAgDhB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Role } from './role.entity';
|
|
2
|
+
import { User } from './user.entity';
|
|
3
|
+
export declare class UserRole {
|
|
4
|
+
id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
roleId: string;
|
|
7
|
+
expiresAt: Date;
|
|
8
|
+
scope: Record<string, unknown>;
|
|
9
|
+
user: User;
|
|
10
|
+
role: Role;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=user-role.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-role.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user-role.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOrC,qBAEa,QAAQ;IAEnB,EAAE,EAAE,MAAM,CAAC;IAIX,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,IAAI,CAAC;IAIhB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAK/B,IAAI,EAAE,IAAI,CAAC;IAIX,IAAI,EAAE,IAAI,CAAC;IAQX,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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.UserRole = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const role_entity_1 = require("./role.entity");
|
|
15
|
+
const user_entity_1 = require("./user.entity");
|
|
16
|
+
let UserRole = class UserRole {
|
|
17
|
+
id;
|
|
18
|
+
userId;
|
|
19
|
+
roleId;
|
|
20
|
+
expiresAt;
|
|
21
|
+
scope;
|
|
22
|
+
user;
|
|
23
|
+
role;
|
|
24
|
+
createdAt;
|
|
25
|
+
updatedAt;
|
|
26
|
+
};
|
|
27
|
+
exports.UserRole = UserRole;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], UserRole.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)(),
|
|
34
|
+
(0, typeorm_1.Index)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], UserRole.prototype, "userId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)(),
|
|
39
|
+
(0, typeorm_1.Index)(),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], UserRole.prototype, "roleId", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'timestamptz', nullable: true }),
|
|
44
|
+
__metadata("design:type", Date)
|
|
45
|
+
], UserRole.prototype, "expiresAt", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], UserRole.prototype, "scope", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, { onDelete: 'CASCADE' }),
|
|
52
|
+
(0, typeorm_1.JoinColumn)({ name: 'userId' }),
|
|
53
|
+
__metadata("design:type", user_entity_1.User)
|
|
54
|
+
], UserRole.prototype, "user", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.ManyToOne)(() => role_entity_1.Role, (role) => role.userRoles, { onDelete: 'CASCADE' }),
|
|
57
|
+
(0, typeorm_1.JoinColumn)({ name: 'roleId' }),
|
|
58
|
+
__metadata("design:type", role_entity_1.Role)
|
|
59
|
+
], UserRole.prototype, "role", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
62
|
+
name: 'createdAt',
|
|
63
|
+
nullable: false,
|
|
64
|
+
type: 'timestamptz',
|
|
65
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
66
|
+
}),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], UserRole.prototype, "createdAt", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.UpdateDateColumn)({
|
|
71
|
+
name: 'updatedAt',
|
|
72
|
+
nullable: false,
|
|
73
|
+
type: 'timestamptz',
|
|
74
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Date)
|
|
77
|
+
], UserRole.prototype, "updatedAt", void 0);
|
|
78
|
+
exports.UserRole = UserRole = __decorate([
|
|
79
|
+
(0, typeorm_1.Entity)('user_user_role'),
|
|
80
|
+
(0, typeorm_1.Index)(['userId', 'roleId'], { unique: true })
|
|
81
|
+
], UserRole);
|
|
82
|
+
//# sourceMappingURL=user-role.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-role.entity.js","sourceRoot":"","sources":["../../src/entities/user-role.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AAEjB,+CAAqC;AACrC,+CAAqC;AAS9B,IAAM,QAAQ,GAAd,MAAM,QAAQ;IAEnB,EAAE,CAAS;IAIX,MAAM,CAAS;IAIf,MAAM,CAAS;IAIf,SAAS,CAAO;IAIhB,KAAK,CAA0B;IAK/B,IAAI,CAAO;IAIX,IAAI,CAAO;IAQX,SAAS,CAAO;IAQhB,SAAS,CAAO;CACjB,CAAA;AA5CY,4BAAQ;AAEnB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;oCACpB;AAIX;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;wCACO;AAIf;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,GAAE;;wCACO;AAIf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACrC,IAAI;2CAAC;AAIhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACX;AAK/B;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC9C,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACzB,kBAAI;sCAAC;AAIX;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACxE,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACzB,kBAAI;sCAAC;AAQX;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;2CAAC;AAQhB;IANC,IAAA,0BAAgB,EAAC;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB;KACnC,CAAC;8BACS,IAAI;2CAAC;mBA3CL,QAAQ;IAFpB,IAAA,gBAAM,EAAC,gBAAgB,CAAC;IACxB,IAAA,eAAK,EAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;GACjC,QAAQ,CA4CpB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class User {
|
|
2
|
+
id: string;
|
|
3
|
+
firstname: string;
|
|
4
|
+
lastname: string;
|
|
5
|
+
email: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
avatar: string;
|
|
8
|
+
timezone: string;
|
|
9
|
+
locale: string;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
isEmailVerified: boolean;
|
|
12
|
+
status: string;
|
|
13
|
+
settings: Record<string, unknown>;
|
|
14
|
+
metadata: Record<string, unknown>;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=user.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":"AAUA,qBACa,IAAI;IAEf,EAAE,EAAE,MAAM,CAAC;IAKX,SAAS,EAAE,MAAM,CAAC;IAKlB,QAAQ,EAAE,MAAM,CAAC;IAKjB,KAAK,EAAE,MAAM,CAAC;IAKd,KAAK,EAAE,MAAM,CAAC;IAKd,MAAM,EAAE,MAAM,CAAC;IAKf,QAAQ,EAAE,MAAM,CAAC;IAKjB,MAAM,EAAE,MAAM,CAAC;IAIf,QAAQ,EAAE,OAAO,CAAC;IAIlB,eAAe,EAAE,OAAO,CAAC;IAMzB,MAAM,EAAE,MAAM,CAAC;IAKf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKlC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAQlC,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|