@admc-go-th/admc-library 1.0.13 → 1.0.15
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/authAssignment-B6rhOsb-.d.ts +146 -0
- package/authItem-CRUblP_g.d.ts +85 -0
- package/databases/models/index.ts +2 -0
- package/databases/models/menu.ts +14 -0
- package/databases/models/users.ts +15 -0
- package/databases/schema/authAssignment.ts +72 -0
- package/databases/schema/authItem.ts +93 -0
- package/databases/schema/authItemChild.ts +34 -0
- package/databases/schema/authRole.ts +66 -0
- package/databases/schema/authRoleChild.ts +37 -0
- package/databases/schema/index.ts +10 -0
- package/databases/schema/mdContent.ts +139 -0
- package/databases/schema/mdContentGroup.ts +73 -0
- package/databases/schema/menu.ts +108 -0
- package/databases/schema/msModule.ts +66 -0
- package/databases/schema/users.ts +186 -0
- package/databases/tables/authAssignment.d.ts +2 -0
- package/databases/tables/authAssignment.js +499 -0
- package/databases/tables/authItem.d.ts +2 -0
- package/databases/tables/authItem.js +294 -0
- package/databases/tables/authItemChild.d.ts +2 -0
- package/databases/tables/authItemChild.js +296 -0
- package/databases/tables/authRole.d.ts +2 -0
- package/databases/tables/authRole.js +501 -0
- package/databases/{models → tables}/authRoleChild.js +1 -1
- package/databases/tables/index.d.ts +4 -0
- package/databases/{models → tables}/index.js +433 -346
- package/databases/tables/mdContent.d.ts +2 -0
- package/databases/tables/mdContent.js +499 -0
- package/databases/tables/mdContentGroup.d.ts +2 -0
- package/databases/tables/mdContentGroup.js +501 -0
- package/databases/tables/menu.d.ts +2 -0
- package/databases/tables/menu.js +294 -0
- package/databases/tables/msModule.d.ts +2 -0
- package/databases/tables/msModule.js +296 -0
- package/databases/tables/users.d.ts +2 -0
- package/databases/tables/users.js +499 -0
- package/middleware/authenticate-token.js +35 -24
- package/middleware/error-handler.js +1 -1
- package/package.json +4 -2
- package/databases/models/authAssignment.d.ts +0 -20
- package/databases/models/authAssignment.js +0 -88
- package/databases/models/authItem.d.ts +0 -26
- package/databases/models/authItem.js +0 -104
- package/databases/models/authItemChild.d.ts +0 -12
- package/databases/models/authItemChild.js +0 -58
- package/databases/models/authRole.d.ts +0 -20
- package/databases/models/authRole.js +0 -86
- package/databases/models/index.d.ts +0 -11
- package/databases/models/mdContent.d.ts +0 -38
- package/databases/models/mdContent.js +0 -146
- package/databases/models/mdContentGroup.d.ts +0 -22
- package/databases/models/mdContentGroup.js +0 -92
- package/databases/models/menu.d.ts +0 -26
- package/databases/models/menu.js +0 -106
- package/databases/models/msModule.d.ts +0 -20
- package/databases/models/msModule.js +0 -86
- package/databases/models/users.d.ts +0 -50
- package/databases/models/users.js +0 -185
- /package/databases/{models → tables}/authRoleChild.d.ts +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
|
|
3
|
+
interface mdContentGroupAttributes {
|
|
4
|
+
id?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
createdBy?: string;
|
|
8
|
+
createdDate?: Date;
|
|
9
|
+
updatedBy?: string;
|
|
10
|
+
updatedDate?: Date;
|
|
11
|
+
}
|
|
12
|
+
declare class mdContentGroup extends Model<mdContentGroupAttributes, mdContentGroupAttributes> implements mdContentGroupAttributes {
|
|
13
|
+
id?: number;
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
createdBy?: string;
|
|
17
|
+
createdDate?: Date;
|
|
18
|
+
updatedBy?: string;
|
|
19
|
+
updatedDate?: Date;
|
|
20
|
+
mdContents?: mdContent[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface mdContentAttributes {
|
|
24
|
+
id?: number;
|
|
25
|
+
uuid: number;
|
|
26
|
+
groupId?: number;
|
|
27
|
+
userId: number;
|
|
28
|
+
title?: string;
|
|
29
|
+
detail?: string;
|
|
30
|
+
metaTitle?: string;
|
|
31
|
+
metaKeyword?: string;
|
|
32
|
+
metaDescription?: string;
|
|
33
|
+
imageCover?: string;
|
|
34
|
+
imageGallery?: string;
|
|
35
|
+
createdBy?: string;
|
|
36
|
+
createdDate?: Date;
|
|
37
|
+
updatedBy?: string;
|
|
38
|
+
updatedDate?: Date;
|
|
39
|
+
}
|
|
40
|
+
declare class mdContent extends Model<mdContentAttributes, mdContentAttributes> implements mdContentAttributes {
|
|
41
|
+
id?: number;
|
|
42
|
+
uuid: number;
|
|
43
|
+
groupId?: number;
|
|
44
|
+
userId: number;
|
|
45
|
+
title?: string;
|
|
46
|
+
detail?: string;
|
|
47
|
+
metaTitle?: string;
|
|
48
|
+
metaKeyword?: string;
|
|
49
|
+
metaDescription?: string;
|
|
50
|
+
imageCover?: string;
|
|
51
|
+
imageGallery?: string;
|
|
52
|
+
createdBy?: string;
|
|
53
|
+
createdDate?: Date;
|
|
54
|
+
updatedBy?: string;
|
|
55
|
+
updatedDate?: Date;
|
|
56
|
+
user?: users;
|
|
57
|
+
mdContentGroup?: mdContentGroup;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface usersAttributes {
|
|
61
|
+
id?: number;
|
|
62
|
+
uuid: string;
|
|
63
|
+
username: string;
|
|
64
|
+
passwordHash?: string;
|
|
65
|
+
passwordResetToken?: string;
|
|
66
|
+
verificationToken?: string;
|
|
67
|
+
email?: string;
|
|
68
|
+
authKey?: string;
|
|
69
|
+
accessToken?: string;
|
|
70
|
+
userLevel?: number;
|
|
71
|
+
userAuthen?: string;
|
|
72
|
+
userType?: number;
|
|
73
|
+
prefix?: string;
|
|
74
|
+
firstName?: string;
|
|
75
|
+
lastName?: string;
|
|
76
|
+
phone?: string;
|
|
77
|
+
status?: number;
|
|
78
|
+
createdBy?: string;
|
|
79
|
+
createdDate?: Date;
|
|
80
|
+
updatedBy?: string;
|
|
81
|
+
updatedDate?: Date;
|
|
82
|
+
}
|
|
83
|
+
declare class users extends Model<usersAttributes, usersAttributes> implements usersAttributes {
|
|
84
|
+
id?: number;
|
|
85
|
+
uuid: string;
|
|
86
|
+
username: string;
|
|
87
|
+
passwordHash?: string;
|
|
88
|
+
passwordResetToken?: string;
|
|
89
|
+
verificationToken?: string;
|
|
90
|
+
email?: string;
|
|
91
|
+
authKey?: string;
|
|
92
|
+
accessToken?: string;
|
|
93
|
+
userLevel?: number;
|
|
94
|
+
userAuthen?: string;
|
|
95
|
+
userType?: number;
|
|
96
|
+
prefix?: string;
|
|
97
|
+
firstName?: string;
|
|
98
|
+
lastName?: string;
|
|
99
|
+
phone?: string;
|
|
100
|
+
status?: number;
|
|
101
|
+
createdBy?: string;
|
|
102
|
+
createdDate?: Date;
|
|
103
|
+
updatedBy?: string;
|
|
104
|
+
updatedDate?: Date;
|
|
105
|
+
authAssignments?: authAssignment[];
|
|
106
|
+
mdContents?: mdContent[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface authRoleAttributes {
|
|
110
|
+
id?: number;
|
|
111
|
+
name: string;
|
|
112
|
+
createdBy?: string;
|
|
113
|
+
createdDate?: Date;
|
|
114
|
+
updatedBy?: string;
|
|
115
|
+
updatedDate?: Date;
|
|
116
|
+
}
|
|
117
|
+
declare class authRole extends Model<authRoleAttributes, authRoleAttributes> implements authRoleAttributes {
|
|
118
|
+
id?: number;
|
|
119
|
+
name: string;
|
|
120
|
+
createdBy?: string;
|
|
121
|
+
createdDate?: Date;
|
|
122
|
+
updatedBy?: string;
|
|
123
|
+
updatedDate?: Date;
|
|
124
|
+
authAssignments?: authAssignment[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface authAssignmentAttributes {
|
|
128
|
+
roleId: number;
|
|
129
|
+
userId: number;
|
|
130
|
+
createdBy?: string;
|
|
131
|
+
createdDate?: Date;
|
|
132
|
+
updatedBy?: string;
|
|
133
|
+
updatedDate?: Date;
|
|
134
|
+
}
|
|
135
|
+
declare class authAssignment extends Model<authAssignmentAttributes, authAssignmentAttributes> implements authAssignmentAttributes {
|
|
136
|
+
roleId: number;
|
|
137
|
+
userId: number;
|
|
138
|
+
createdBy?: string;
|
|
139
|
+
createdDate?: Date;
|
|
140
|
+
updatedBy?: string;
|
|
141
|
+
updatedDate?: Date;
|
|
142
|
+
user?: users;
|
|
143
|
+
authRole?: authRole;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { type authAssignmentAttributes as a, authAssignment as b, type authRoleAttributes as c, authRole as d, mdContent as e, type mdContentGroupAttributes as f, mdContentGroup as g, users as h, type mdContentAttributes as m, type usersAttributes as u };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
|
|
3
|
+
interface msModuleAttributes {
|
|
4
|
+
id?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
createdBy?: string;
|
|
7
|
+
createdDate?: Date;
|
|
8
|
+
updatedBy?: string;
|
|
9
|
+
updatedDate?: Date;
|
|
10
|
+
}
|
|
11
|
+
declare class msModule extends Model<msModuleAttributes, msModuleAttributes> implements msModuleAttributes {
|
|
12
|
+
id?: number;
|
|
13
|
+
name: string;
|
|
14
|
+
createdBy?: string;
|
|
15
|
+
createdDate?: Date;
|
|
16
|
+
updatedBy?: string;
|
|
17
|
+
updatedDate?: Date;
|
|
18
|
+
menus?: menu[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface menuAttributes {
|
|
22
|
+
id?: number;
|
|
23
|
+
uuid: string;
|
|
24
|
+
itemName?: string;
|
|
25
|
+
parentId?: number;
|
|
26
|
+
display?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
moduleId?: number;
|
|
29
|
+
createdBy?: string;
|
|
30
|
+
createdDate?: Date;
|
|
31
|
+
updatedBy?: string;
|
|
32
|
+
updatedDate?: Date;
|
|
33
|
+
}
|
|
34
|
+
declare class menu extends Model<menuAttributes, menuAttributes> implements menuAttributes {
|
|
35
|
+
id?: number;
|
|
36
|
+
uuid: string;
|
|
37
|
+
itemName?: string;
|
|
38
|
+
parentId?: number;
|
|
39
|
+
display?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
moduleId?: number;
|
|
42
|
+
createdBy?: string;
|
|
43
|
+
createdDate?: Date;
|
|
44
|
+
updatedBy?: string;
|
|
45
|
+
updatedDate?: Date;
|
|
46
|
+
msModule?: msModule;
|
|
47
|
+
authItem?: authItem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface authItemChildAttributes {
|
|
51
|
+
parent: string;
|
|
52
|
+
child: string;
|
|
53
|
+
}
|
|
54
|
+
declare class authItemChild extends Model<authItemChildAttributes, authItemChildAttributes> implements authItemChildAttributes {
|
|
55
|
+
parent: string;
|
|
56
|
+
child: string;
|
|
57
|
+
authItem?: authItem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface authItemAttributes {
|
|
61
|
+
keyName: string;
|
|
62
|
+
type: number;
|
|
63
|
+
display: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
status?: number;
|
|
66
|
+
createdBy?: string;
|
|
67
|
+
createdDate?: Date;
|
|
68
|
+
updatedBy?: string;
|
|
69
|
+
updatedDate?: Date;
|
|
70
|
+
}
|
|
71
|
+
declare class authItem extends Model<authItemAttributes, authItemAttributes> implements authItemAttributes {
|
|
72
|
+
keyName: string;
|
|
73
|
+
type: number;
|
|
74
|
+
display: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
status?: number;
|
|
77
|
+
createdBy?: string;
|
|
78
|
+
createdDate?: Date;
|
|
79
|
+
updatedBy?: string;
|
|
80
|
+
updatedDate?: Date;
|
|
81
|
+
menus?: menu[];
|
|
82
|
+
authItemChildren?: authItemChild[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { type authItemAttributes as a, authItem as b, type authItemChildAttributes as c, authItemChild as d, menu as e, type msModuleAttributes as f, msModule as g, type menuAttributes as m };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FindOptions } from "sequelize/types/model";
|
|
2
|
+
import { menu as Menu } from "../tables";
|
|
3
|
+
|
|
4
|
+
export class menu extends Menu {
|
|
5
|
+
static async findByUUID(
|
|
6
|
+
uuid: string,
|
|
7
|
+
options?: Omit<FindOptions, 'where'>
|
|
8
|
+
): Promise<Menu | null> {
|
|
9
|
+
return await this.findOne({
|
|
10
|
+
where: { uuid },
|
|
11
|
+
...options,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { users as Users} from "../tables";
|
|
2
|
+
import { formatDate } from "../../utils/date";
|
|
3
|
+
|
|
4
|
+
export class users extends Users {
|
|
5
|
+
get fullName(): string {
|
|
6
|
+
return `${this.firstName} ${this.lastName}`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
toJSON() {
|
|
10
|
+
const values = super.toJSON() as any;
|
|
11
|
+
values.fullName = this.fullName;
|
|
12
|
+
values.created_date = formatDate(new Date());
|
|
13
|
+
return values;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsTo
|
|
3
|
+
} from "sequelize-typescript";
|
|
4
|
+
import { users } from "./users";
|
|
5
|
+
import { authRole } from "./authRole";
|
|
6
|
+
|
|
7
|
+
export interface authAssignmentAttributes {
|
|
8
|
+
roleId: number;
|
|
9
|
+
userId: number;
|
|
10
|
+
createdBy?: string;
|
|
11
|
+
createdDate?: Date;
|
|
12
|
+
updatedBy?: string;
|
|
13
|
+
updatedDate?: Date;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Table({
|
|
17
|
+
tableName: "auth_assignment",
|
|
18
|
+
timestamps: false
|
|
19
|
+
})
|
|
20
|
+
export class authAssignment extends Model<authAssignmentAttributes, authAssignmentAttributes> implements authAssignmentAttributes {
|
|
21
|
+
|
|
22
|
+
@ForeignKey(() => authRole)
|
|
23
|
+
@Column({
|
|
24
|
+
field: "role_id",
|
|
25
|
+
primaryKey: true,
|
|
26
|
+
type: DataType.INTEGER
|
|
27
|
+
})
|
|
28
|
+
declare roleId: number;
|
|
29
|
+
|
|
30
|
+
@ForeignKey(() => users)
|
|
31
|
+
@Column({
|
|
32
|
+
field: "user_id",
|
|
33
|
+
primaryKey: true,
|
|
34
|
+
type: DataType.INTEGER
|
|
35
|
+
})
|
|
36
|
+
declare userId: number;
|
|
37
|
+
|
|
38
|
+
@Column({
|
|
39
|
+
field: "created_by",
|
|
40
|
+
allowNull: true,
|
|
41
|
+
type: DataType.STRING(60)
|
|
42
|
+
})
|
|
43
|
+
declare createdBy?: string;
|
|
44
|
+
|
|
45
|
+
@Column({
|
|
46
|
+
field: "created_date",
|
|
47
|
+
allowNull: true,
|
|
48
|
+
type: DataType.DATE
|
|
49
|
+
})
|
|
50
|
+
declare createdDate?: Date;
|
|
51
|
+
|
|
52
|
+
@Column({
|
|
53
|
+
field: "updated_by",
|
|
54
|
+
allowNull: true,
|
|
55
|
+
type: DataType.STRING(60)
|
|
56
|
+
})
|
|
57
|
+
declare updatedBy?: string;
|
|
58
|
+
|
|
59
|
+
@Column({
|
|
60
|
+
field: "updated_date",
|
|
61
|
+
allowNull: true,
|
|
62
|
+
type: DataType.DATE
|
|
63
|
+
})
|
|
64
|
+
declare updatedDate?: Date;
|
|
65
|
+
|
|
66
|
+
@BelongsTo(() => users)
|
|
67
|
+
declare user?: users;
|
|
68
|
+
|
|
69
|
+
@BelongsTo(() => authRole)
|
|
70
|
+
declare authRole?: authRole;
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasMany
|
|
3
|
+
} from "sequelize-typescript";
|
|
4
|
+
import { menu } from "./menu";
|
|
5
|
+
import { authItemChild } from "./authItemChild";
|
|
6
|
+
|
|
7
|
+
export interface authItemAttributes {
|
|
8
|
+
keyName: string;
|
|
9
|
+
type: number;
|
|
10
|
+
display: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
status?: number;
|
|
13
|
+
createdBy?: string;
|
|
14
|
+
createdDate?: Date;
|
|
15
|
+
updatedBy?: string;
|
|
16
|
+
updatedDate?: Date;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Table({
|
|
20
|
+
tableName: "auth_item",
|
|
21
|
+
timestamps: false
|
|
22
|
+
})
|
|
23
|
+
export class authItem extends Model<authItemAttributes, authItemAttributes> implements authItemAttributes {
|
|
24
|
+
|
|
25
|
+
@Column({
|
|
26
|
+
field: "key_name",
|
|
27
|
+
primaryKey: true,
|
|
28
|
+
type: DataType.STRING(100)
|
|
29
|
+
})
|
|
30
|
+
declare keyName: string;
|
|
31
|
+
|
|
32
|
+
@Column({
|
|
33
|
+
type: DataType.SMALLINT
|
|
34
|
+
})
|
|
35
|
+
declare type: number;
|
|
36
|
+
|
|
37
|
+
@Column({
|
|
38
|
+
type: DataType.STRING(255)
|
|
39
|
+
})
|
|
40
|
+
declare display: string;
|
|
41
|
+
|
|
42
|
+
@Column({
|
|
43
|
+
allowNull: true,
|
|
44
|
+
type: DataType.STRING
|
|
45
|
+
})
|
|
46
|
+
declare description?: string;
|
|
47
|
+
|
|
48
|
+
@Column({
|
|
49
|
+
allowNull: true,
|
|
50
|
+
type: DataType.INTEGER,
|
|
51
|
+
defaultValue: "1"
|
|
52
|
+
})
|
|
53
|
+
declare status?: number;
|
|
54
|
+
|
|
55
|
+
@Column({
|
|
56
|
+
field: "created_by",
|
|
57
|
+
allowNull: true,
|
|
58
|
+
type: DataType.STRING(60)
|
|
59
|
+
})
|
|
60
|
+
declare createdBy?: string;
|
|
61
|
+
|
|
62
|
+
@Column({
|
|
63
|
+
field: "created_date",
|
|
64
|
+
allowNull: true,
|
|
65
|
+
type: DataType.DATE
|
|
66
|
+
})
|
|
67
|
+
declare createdDate?: Date;
|
|
68
|
+
|
|
69
|
+
@Column({
|
|
70
|
+
field: "updated_by",
|
|
71
|
+
allowNull: true,
|
|
72
|
+
type: DataType.STRING(60)
|
|
73
|
+
})
|
|
74
|
+
declare updatedBy?: string;
|
|
75
|
+
|
|
76
|
+
@Column({
|
|
77
|
+
field: "updated_date",
|
|
78
|
+
allowNull: true,
|
|
79
|
+
type: DataType.DATE
|
|
80
|
+
})
|
|
81
|
+
declare updatedDate?: Date;
|
|
82
|
+
|
|
83
|
+
@HasMany(() => menu, {
|
|
84
|
+
sourceKey: "keyName"
|
|
85
|
+
})
|
|
86
|
+
declare menus?: menu[];
|
|
87
|
+
|
|
88
|
+
@HasMany(() => authItemChild, {
|
|
89
|
+
sourceKey: "keyName"
|
|
90
|
+
})
|
|
91
|
+
declare authItemChildren?: authItemChild[];
|
|
92
|
+
|
|
93
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, BelongsTo
|
|
3
|
+
} from "sequelize-typescript";
|
|
4
|
+
import { authItem } from "./authItem";
|
|
5
|
+
|
|
6
|
+
export interface authItemChildAttributes {
|
|
7
|
+
parent: string;
|
|
8
|
+
child: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Table({
|
|
12
|
+
tableName: "auth_item_child",
|
|
13
|
+
timestamps: false
|
|
14
|
+
})
|
|
15
|
+
export class authItemChild extends Model<authItemChildAttributes, authItemChildAttributes> implements authItemChildAttributes {
|
|
16
|
+
|
|
17
|
+
@ForeignKey(() => authItem)
|
|
18
|
+
@Column({
|
|
19
|
+
primaryKey: true,
|
|
20
|
+
type: DataType.STRING(64)
|
|
21
|
+
})
|
|
22
|
+
declare parent: string;
|
|
23
|
+
|
|
24
|
+
@ForeignKey(() => authItem)
|
|
25
|
+
@Column({
|
|
26
|
+
primaryKey: true,
|
|
27
|
+
type: DataType.STRING(64)
|
|
28
|
+
})
|
|
29
|
+
declare child: string;
|
|
30
|
+
|
|
31
|
+
@BelongsTo(() => authItem)
|
|
32
|
+
declare authItem?: authItem;
|
|
33
|
+
|
|
34
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey, HasMany
|
|
3
|
+
} from "sequelize-typescript";
|
|
4
|
+
import { authAssignment } from "./authAssignment";
|
|
5
|
+
|
|
6
|
+
export interface authRoleAttributes {
|
|
7
|
+
id?: number;
|
|
8
|
+
name: string;
|
|
9
|
+
createdBy?: string;
|
|
10
|
+
createdDate?: Date;
|
|
11
|
+
updatedBy?: string;
|
|
12
|
+
updatedDate?: Date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@Table({
|
|
16
|
+
tableName: "auth_role",
|
|
17
|
+
timestamps: false
|
|
18
|
+
})
|
|
19
|
+
export class authRole extends Model<authRoleAttributes, authRoleAttributes> implements authRoleAttributes {
|
|
20
|
+
|
|
21
|
+
@Column({
|
|
22
|
+
primaryKey: true,
|
|
23
|
+
autoIncrement: true,
|
|
24
|
+
type: DataType.INTEGER
|
|
25
|
+
})
|
|
26
|
+
declare id?: number;
|
|
27
|
+
|
|
28
|
+
@Column({
|
|
29
|
+
type: DataType.STRING(255)
|
|
30
|
+
})
|
|
31
|
+
declare name: string;
|
|
32
|
+
|
|
33
|
+
@Column({
|
|
34
|
+
field: "created_by",
|
|
35
|
+
allowNull: true,
|
|
36
|
+
type: DataType.STRING(60)
|
|
37
|
+
})
|
|
38
|
+
declare createdBy?: string;
|
|
39
|
+
|
|
40
|
+
@Column({
|
|
41
|
+
field: "created_date",
|
|
42
|
+
allowNull: true,
|
|
43
|
+
type: DataType.DATE
|
|
44
|
+
})
|
|
45
|
+
declare createdDate?: Date;
|
|
46
|
+
|
|
47
|
+
@Column({
|
|
48
|
+
field: "updated_by",
|
|
49
|
+
allowNull: true,
|
|
50
|
+
type: DataType.STRING(60)
|
|
51
|
+
})
|
|
52
|
+
declare updatedBy?: string;
|
|
53
|
+
|
|
54
|
+
@Column({
|
|
55
|
+
field: "updated_date",
|
|
56
|
+
allowNull: true,
|
|
57
|
+
type: DataType.DATE
|
|
58
|
+
})
|
|
59
|
+
declare updatedDate?: Date;
|
|
60
|
+
|
|
61
|
+
@HasMany(() => authAssignment, {
|
|
62
|
+
sourceKey: "id"
|
|
63
|
+
})
|
|
64
|
+
declare authAssignments?: authAssignment[];
|
|
65
|
+
|
|
66
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Model, Table, Column, DataType, Index, Sequelize, ForeignKey
|
|
3
|
+
} from "sequelize-typescript";
|
|
4
|
+
|
|
5
|
+
export interface authRoleChildAttributes {
|
|
6
|
+
roleId: number;
|
|
7
|
+
itemName: string;
|
|
8
|
+
permission?: object;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Table({
|
|
12
|
+
tableName: "auth_role_child",
|
|
13
|
+
timestamps: false
|
|
14
|
+
})
|
|
15
|
+
export class authRoleChild extends Model<authRoleChildAttributes, authRoleChildAttributes> implements authRoleChildAttributes {
|
|
16
|
+
|
|
17
|
+
@Column({
|
|
18
|
+
field: "role_id",
|
|
19
|
+
primaryKey: true,
|
|
20
|
+
type: DataType.INTEGER
|
|
21
|
+
})
|
|
22
|
+
declare roleId: number;
|
|
23
|
+
|
|
24
|
+
@Column({
|
|
25
|
+
field: "item_name",
|
|
26
|
+
primaryKey: true,
|
|
27
|
+
type: DataType.STRING(255)
|
|
28
|
+
})
|
|
29
|
+
declare itemName: string;
|
|
30
|
+
|
|
31
|
+
@Column({
|
|
32
|
+
allowNull: true,
|
|
33
|
+
type: DataType.JSON
|
|
34
|
+
})
|
|
35
|
+
declare permission?: object;
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./authAssignment";
|
|
2
|
+
export * from "./authItem";
|
|
3
|
+
export * from "./authItemChild";
|
|
4
|
+
export * from "./authRole";
|
|
5
|
+
export * from "./authRoleChild";
|
|
6
|
+
export * from "./mdContent";
|
|
7
|
+
export * from "./mdContentGroup";
|
|
8
|
+
export * from "./menu";
|
|
9
|
+
export * from "./msModule";
|
|
10
|
+
export * from "./users";
|