chyz 1.2.1-rc.2 → 1.2.4-rc.2
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/BaseChyz.js → BaseChyz.js} +0 -0
- package/{dist/BaseChyz.js.map → BaseChyz.js.map} +0 -0
- package/{dist/Chyz.js → Chyz.js} +0 -0
- package/{dist/Chyz.js.map → Chyz.js.map} +0 -0
- package/{dist/base → base}/ActionFilter.js +0 -0
- package/{dist/base → base}/ActionFilter.js.map +0 -0
- package/{dist/base → base}/BaseError.js +0 -0
- package/{dist/base → base}/BaseError.js.map +0 -0
- package/{dist/base → base}/BaseObject.js +0 -0
- package/{dist/base → base}/BaseObject.js.map +0 -0
- package/{dist/base → base}/Behavior.js +0 -0
- package/{dist/base → base}/Behavior.js.map +0 -0
- package/{dist/base → base}/CWebController.js +0 -0
- package/{dist/base → base}/CWebController.js.map +0 -0
- package/{dist/base → base}/Component.js +0 -0
- package/{dist/base → base}/Component.js.map +0 -0
- package/{dist/base → base}/Configurable.js +0 -0
- package/{dist/base → base}/Configurable.js.map +0 -0
- package/{dist/base → base}/DataErrorDbException.js +0 -0
- package/{dist/base → base}/DataErrorDbException.js.map +0 -0
- package/{dist/base → base}/DbConnection.js +0 -0
- package/{dist/base → base}/DbConnection.js.map +0 -0
- package/{dist/base → base}/ForbiddenHttpException.js +0 -0
- package/{dist/base → base}/ForbiddenHttpException.js.map +0 -0
- package/{dist/base → base}/InvalidArgumentException.js +0 -0
- package/{dist/base → base}/InvalidArgumentException.js.map +0 -0
- package/{dist/base → base}/InvalidConfigException.js +0 -0
- package/{dist/base → base}/InvalidConfigException.js.map +0 -0
- package/{dist/base → base}/Model.js +0 -0
- package/{dist/base → base}/Model.js.map +0 -0
- package/{dist/base → base}/ModelManager.js +0 -0
- package/{dist/base → base}/ModelManager.js.map +0 -0
- package/{dist/base → base}/NotFoundHttpException.js +0 -0
- package/{dist/base → base}/NotFoundHttpException.js.map +0 -0
- package/{dist/base → base}/RestClient.js +0 -0
- package/{dist/base → base}/RestClient.js.map +0 -0
- package/{dist/base → base}/UnauthorizedHttpException.js +0 -0
- package/{dist/base → base}/UnauthorizedHttpException.js.map +0 -0
- package/{dist/base → base}/ValidationHttpException.js +0 -0
- package/{dist/base → base}/ValidationHttpException.js.map +0 -0
- package/{dist/base → base}/db/Exception.js +0 -0
- package/{dist/base → base}/db/Exception.js.map +0 -0
- package/{dist/base → base}/index.js +0 -0
- package/{dist/base → base}/index.js.map +0 -0
- package/{dist/decorator → decorator}/Middleware.js +0 -0
- package/{dist/decorator → decorator}/Middleware.js.map +0 -0
- package/{dist/decorator → decorator}/controller.js +0 -0
- package/{dist/decorator → decorator}/controller.js.map +0 -0
- package/{dist/decorator → decorator}/enums/ControllerDecoratorParams.js +0 -0
- package/{dist/decorator → decorator}/enums/ControllerDecoratorParams.js.map +0 -0
- package/{dist/decorator → decorator}/get.js +0 -0
- package/{dist/decorator → decorator}/get.js.map +0 -0
- package/{dist/decorator → decorator}/index.js +0 -0
- package/{dist/decorator → decorator}/index.js.map +0 -0
- package/{dist/decorator → decorator}/post.js +0 -0
- package/{dist/decorator → decorator}/post.js.map +0 -0
- package/{dist/filters → filters}/AccessControl.js +0 -1
- package/filters/AccessControl.js.map +1 -0
- package/{dist/filters → filters}/AccessRule.js +0 -0
- package/{dist/filters → filters}/AccessRule.js.map +0 -0
- package/{dist/filters → filters}/auth/AuthInterface.js +0 -0
- package/{dist/filters → filters}/auth/AuthInterface.js.map +0 -0
- package/{dist/filters → filters}/auth/AuthMethod.js +0 -0
- package/{dist/filters → filters}/auth/AuthMethod.js.map +1 -1
- package/{dist/filters → filters}/auth/HttpBasicAuth.js +0 -0
- package/{dist/filters → filters}/auth/HttpBasicAuth.js.map +0 -0
- package/{dist/filters → filters}/auth/HttpBearerAuth.js +0 -0
- package/{dist/filters → filters}/auth/HttpBearerAuth.js.map +0 -0
- package/{dist/filters → filters}/auth/HttpHeaderAuth.js +0 -0
- package/{dist/filters → filters}/auth/HttpHeaderAuth.js.map +0 -0
- package/{dist/filters → filters}/auth/JwtHttpBearerAuth.js +2 -3
- package/{dist/filters → filters}/auth/JwtHttpBearerAuth.js.map +1 -1
- package/{dist/filters → filters}/auth/KeyCloakHttpBearerAuth.js +0 -0
- package/{dist/filters → filters}/auth/KeyCloakHttpBearerAuth.js.map +0 -0
- package/{dist/filters → filters}/auth/index.js +0 -0
- package/{dist/filters → filters}/auth/index.js.map +0 -0
- package/{dist/filters → filters}/index.js +0 -0
- package/{dist/filters → filters}/index.js.map +0 -0
- package/{dist/index.js → index.js} +3 -0
- package/{dist/index.js.map → index.js.map} +1 -1
- package/log/config/log4js.json +1 -1
- package/{dist/model → model}/RouteDefinition.js +0 -0
- package/{dist/model → model}/RouteDefinition.js.map +0 -0
- package/package.json +2 -2
- package/{dist/rbac → rbac}/AuthAssignment.js +0 -0
- package/{dist/rbac → rbac}/AuthAssignment.js.map +0 -0
- package/{dist/rbac → rbac}/AuthItem.js +0 -0
- package/{dist/rbac → rbac}/AuthItem.js.map +0 -0
- package/{dist/rbac → rbac}/AuthItemChild.js +0 -0
- package/{dist/rbac → rbac}/AuthItemChild.js.map +0 -0
- package/{dist/rbac → rbac}/AuthManager.js +0 -0
- package/{dist/rbac → rbac}/AuthManager.js.map +0 -0
- package/{dist/requiments → requiments}/Glob.js +0 -0
- package/{dist/requiments → requiments}/Glob.js.map +0 -0
- package/{dist/requiments → requiments}/ReflectUtil.js +0 -0
- package/{dist/requiments → requiments}/ReflectUtil.js.map +0 -0
- package/{dist/requiments → requiments}/Utils.js +0 -0
- package/{dist/requiments → requiments}/Utils.js.map +0 -0
- package/{dist/validators → validators}/BooleanValidator.js +0 -0
- package/{dist/validators → validators}/BooleanValidator.js.map +0 -0
- package/{dist/validators → validators}/CompareValidator.js +0 -0
- package/{dist/validators → validators}/CompareValidator.js.map +0 -0
- package/{dist/validators → validators}/DateValidator.js +0 -0
- package/{dist/validators → validators}/DateValidator.js.map +0 -0
- package/{dist/validators → validators}/EmailValidator.js +0 -0
- package/{dist/validators → validators}/EmailValidator.js.map +0 -0
- package/{dist/validators → validators}/Validator.js +0 -0
- package/{dist/validators → validators}/Validator.js.map +0 -0
- package/{dist/web → web}/IdentityInterface.js +0 -0
- package/{dist/web → web}/IdentityInterface.js.map +0 -0
- package/{dist/web → web}/WebUser.js +0 -0
- package/{dist/web → web}/WebUser.js.map +0 -0
- package/BaseChyz.ts +0 -454
- package/Chyz.ts +0 -11
- package/Doc/Moel kullanma.md +0 -13
- package/Examples/Controllers/ApiController.ts +0 -140
- package/Examples/Controllers/BasicApiController.ts +0 -121
- package/Examples/Controllers/KeyCloakController.ts +0 -100
- package/Examples/Controllers/PublicController.ts +0 -42
- package/Examples/Controllers/SiteController.ts +0 -149
- package/Examples/Models/AuthAssignment.ts +0 -50
- package/Examples/Models/AuthItem.ts +0 -59
- package/Examples/Models/AuthItemChild.ts +0 -49
- package/Examples/Models/Categories.ts +0 -51
- package/Examples/Models/Customer.ts +0 -115
- package/Examples/Models/KeycloakUser.ts +0 -70
- package/Examples/Models/Order.ts +0 -64
- package/Examples/Models/OrderItem.ts +0 -27
- package/Examples/Models/ProductModels.ts +0 -49
- package/Examples/Models/ProductToCategories.ts +0 -46
- package/Examples/Models/Products.ts +0 -50
- package/Examples/Models/Stocks.ts +0 -60
- package/Examples/Models/User.ts +0 -128
- package/Examples/Models/UserPermission.ts +0 -37
- package/Examples/Models/index.ts +0 -19
- package/Examples/index-keycloack.ts +0 -78
- package/Examples/index.ts +0 -60
- package/Examples/keycloak.json +0 -7
- package/Examples/log/access.log +0 -0
- package/Examples/log/app.log +0 -20601
- package/Examples/log/errors.log +0 -2120
- package/Examples/package.json +0 -49
- package/Examples/tsconfig.json +0 -21
- package/base/ActionFilter.ts +0 -71
- package/base/BaseError.ts +0 -28
- package/base/BaseObject.ts +0 -19
- package/base/Behavior.ts +0 -6
- package/base/CWebController.ts +0 -84
- package/base/Component.ts +0 -66
- package/base/Configurable.ts +0 -10
- package/base/DataErrorDbException.ts +0 -16
- package/base/DbConnection.ts +0 -55
- package/base/ForbiddenHttpException.ts +0 -15
- package/base/InvalidArgumentException.ts +0 -16
- package/base/InvalidConfigException.ts +0 -16
- package/base/Model.ts +0 -555
- package/base/ModelManager.ts +0 -19
- package/base/NotFoundHttpException.ts +0 -14
- package/base/RestClient.ts +0 -28
- package/base/UnauthorizedHttpException.ts +0 -17
- package/base/ValidationHttpException.ts +0 -14
- package/base/db/Exception.ts +0 -14
- package/base/index.ts +0 -18
- package/decorator/Middleware.ts +0 -9
- package/decorator/controller.ts +0 -22
- package/decorator/enums/ControllerDecoratorParams.ts +0 -5
- package/decorator/get.ts +0 -37
- package/decorator/index.ts +0 -3
- package/decorator/post.ts +0 -36
- package/dist/filters/AccessControl.js.map +0 -1
- package/dist/log/config/log4js.json +0 -55
- package/dist/package.json +0 -59
- package/filters/AccessControl.ts +0 -77
- package/filters/AccessRule.ts +0 -182
- package/filters/auth/AuthInterface.ts +0 -34
- package/filters/auth/AuthMethod.ts +0 -88
- package/filters/auth/HttpBasicAuth.ts +0 -75
- package/filters/auth/HttpBearerAuth.ts +0 -31
- package/filters/auth/HttpHeaderAuth.ts +0 -53
- package/filters/auth/JwtHttpBearerAuth.ts +0 -80
- package/filters/auth/KeyCloakHttpBearerAuth.ts +0 -115
- package/filters/auth/index.ts +0 -4
- package/filters/index.ts +0 -2
- package/index.ts +0 -16
- package/model/RouteDefinition.ts +0 -18
- package/package-lock.json +0 -5259
- package/rbac/AuthAssignment.ts +0 -50
- package/rbac/AuthItem.ts +0 -57
- package/rbac/AuthItemChild.ts +0 -50
- package/rbac/AuthManager.ts +0 -398
- package/requiments/Glob.ts +0 -9
- package/requiments/ReflectUtil.ts +0 -26
- package/requiments/Utils.ts +0 -63
- package/tsconfig.json +0 -18
- package/validators/BooleanValidator.ts +0 -0
- package/validators/CompareValidator.ts +0 -0
- package/validators/DateValidator.ts +0 -0
- package/validators/EmailValidator.ts +0 -0
- package/validators/Validator.ts +0 -27
- package/web/IdentityInterface.ts +0 -68
- package/web/WebUser.ts +0 -187
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import {DataTypes, Model} from "../../base";
|
|
3
|
-
|
|
4
|
-
export class CustomerClass extends Model {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
public tableName() {
|
|
8
|
-
return 'customer';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public attributes() {
|
|
12
|
-
return {
|
|
13
|
-
name: {
|
|
14
|
-
type: DataTypes.STRING,
|
|
15
|
-
allowNull: false,
|
|
16
|
-
validate: {
|
|
17
|
-
notEmpty: true,
|
|
18
|
-
is: ["^[a-z0-9A-Z]+$", 'i'],
|
|
19
|
-
len: [4, 255],
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
firstname: {
|
|
23
|
-
type: DataTypes.STRING,
|
|
24
|
-
validate: {
|
|
25
|
-
is: ["^[a-z0-9A-Z]+$", 'i'],
|
|
26
|
-
len: [4, 255],
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
lastname: {
|
|
30
|
-
type: DataTypes.STRING,
|
|
31
|
-
validate: {
|
|
32
|
-
is: ["^[a-z0-9A-Z]+$", 'i'],
|
|
33
|
-
len: [4, 255],
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
companyName: {
|
|
37
|
-
type: DataTypes.STRING,
|
|
38
|
-
allowNull: true,
|
|
39
|
-
validate: {
|
|
40
|
-
is: /^[0-9A-Za-z =().:;+-şŞçÇöÖğĞıİüÜ]+$/i,
|
|
41
|
-
len: [4, 255],
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
email: {
|
|
45
|
-
type: DataTypes.STRING,
|
|
46
|
-
validate: {
|
|
47
|
-
isEmail: true
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
gsm_phone: {
|
|
51
|
-
type: DataTypes.STRING,
|
|
52
|
-
validate: {
|
|
53
|
-
is: ["^[0-9 +]+$", 'i'],
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
country: {
|
|
57
|
-
type: DataTypes.STRING,
|
|
58
|
-
validate: {
|
|
59
|
-
isAlpha: true,
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
address: {
|
|
63
|
-
type: DataTypes.STRING,
|
|
64
|
-
validate: {
|
|
65
|
-
is: ["^[\\w'\\-,.[0-9_\\/\\\\+=\"()<>;:\\[\\] şŞçÇöÖğĞıİüÜ ]{2,}$", "i"],
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
taxoffice: {
|
|
69
|
-
type: DataTypes.STRING,
|
|
70
|
-
validate: {
|
|
71
|
-
is: ["^[\\w'\\-,.[0-9_\\/\\\\+=\"()<>;:\\[\\] şŞçÇöÖğĞıİüÜ ]{2,}$", "i"],
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
taxnumber: {
|
|
75
|
-
unique: true,
|
|
76
|
-
type: DataTypes.STRING,
|
|
77
|
-
validate: {
|
|
78
|
-
is: ["^[0-9]+$", 'i'],
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
username: {
|
|
82
|
-
unique: true,
|
|
83
|
-
type: DataTypes.STRING,
|
|
84
|
-
validate: {
|
|
85
|
-
isEmail: true
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
password: {
|
|
89
|
-
type: DataTypes.STRING,
|
|
90
|
-
validate: {
|
|
91
|
-
is: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?\.#&])[A-Za-z\d$@$!%*\.?&]{8,12}/
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"2fa": {
|
|
95
|
-
type: DataTypes.BOOLEAN,
|
|
96
|
-
validate: {
|
|
97
|
-
isBoolean: true
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
status: {
|
|
101
|
-
type: DataTypes.BOOLEAN,
|
|
102
|
-
validate: {
|
|
103
|
-
isBoolean: true
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// const Customer = new CustomerClass();
|
|
112
|
-
// export {Customer};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {IdentityInterface} from "../../web/IdentityInterface";
|
|
9
|
-
import {DataTypes, Model} from "../../base";
|
|
10
|
-
import BaseChyz from "../../BaseChyz";
|
|
11
|
-
|
|
12
|
-
const JsonWebToken = require("jsonwebtoken");
|
|
13
|
-
|
|
14
|
-
export class KeycloakUser implements IdentityInterface {
|
|
15
|
-
|
|
16
|
-
[x: string]: any;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
findIdentity(id: number) {
|
|
20
|
-
throw new Error("Method not implemented.");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getId(): number {
|
|
24
|
-
throw new Error("Method not implemented.");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getAuthKey(): string {
|
|
28
|
-
throw new Error("Method not implemented.");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
validateAuthKey(authKey: string): boolean {
|
|
32
|
-
throw new Error("Method not implemented.");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public attributes() {
|
|
36
|
-
return {
|
|
37
|
-
// Model attributes are defined here
|
|
38
|
-
username: {
|
|
39
|
-
type: DataTypes.STRING,
|
|
40
|
-
allowNull: false
|
|
41
|
-
},
|
|
42
|
-
password: {
|
|
43
|
-
type: DataTypes.STRING,
|
|
44
|
-
allowNull: false
|
|
45
|
-
},
|
|
46
|
-
user_role: {
|
|
47
|
-
type: DataTypes.STRING,
|
|
48
|
-
allowNull: false
|
|
49
|
-
},
|
|
50
|
-
salt_text: {
|
|
51
|
-
type: DataTypes.STRING
|
|
52
|
-
// allowNull defaults to true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async findIdentityByAccessToken(token, type) {
|
|
58
|
-
console.log(token,type)
|
|
59
|
-
// console.log(this)
|
|
60
|
-
// console.log(BaseChyz)
|
|
61
|
-
return null;
|
|
62
|
-
// return keycloak.protect('realm:user');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
can(permissionName: string, params: any[], allowCaching: boolean): boolean | null {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
package/Examples/Models/Order.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {DataTypes, Model, Relation} from "../../base";
|
|
2
|
-
import {OrderItemClass} from "./OrderItem";
|
|
3
|
-
|
|
4
|
-
export class OrderClass extends Model {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
|
|
7
|
-
tableName() {
|
|
8
|
-
return 'order';
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
attributes() {
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
customer_id: {
|
|
16
|
-
allowNull: false,
|
|
17
|
-
type: DataTypes.INTEGER,
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
crm_order_id: {
|
|
21
|
-
allowNull: false,
|
|
22
|
-
type: DataTypes.INTEGER,
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
total: {
|
|
26
|
-
allowNull: false,
|
|
27
|
-
type: DataTypes.FLOAT,
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
created_date: {
|
|
31
|
-
allowNull: false,
|
|
32
|
-
type: DataTypes.DATE,
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
defaultValue: Model.NOW
|
|
35
|
-
},
|
|
36
|
-
status: {
|
|
37
|
-
type: DataTypes.BOOLEAN,
|
|
38
|
-
allowNull: false,
|
|
39
|
-
validate: {
|
|
40
|
-
isBoolean: true
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
relation(): Relation[] {
|
|
48
|
-
return [
|
|
49
|
-
{
|
|
50
|
-
type: "hasOne",
|
|
51
|
-
sourceKey: "order_id",
|
|
52
|
-
foreignKey: "id",
|
|
53
|
-
model: (new OrderItemClass()).model()
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// const Order = new OrderClass()
|
|
60
|
-
// export {Order};
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {DataTypes, Model} from "../../base";
|
|
2
|
-
|
|
3
|
-
export class OrderItemClass extends Model {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
|
|
6
|
-
public tableName() {
|
|
7
|
-
return 'order_items';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
public attributes() {
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
status: {
|
|
14
|
-
type: DataTypes.BOOLEAN,
|
|
15
|
-
validate: {
|
|
16
|
-
isBoolean: true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
// const OrderItem = new OrderItemClass()
|
|
24
|
-
// export { OrderItem };
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
import {DataTypes, ModelManager, Model, Relation} from "../../base";
|
|
8
|
-
|
|
9
|
-
export class ProductModelsClass extends Model {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
|
|
12
|
-
tableName() {
|
|
13
|
-
return 'models';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
attributes() {
|
|
18
|
-
return {
|
|
19
|
-
// Model attributes are defined here
|
|
20
|
-
title: {
|
|
21
|
-
type: DataTypes.STRING,
|
|
22
|
-
allowNull: false
|
|
23
|
-
},
|
|
24
|
-
stock_code: {
|
|
25
|
-
type: DataTypes.STRING,
|
|
26
|
-
allowNull: false
|
|
27
|
-
},
|
|
28
|
-
properties: {
|
|
29
|
-
type: DataTypes.STRING,
|
|
30
|
-
allowNull: false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
relation(): Relation[] {
|
|
37
|
-
return [
|
|
38
|
-
{
|
|
39
|
-
type: "hasOne",
|
|
40
|
-
foreignKey: "id",
|
|
41
|
-
sourceKey: "category_id",
|
|
42
|
-
model: ModelManager.Products.model()
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// const ProductModels = new ProductModelsClass();
|
|
49
|
-
// export {ProductModels}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
import {DataTypes, ModelManager, Model, Relation} from "../../base";
|
|
8
|
-
|
|
9
|
-
export class ProductToCategoriesClass extends Model {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
|
|
12
|
-
tableName() {
|
|
13
|
-
return 'product_to_categories';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
attributes() {
|
|
18
|
-
return {
|
|
19
|
-
// Model attributes are defined here
|
|
20
|
-
product_id: {
|
|
21
|
-
type: DataTypes.INTEGER,
|
|
22
|
-
allowNull: false
|
|
23
|
-
},
|
|
24
|
-
category_id: {
|
|
25
|
-
type: DataTypes.INTEGER,
|
|
26
|
-
allowNull: false
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// relations(): Relation[] {
|
|
33
|
-
// return [
|
|
34
|
-
// {
|
|
35
|
-
// type: "hasMany",
|
|
36
|
-
// foreignKey: "category_id",
|
|
37
|
-
// sourceKey: "id",
|
|
38
|
-
// model: ModelManager.Categories.model(),
|
|
39
|
-
// }
|
|
40
|
-
// ]
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// const ProductToCategories = new ProductToCategoriesClass()
|
|
46
|
-
// export {ProductToCategories}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
import {DataTypes, ModelManager, Model, Relation} from "../../base";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export class ProductsClass extends Model {
|
|
11
|
-
[x: string]: any;
|
|
12
|
-
|
|
13
|
-
tableName() {
|
|
14
|
-
return 'products';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
attributes() {
|
|
18
|
-
return {
|
|
19
|
-
// Model attributes are defined here
|
|
20
|
-
title: {
|
|
21
|
-
type: DataTypes.STRING,
|
|
22
|
-
allowNull: false
|
|
23
|
-
},
|
|
24
|
-
model_id: {
|
|
25
|
-
type: DataTypes.INTEGER,
|
|
26
|
-
allowNull: false
|
|
27
|
-
},
|
|
28
|
-
properties: {
|
|
29
|
-
type: DataTypes.STRING,
|
|
30
|
-
allowNull: false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
relations(): Relation[] {
|
|
37
|
-
return [
|
|
38
|
-
{
|
|
39
|
-
type: "belongsToMany",
|
|
40
|
-
foreignKey: "product_id",
|
|
41
|
-
sourceKey: "id",
|
|
42
|
-
model: ModelManager.Categories.model(),
|
|
43
|
-
through: ModelManager.ProductToCategories.model()
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// const Products = new ProductsClass()
|
|
50
|
-
// export {Products}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
import {DataTypes, Model} from "../../base";
|
|
8
|
-
|
|
9
|
-
export class StocksClass extends Model {
|
|
10
|
-
[x: string]: any;
|
|
11
|
-
|
|
12
|
-
public tableName() {
|
|
13
|
-
return 'stock';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* product_id int4
|
|
18
|
-
* properties jsonb
|
|
19
|
-
* status int2
|
|
20
|
-
* barcode string(20)
|
|
21
|
-
* stock_code string(20)
|
|
22
|
-
* model_id int4
|
|
23
|
-
*/
|
|
24
|
-
public attributes() {
|
|
25
|
-
return {
|
|
26
|
-
// Model attributes are defined here
|
|
27
|
-
product_id: {
|
|
28
|
-
type: DataTypes.INTEGER,
|
|
29
|
-
allowNull: false
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
barcode: {
|
|
33
|
-
type: DataTypes.STRING,
|
|
34
|
-
allowNull: false,
|
|
35
|
-
validate: {
|
|
36
|
-
len: 20
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
stock_code: {
|
|
40
|
-
type: DataTypes.STRING,
|
|
41
|
-
allowNull: false,
|
|
42
|
-
validate: {
|
|
43
|
-
len: 20
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
model_id: {
|
|
47
|
-
type: DataTypes.INTEGER,
|
|
48
|
-
allowNull: false
|
|
49
|
-
},
|
|
50
|
-
status: {
|
|
51
|
-
type: DataTypes.INTEGER,
|
|
52
|
-
allowNull: false
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// const Stocks = new StocksClass();
|
|
60
|
-
// export {Stocks}
|
package/Examples/Models/User.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {IdentityInterface} from "../../web/IdentityInterface";
|
|
11
|
-
import {DataTypes, Model} from "../../base";
|
|
12
|
-
import {BaseChyz} from "../../index";
|
|
13
|
-
|
|
14
|
-
const JsonWebToken = require("jsonwebtoken");
|
|
15
|
-
|
|
16
|
-
export class User extends Model implements IdentityInterface {
|
|
17
|
-
[x: string]: any;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
public tableName() {
|
|
23
|
-
return 'users';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param id
|
|
29
|
-
*/
|
|
30
|
-
findIdentity(id: number) {
|
|
31
|
-
throw new Error("Method not implemented.");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
getId(): number {
|
|
38
|
-
throw new Error("Method not implemented.");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param permissionName
|
|
44
|
-
* @param params
|
|
45
|
-
* @param allowCaching
|
|
46
|
-
*/
|
|
47
|
-
can(permissionName: string, params: any[], allowCaching: boolean): boolean | null {
|
|
48
|
-
throw new Error("Method not implemented.");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
getAuthKey(): string {
|
|
55
|
-
throw new Error("Method not implemented.");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
validateAuthKey(authKey: string): boolean {
|
|
59
|
-
throw new Error("Method not implemented.");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
*/
|
|
65
|
-
public attributes() {
|
|
66
|
-
return {
|
|
67
|
-
// Model attributes are defined here
|
|
68
|
-
name: {
|
|
69
|
-
type: DataTypes.STRING,
|
|
70
|
-
allowNull: false
|
|
71
|
-
},
|
|
72
|
-
username: {
|
|
73
|
-
type: DataTypes.STRING,
|
|
74
|
-
allowNull: false
|
|
75
|
-
},
|
|
76
|
-
password: {
|
|
77
|
-
type: DataTypes.STRING,
|
|
78
|
-
allowNull: false
|
|
79
|
-
},
|
|
80
|
-
email: {
|
|
81
|
-
type: DataTypes.STRING,
|
|
82
|
-
allowNull: false
|
|
83
|
-
},
|
|
84
|
-
permissions_id: {
|
|
85
|
-
type: DataTypes.INTEGER,
|
|
86
|
-
allowNull: false
|
|
87
|
-
},
|
|
88
|
-
authkey: {
|
|
89
|
-
type: DataTypes.STRING
|
|
90
|
-
// allowNull defaults to true
|
|
91
|
-
},
|
|
92
|
-
status: {
|
|
93
|
-
type: DataTypes.STRING
|
|
94
|
-
// allowNull defaults to true
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async findIdentityByAccessToken(token, type) {
|
|
100
|
-
|
|
101
|
-
let decoded = JsonWebToken.decode(token, {complete: true})
|
|
102
|
-
if(!decoded.payload.user) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let identity = await this.findOne({where: {id: parseInt(decoded.payload.user)}});
|
|
107
|
-
if (identity) {
|
|
108
|
-
BaseChyz.debug("Find Identity By AccessToken: User Found", decoded.payload)
|
|
109
|
-
try {
|
|
110
|
-
JsonWebToken.verify(token, identity.authkey);
|
|
111
|
-
BaseChyz.debug("Find Identity By AccessToken: User Verify Success")
|
|
112
|
-
return identity;
|
|
113
|
-
} catch (err) {
|
|
114
|
-
if (err.name == "TokenExpiredError")
|
|
115
|
-
BaseChyz.debug("Find Identity By AccessToken: Token Expired")
|
|
116
|
-
else
|
|
117
|
-
BaseChyz.debug("Find Identity By AccessToken: User Verify Failed")
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
BaseChyz.debug("Find Identity By AccessToken: User Verify Failed")
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
3
|
-
* Author: Cihan Ozturk
|
|
4
|
-
* E-mail: cihan@chy.com.tr
|
|
5
|
-
* Github:https://github.com/cihan53/
|
|
6
|
-
*/
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {DataTypes, Model} from "../../base";
|
|
11
|
-
|
|
12
|
-
export class UserPermissionClass extends Model {
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
|
|
15
|
-
public tableName() {
|
|
16
|
-
return 'user_permissions';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
public attributes() {
|
|
21
|
-
return {
|
|
22
|
-
// Model attributes are defined here
|
|
23
|
-
object_type: {
|
|
24
|
-
type: DataTypes.STRING,
|
|
25
|
-
allowNull: false
|
|
26
|
-
},
|
|
27
|
-
object_value: {
|
|
28
|
-
type: DataTypes.STRING,
|
|
29
|
-
allowNull: false
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// const UserPermission = new UserPermissionClass();
|
|
37
|
-
// export {UserPermission}
|
package/Examples/Models/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*
|
|
3
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
-
* Author: Cihan Ozturk
|
|
5
|
-
* E-mail: cihan@chy.com.tr
|
|
6
|
-
* Github:https://github.com/cihan53/
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
import {ModelManager} from "../../base";
|
|
10
|
-
// import {Order, OrderClass} from "./Order";
|
|
11
|
-
// import {Customer, CustomerClass} from "./Customer";
|
|
12
|
-
// import {Products} from "./Products";
|
|
13
|
-
// import {ProductModels} from "./ProductModels";
|
|
14
|
-
// import {Categories} from "./Categories";
|
|
15
|
-
// import {ProductToCategories} from "./ProductToCategories";
|
|
16
|
-
//
|
|
17
|
-
// Dependencies._register({Order, Customer,CustomerClass,OrderClass, Products, ProductModels, Categories, ProductToCategories});
|
|
18
|
-
//
|
|
19
|
-
// console.log("denmemem")
|