tt-entities 0.0.16 → 0.0.17
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/libs/tatayab-entities-library/src/entities/permission.entity.d.ts +8 -0
- package/dist/libs/tatayab-entities-library/src/entities/permission.entity.js +38 -0
- package/dist/libs/tatayab-entities-library/src/entities/permission.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/src/entities/role-permission.entity.d.ts +5 -0
- package/dist/libs/tatayab-entities-library/src/entities/role-permission.entity.js +32 -0
- package/dist/libs/tatayab-entities-library/src/entities/role-permission.entity.js.map +1 -0
- package/dist/libs/tatayab-entities-library/src/entities/sys.role.entity.d.ts +3 -0
- package/dist/libs/tatayab-entities-library/src/entities/sys.role.entity.js +11 -1
- package/dist/libs/tatayab-entities-library/src/entities/sys.role.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/src/entities/sys.user.entity.d.ts +6 -6
- package/dist/libs/tatayab-entities-library/src/entities/sys.user.entity.js +15 -15
- package/dist/libs/tatayab-entities-library/src/entities/sys.user.entity.js.map +1 -1
- package/dist/libs/tatayab-entities-library/src/index.d.ts +2 -0
- package/dist/libs/tatayab-entities-library/src/index.js +9 -1
- package/dist/libs/tatayab-entities-library/src/index.js.map +1 -1
- package/dist/src/main.js +261 -163
- package/libs/tatayab-entities-library/src/entities/permission.entity.ts +26 -0
- package/libs/tatayab-entities-library/src/entities/role-permission.entity.ts +19 -0
- package/libs/tatayab-entities-library/src/entities/sys.role.entity.ts +16 -2
- package/libs/tatayab-entities-library/src/entities/sys.user.entity.ts +22 -21
- package/libs/tatayab-entities-library/src/index.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
Column,
|
|
4
|
+
Model,
|
|
5
|
+
BelongsToMany,
|
|
6
|
+
} from 'sequelize-typescript';
|
|
7
|
+
import { SysRole } from './sys.role.entity';
|
|
8
|
+
import { RolePermission } from './role-permission.entity';
|
|
9
|
+
|
|
10
|
+
@Table
|
|
11
|
+
export class Permission extends Model {
|
|
12
|
+
// e.g. 'products.view', 'products.create', 'inventory.adjust'
|
|
13
|
+
@Column({ allowNull: false, unique: true })
|
|
14
|
+
declare name: string;
|
|
15
|
+
|
|
16
|
+
// Human readable e.g. 'View Products'
|
|
17
|
+
@Column({ allowNull: false })
|
|
18
|
+
declare displayName: string;
|
|
19
|
+
|
|
20
|
+
// Grouping for UI e.g. 'Products', 'Inventory', 'Purchasing'
|
|
21
|
+
@Column({ allowNull: false })
|
|
22
|
+
declare group: string;
|
|
23
|
+
|
|
24
|
+
@BelongsToMany(() => SysRole, () => RolePermission)
|
|
25
|
+
declare roles: SysRole[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
Column,
|
|
4
|
+
Model,
|
|
5
|
+
ForeignKey,
|
|
6
|
+
} from 'sequelize-typescript';
|
|
7
|
+
import { SysRole } from './sys.role.entity';
|
|
8
|
+
import { Permission } from './permission.entity';
|
|
9
|
+
|
|
10
|
+
@Table
|
|
11
|
+
export class RolePermission extends Model {
|
|
12
|
+
@ForeignKey(() => SysRole)
|
|
13
|
+
@Column({ allowNull: false })
|
|
14
|
+
declare sysRoleId: number;
|
|
15
|
+
|
|
16
|
+
@ForeignKey(() => Permission)
|
|
17
|
+
@Column({ allowNull: false })
|
|
18
|
+
declare permissionId: number;
|
|
19
|
+
}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Table,
|
|
3
|
+
Column,
|
|
4
|
+
Model,
|
|
5
|
+
BelongsToMany,
|
|
6
|
+
HasMany,
|
|
7
|
+
} from 'sequelize-typescript';
|
|
8
|
+
import { Permission } from './permission.entity';
|
|
9
|
+
import { RolePermission } from './role-permission.entity';
|
|
2
10
|
|
|
3
11
|
@Table
|
|
4
12
|
export class SysRole extends Model {
|
|
5
|
-
@Column
|
|
13
|
+
@Column({ allowNull: false, unique: true })
|
|
6
14
|
declare name: string;
|
|
15
|
+
|
|
16
|
+
@Column({ allowNull: true })
|
|
17
|
+
declare displayName?: string;
|
|
18
|
+
|
|
19
|
+
@BelongsToMany(() => Permission, () => RolePermission)
|
|
20
|
+
declare permissions: Permission[];
|
|
7
21
|
}
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
Table,
|
|
3
3
|
Column,
|
|
4
|
-
DataType,
|
|
5
|
-
ForeignKey,
|
|
6
4
|
Model,
|
|
7
|
-
|
|
5
|
+
ForeignKey,
|
|
6
|
+
BelongsTo,
|
|
7
|
+
DataType,
|
|
8
8
|
} from 'sequelize-typescript';
|
|
9
|
-
import { Status } from '../utils/enums/status';
|
|
10
9
|
import { SysRole } from './sys.role.entity';
|
|
10
|
+
import { Status } from '../utils/enums/status';
|
|
11
11
|
|
|
12
12
|
@Table
|
|
13
13
|
export class SysUser extends Model {
|
|
14
14
|
@Column
|
|
15
15
|
declare name: string;
|
|
16
16
|
|
|
17
|
-
@Column({ allowNull: false
|
|
17
|
+
@Column({ allowNull: false })
|
|
18
18
|
declare username: string;
|
|
19
19
|
|
|
20
|
-
@Column
|
|
20
|
+
@Column({ allowNull: false, unique: true })
|
|
21
21
|
declare email: string;
|
|
22
22
|
|
|
23
|
-
@Column
|
|
23
|
+
@Column({ allowNull: false })
|
|
24
24
|
declare phoneExt: string;
|
|
25
25
|
|
|
26
|
-
@Column
|
|
26
|
+
@Column({ allowNull: false })
|
|
27
27
|
declare phone: string;
|
|
28
28
|
|
|
29
|
-
@Column
|
|
29
|
+
@Column({ allowNull: false })
|
|
30
30
|
declare password: string;
|
|
31
|
+
|
|
32
|
+
@Column
|
|
33
|
+
declare profilePicture?: string;
|
|
34
|
+
|
|
35
|
+
@ForeignKey(() => SysRole)
|
|
36
|
+
@Column({ allowNull: true })
|
|
37
|
+
declare roleId?: number;
|
|
38
|
+
|
|
31
39
|
@Column({
|
|
32
40
|
type: DataType.ENUM(...Object.values(Status)),
|
|
33
41
|
defaultValue: Status.ACTIVE,
|
|
34
42
|
})
|
|
35
|
-
declare status
|
|
43
|
+
declare status: Status;
|
|
36
44
|
|
|
37
|
-
@
|
|
38
|
-
|
|
39
|
-
declare roleId: number;
|
|
40
|
-
|
|
41
|
-
@Column
|
|
42
|
-
declare profilePicture: string;
|
|
43
|
-
|
|
44
|
-
@Column
|
|
45
|
-
declare lastLogin: Date;
|
|
45
|
+
@Column({ allowNull: true })
|
|
46
|
+
declare lastLogin?: Date;
|
|
46
47
|
|
|
47
48
|
@BelongsTo(() => SysRole)
|
|
48
|
-
declare role
|
|
49
|
+
declare role?: SysRole;
|
|
49
50
|
}
|
|
@@ -36,6 +36,10 @@ import { VendorProduct } from './entities/vendor-product.entity';
|
|
|
36
36
|
import { PurchaseOrder } from './entities/purchase-order.entity';
|
|
37
37
|
import { PurchaseOrderItem } from './entities/purchase-order-item.entity';
|
|
38
38
|
|
|
39
|
+
// ─── Permissions ──────────────────────────────────────────────────────────────
|
|
40
|
+
import { Permission } from '@app/tatayab-entities-library/entities/permission.entity';
|
|
41
|
+
import { RolePermission } from '@app/tatayab-entities-library/entities/role-permission.entity';
|
|
42
|
+
|
|
39
43
|
// =============================================================================
|
|
40
44
|
// EXPORTS
|
|
41
45
|
// =============================================================================
|
|
@@ -79,6 +83,11 @@ export {
|
|
|
79
83
|
PurchaseOrderItemStatus,
|
|
80
84
|
} from './entities/purchase-order-item.entity';
|
|
81
85
|
|
|
86
|
+
// ─── Permissions ──────────────────────────────────────────────────────────────
|
|
87
|
+
|
|
88
|
+
export { Permission } from './entities/permission.entity';
|
|
89
|
+
export { RolePermission } from './entities/role-permission.entity';
|
|
90
|
+
|
|
82
91
|
// ─── Enums ────────────────────────────────────────────────────────────────────
|
|
83
92
|
export { OsName } from './utils/enums/osName';
|
|
84
93
|
export { ProductApp } from './utils/enums/productApp';
|
|
@@ -130,5 +139,9 @@ export function getDbModels(): ModelCtor[] {
|
|
|
130
139
|
VendorProduct,
|
|
131
140
|
PurchaseOrder,
|
|
132
141
|
PurchaseOrderItem,
|
|
142
|
+
|
|
143
|
+
// Permissions
|
|
144
|
+
Permission,
|
|
145
|
+
RolePermission,
|
|
133
146
|
];
|
|
134
147
|
}
|
package/package.json
CHANGED