@digione/node-custom-api 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/constants/header.d.ts +10 -0
- package/constants/header.js +2 -0
- package/constants/http.d.ts +44 -0
- package/constants/http.js +2 -0
- package/database/index.d.ts +3 -0
- package/database/index.js +34 -0
- package/database/redis.d.ts +15 -0
- package/database/redis.js +68 -0
- package/errors/authError.d.ts +55 -0
- package/errors/authError.js +57 -0
- package/errors/index.d.ts +32 -0
- package/errors/index.js +113 -0
- package/index.d.ts +1 -0
- package/index.js +4 -0
- package/interface/param.d.ts +41 -0
- package/interface/param.js +2 -0
- package/middlewares/accessToken.d.ts +13 -0
- package/middlewares/accessToken.js +200 -0
- package/middlewares/coreSite.d.ts +4 -0
- package/middlewares/coreSite.js +52 -0
- package/middlewares/paramQuery.d.ts +16 -0
- package/middlewares/paramQuery.js +220 -0
- package/middlewares/refSite.d.ts +2 -0
- package/middlewares/refSite.js +58 -0
- package/middlewares/refreshToken.d.ts +2 -0
- package/middlewares/refreshToken.js +56 -0
- package/middlewares/systemSite.d.ts +6 -0
- package/middlewares/systemSite.js +106 -0
- package/middlewares/webSite.d.ts +7 -0
- package/middlewares/webSite.js +109 -0
- package/models/core/city.d.ts +66 -0
- package/models/core/city.js +79 -0
- package/models/core/country.d.ts +35 -0
- package/models/core/country.js +44 -0
- package/models/core/district.d.ts +17 -0
- package/models/core/district.js +23 -0
- package/models/core/domain.d.ts +57 -0
- package/models/core/domain.js +75 -0
- package/models/core/site.d.ts +60 -0
- package/models/core/site.js +70 -0
- package/models/core/state.d.ts +49 -0
- package/models/core/state.js +58 -0
- package/models/core/zipcode.d.ts +5 -0
- package/models/core/zipcode.js +28 -0
- package/models/stream/field.d.ts +60 -0
- package/models/stream/field.js +66 -0
- package/models/stream/field_section.d.ts +33 -0
- package/models/stream/field_section.js +39 -0
- package/models/stream/stream.d.ts +89 -0
- package/models/stream/stream.js +97 -0
- package/models/system/currency.d.ts +5 -0
- package/models/system/currency.js +32 -0
- package/models/system/email_log.d.ts +5 -0
- package/models/system/email_log.js +54 -0
- package/models/system/email_sender.d.ts +22 -0
- package/models/system/email_sender.js +53 -0
- package/models/system/email_template.d.ts +5 -0
- package/models/system/email_template.js +49 -0
- package/models/system/file.d.ts +98 -0
- package/models/system/file.js +111 -0
- package/models/system/folder.d.ts +59 -0
- package/models/system/folder.js +78 -0
- package/models/system/language.d.ts +44 -0
- package/models/system/language.js +50 -0
- package/models/system/metadata.d.ts +5 -0
- package/models/system/metadata.js +24 -0
- package/models/system/module.d.ts +5 -0
- package/models/system/module.js +35 -0
- package/models/system/notification_log.d.ts +25 -0
- package/models/system/notification_log.js +76 -0
- package/models/system/notification_module.d.ts +5 -0
- package/models/system/notification_module.js +35 -0
- package/models/system/notification_setting.d.ts +22 -0
- package/models/system/notification_setting.js +44 -0
- package/models/system/notification_template.d.ts +5 -0
- package/models/system/notification_template.js +49 -0
- package/models/system/notification_type.d.ts +5 -0
- package/models/system/notification_type.js +38 -0
- package/models/system/payment_transaction.d.ts +5 -0
- package/models/system/payment_transaction.js +46 -0
- package/models/system/pdf_page.d.ts +5 -0
- package/models/system/pdf_page.js +39 -0
- package/models/system/pdf_template.d.ts +22 -0
- package/models/system/pdf_template.js +67 -0
- package/models/system/review_template.d.ts +5 -0
- package/models/system/review_template.js +35 -0
- package/models/system/review_vote.d.ts +5 -0
- package/models/system/review_vote.js +36 -0
- package/models/system/session.d.ts +5 -0
- package/models/system/session.js +19 -0
- package/models/system/setting.d.ts +15 -0
- package/models/system/setting.js +22 -0
- package/models/system/site_token.d.ts +25 -0
- package/models/system/site_token.js +31 -0
- package/models/system/sms_log.d.ts +4 -0
- package/models/system/sms_log.js +52 -0
- package/models/system/sms_setting.d.ts +4 -0
- package/models/system/sms_setting.js +39 -0
- package/models/system/sms_template.d.ts +5 -0
- package/models/system/sms_template.js +48 -0
- package/models/system/tax.d.ts +5 -0
- package/models/system/tax.js +33 -0
- package/models/system/website.d.ts +56 -0
- package/models/system/website.js +66 -0
- package/models/system/zone.d.ts +57 -0
- package/models/system/zone.js +141 -0
- package/models/user/access_token.d.ts +37 -0
- package/models/user/access_token.js +46 -0
- package/models/user/address.d.ts +69 -0
- package/models/user/address.js +119 -0
- package/models/user/b2b_group.d.ts +57 -0
- package/models/user/b2b_group.js +63 -0
- package/models/user/group.d.ts +28 -0
- package/models/user/group.js +34 -0
- package/models/user/group_permission.d.ts +4 -0
- package/models/user/group_permission.js +27 -0
- package/models/user/notification_token.d.ts +32 -0
- package/models/user/notification_token.js +39 -0
- package/models/user/organ.d.ts +85 -0
- package/models/user/organ.js +100 -0
- package/models/user/profile.d.ts +31 -0
- package/models/user/profile.js +37 -0
- package/models/user/refresh_token.d.ts +41 -0
- package/models/user/refresh_token.js +51 -0
- package/models/user/team.d.ts +59 -0
- package/models/user/team.js +71 -0
- package/models/user/user.d.ts +79 -0
- package/models/user/user.js +100 -0
- package/models/user/user_organ.d.ts +52 -0
- package/models/user/user_organ.js +87 -0
- package/package.json +59 -0
- package/utils/auth.d.ts +25 -0
- package/utils/auth.js +137 -0
- package/utils/config.d.ts +8 -0
- package/utils/config.js +6 -0
- package/utils/core.d.ts +6 -0
- package/utils/core.js +39 -0
- package/utils/currency.d.ts +16 -0
- package/utils/currency.js +38 -0
- package/utils/db.d.ts +94 -0
- package/utils/db.js +399 -0
- package/utils/file.d.ts +232 -0
- package/utils/file.js +772 -0
- package/utils/helper.d.ts +113 -0
- package/utils/helper.js +508 -0
- package/utils/index.d.ts +10 -0
- package/utils/index.js +13 -0
- package/utils/language.d.ts +18 -0
- package/utils/language.js +48 -0
- package/utils/metadata.d.ts +18 -0
- package/utils/metadata.js +50 -0
- package/utils/session.d.ts +37 -0
- package/utils/session.js +60 -0
- package/utils/setting.d.ts +14 -0
- package/utils/setting.js +70 -0
- package/utils/stream.d.ts +303 -0
- package/utils/stream.js +1893 -0
- package/utils/user.d.ts +61 -0
- package/utils/user.js +282 -0
- package/utils/validator.d.ts +56 -0
- package/utils/validator.js +269 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserOrganAssociation = exports.UserOrganModel = exports.UserOrganAttr = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const sequelize = require("sequelize");
|
|
6
|
+
const db_1 = require("../../utils/db");
|
|
7
|
+
const tax_1 = require("../system/tax");
|
|
8
|
+
const user_1 = require("./user");
|
|
9
|
+
const database_1 = require("../../database");
|
|
10
|
+
exports.UserOrganAttr = {
|
|
11
|
+
id: {
|
|
12
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
13
|
+
primaryKey: true,
|
|
14
|
+
autoIncrement: true,
|
|
15
|
+
allowNull: false
|
|
16
|
+
},
|
|
17
|
+
created: {
|
|
18
|
+
type: sequelize.DATE,
|
|
19
|
+
allowNull: false,
|
|
20
|
+
defaultValue: sequelize.NOW
|
|
21
|
+
},
|
|
22
|
+
updated: sequelize.DATE,
|
|
23
|
+
ordering_count: sequelize.INTEGER({ length: 11 }),
|
|
24
|
+
created_by: sequelize.INTEGER({ length: 11 }),
|
|
25
|
+
contact_name: sequelize.STRING(255),
|
|
26
|
+
username: sequelize.STRING(255),
|
|
27
|
+
organ_phone: {
|
|
28
|
+
type: sequelize.STRING(255),
|
|
29
|
+
allowNull: false,
|
|
30
|
+
defaultValue: ""
|
|
31
|
+
},
|
|
32
|
+
organ_fax: {
|
|
33
|
+
type: sequelize.STRING(255),
|
|
34
|
+
allowNull: false,
|
|
35
|
+
defaultValue: ""
|
|
36
|
+
},
|
|
37
|
+
organ_email: {
|
|
38
|
+
type: sequelize.STRING(255),
|
|
39
|
+
allowNull: false,
|
|
40
|
+
defaultValue: ""
|
|
41
|
+
},
|
|
42
|
+
organ_name: {
|
|
43
|
+
type: sequelize.STRING
|
|
44
|
+
},
|
|
45
|
+
organ_website: {
|
|
46
|
+
type: sequelize.STRING
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
50
|
+
allowNull: false,
|
|
51
|
+
defaultValue: 1
|
|
52
|
+
},
|
|
53
|
+
tax_id: {
|
|
54
|
+
type: sequelize.STRING(255)
|
|
55
|
+
},
|
|
56
|
+
parent_id: sequelize.INTEGER({ length: 11 }),
|
|
57
|
+
vat_id: sequelize.INTEGER({ length: 11 }),
|
|
58
|
+
fee_id: sequelize.INTEGER({ length: 11 }),
|
|
59
|
+
status: sequelize.STRING({ length: 15 }),
|
|
60
|
+
setting: sequelize.JSON,
|
|
61
|
+
setting_user: sequelize.JSON
|
|
62
|
+
};
|
|
63
|
+
const UserOrganModel = database_1.default.define("UserOrgan", exports.UserOrganAttr, {
|
|
64
|
+
tableName: 'organs'
|
|
65
|
+
});
|
|
66
|
+
exports.UserOrganModel = UserOrganModel;
|
|
67
|
+
const UserOrganAssociation = {
|
|
68
|
+
organ: {
|
|
69
|
+
model: UserOrganModel,
|
|
70
|
+
alias: "organ",
|
|
71
|
+
join: (ref, { attributes_all = false, attributes = undefined, required = false } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
if (attributes_all) {
|
|
73
|
+
attributes = yield (0, db_1.getFieldAll)(ref + '_' + UserOrganModel.getTableName());
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
required,
|
|
77
|
+
attributes,
|
|
78
|
+
as: UserOrganAssociation.organ.alias,
|
|
79
|
+
model: UserOrganAssociation.organ.model.schema(ref, "_")
|
|
80
|
+
};
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
vat: {
|
|
84
|
+
model: tax_1.SystemTaxModel,
|
|
85
|
+
alias: "vat",
|
|
86
|
+
join: (ref, { attributes = undefined, required = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
return {
|
|
88
|
+
required,
|
|
89
|
+
attributes,
|
|
90
|
+
model: UserOrganAssociation.vat.model.schema(ref, "_"),
|
|
91
|
+
as: UserOrganAssociation.vat.alias
|
|
92
|
+
};
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.UserOrganAssociation = UserOrganAssociation;
|
|
97
|
+
// organ
|
|
98
|
+
user_1.UserModel.belongsTo(UserOrganAssociation.organ.model, { as: UserOrganAssociation.organ.alias, foreignKey: "organ_id" });
|
|
99
|
+
// vat
|
|
100
|
+
UserOrganModel.belongsTo(UserOrganAssociation.vat.model, { as: UserOrganAssociation.vat.alias, foreignKey: "vat_id", targetKey: "id" });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as sequelize from "sequelize";
|
|
2
|
+
export declare const UserProfileAttr: {
|
|
3
|
+
id: {
|
|
4
|
+
type: sequelize.IntegerDataType;
|
|
5
|
+
primaryKey: boolean;
|
|
6
|
+
allowNull: boolean;
|
|
7
|
+
autoIncrement: boolean;
|
|
8
|
+
};
|
|
9
|
+
created: {
|
|
10
|
+
type: sequelize.DateDataTypeConstructor;
|
|
11
|
+
allowNull: boolean;
|
|
12
|
+
defaultValue: sequelize.AbstractDataTypeConstructor;
|
|
13
|
+
};
|
|
14
|
+
updated: sequelize.DateDataTypeConstructor;
|
|
15
|
+
ordering_count: {
|
|
16
|
+
type: sequelize.IntegerDataType;
|
|
17
|
+
defaultValue: number;
|
|
18
|
+
};
|
|
19
|
+
created_by: {
|
|
20
|
+
type: sequelize.IntegerDataType;
|
|
21
|
+
};
|
|
22
|
+
user_id: {
|
|
23
|
+
type: sequelize.IntegerDataType;
|
|
24
|
+
allowNull: boolean;
|
|
25
|
+
};
|
|
26
|
+
first_name: sequelize.StringDataType;
|
|
27
|
+
last_name: sequelize.StringDataType;
|
|
28
|
+
display_name: sequelize.StringDataType;
|
|
29
|
+
};
|
|
30
|
+
declare const UserProfileModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
31
|
+
export { UserProfileModel };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserProfileModel = exports.UserProfileAttr = void 0;
|
|
4
|
+
const sequelize = require("sequelize");
|
|
5
|
+
const database_1 = require("../../database");
|
|
6
|
+
exports.UserProfileAttr = {
|
|
7
|
+
id: {
|
|
8
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
9
|
+
primaryKey: true,
|
|
10
|
+
allowNull: false,
|
|
11
|
+
autoIncrement: true
|
|
12
|
+
},
|
|
13
|
+
created: {
|
|
14
|
+
type: sequelize.DATE,
|
|
15
|
+
allowNull: false,
|
|
16
|
+
defaultValue: sequelize.NOW
|
|
17
|
+
},
|
|
18
|
+
updated: sequelize.DATE,
|
|
19
|
+
ordering_count: {
|
|
20
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
21
|
+
defaultValue: 0
|
|
22
|
+
},
|
|
23
|
+
created_by: {
|
|
24
|
+
type: sequelize.INTEGER({ length: 11 })
|
|
25
|
+
},
|
|
26
|
+
user_id: {
|
|
27
|
+
type: sequelize.INTEGER({ length: 11 }).UNSIGNED,
|
|
28
|
+
allowNull: false
|
|
29
|
+
},
|
|
30
|
+
first_name: sequelize.STRING(50),
|
|
31
|
+
last_name: sequelize.STRING(50),
|
|
32
|
+
display_name: sequelize.STRING(50)
|
|
33
|
+
};
|
|
34
|
+
const UserProfileModel = database_1.default.define("UserProfile", exports.UserProfileAttr, {
|
|
35
|
+
tableName: 'profiles'
|
|
36
|
+
});
|
|
37
|
+
exports.UserProfileModel = UserProfileModel;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as sequelize from 'sequelize';
|
|
2
|
+
export declare const RefreshTokenAttr: {
|
|
3
|
+
id: {
|
|
4
|
+
type: sequelize.StringDataTypeConstructor;
|
|
5
|
+
primaryKey: boolean;
|
|
6
|
+
allowNull: boolean;
|
|
7
|
+
};
|
|
8
|
+
user_id: {
|
|
9
|
+
type: sequelize.IntegerDataTypeConstructor;
|
|
10
|
+
allowNull: boolean;
|
|
11
|
+
references: {
|
|
12
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
13
|
+
key: string;
|
|
14
|
+
};
|
|
15
|
+
onDelete: string;
|
|
16
|
+
};
|
|
17
|
+
token: {
|
|
18
|
+
type: sequelize.TextDataTypeConstructor;
|
|
19
|
+
allowNull: boolean;
|
|
20
|
+
};
|
|
21
|
+
expired_at: {
|
|
22
|
+
type: sequelize.DateDataTypeConstructor;
|
|
23
|
+
allowNull: boolean;
|
|
24
|
+
};
|
|
25
|
+
organ_id: sequelize.IntegerDataTypeConstructor;
|
|
26
|
+
group_id: sequelize.IntegerDataTypeConstructor;
|
|
27
|
+
b2b_group_id: sequelize.IntegerDataTypeConstructor;
|
|
28
|
+
team_id: sequelize.StringDataType;
|
|
29
|
+
};
|
|
30
|
+
declare const RefreshTokenModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
31
|
+
export declare const RefreshAssociation: {
|
|
32
|
+
access_token: {
|
|
33
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
34
|
+
alias: string;
|
|
35
|
+
join: (ref: any) => {
|
|
36
|
+
as: string;
|
|
37
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export { RefreshTokenModel };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RefreshTokenModel = exports.RefreshAssociation = exports.RefreshTokenAttr = void 0;
|
|
4
|
+
const sequelize = require("sequelize");
|
|
5
|
+
const user_1 = require("./user");
|
|
6
|
+
const access_token_1 = require("./access_token");
|
|
7
|
+
const database_1 = require("../../database");
|
|
8
|
+
exports.RefreshTokenAttr = {
|
|
9
|
+
id: {
|
|
10
|
+
type: sequelize.STRING,
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
allowNull: false
|
|
13
|
+
},
|
|
14
|
+
user_id: {
|
|
15
|
+
type: sequelize.INTEGER,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
references: {
|
|
18
|
+
model: user_1.UserModel,
|
|
19
|
+
key: "id"
|
|
20
|
+
},
|
|
21
|
+
onDelete: "CASCADE"
|
|
22
|
+
},
|
|
23
|
+
token: {
|
|
24
|
+
type: sequelize.TEXT,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
expired_at: {
|
|
28
|
+
type: sequelize.DATE,
|
|
29
|
+
allowNull: false
|
|
30
|
+
},
|
|
31
|
+
organ_id: sequelize.INTEGER,
|
|
32
|
+
group_id: sequelize.INTEGER,
|
|
33
|
+
b2b_group_id: sequelize.INTEGER,
|
|
34
|
+
team_id: sequelize.STRING(100)
|
|
35
|
+
};
|
|
36
|
+
const RefreshTokenModel = database_1.default.define("RefreshToken", exports.RefreshTokenAttr, {
|
|
37
|
+
tableName: "refresh_token"
|
|
38
|
+
});
|
|
39
|
+
exports.RefreshTokenModel = RefreshTokenModel;
|
|
40
|
+
exports.RefreshAssociation = {
|
|
41
|
+
access_token: {
|
|
42
|
+
model: access_token_1.AccessTokenModel,
|
|
43
|
+
alias: 'accessToken',
|
|
44
|
+
join: (ref) => {
|
|
45
|
+
return {
|
|
46
|
+
as: exports.RefreshAssociation.access_token.alias,
|
|
47
|
+
model: exports.RefreshAssociation.access_token.model.schema(ref, "_")
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as sequelize from "sequelize";
|
|
2
|
+
export declare const UserTeamAttr: {
|
|
3
|
+
id: {
|
|
4
|
+
type: sequelize.IntegerDataType;
|
|
5
|
+
primaryKey: boolean;
|
|
6
|
+
allowNull: boolean;
|
|
7
|
+
};
|
|
8
|
+
created: {
|
|
9
|
+
type: sequelize.DateDataTypeConstructor;
|
|
10
|
+
allowNull: boolean;
|
|
11
|
+
};
|
|
12
|
+
updated: sequelize.DateDataTypeConstructor;
|
|
13
|
+
created_by: sequelize.IntegerDataType;
|
|
14
|
+
organ_id: sequelize.IntegerDataType;
|
|
15
|
+
ordering_count: sequelize.IntegerDataType;
|
|
16
|
+
title: sequelize.StringDataType;
|
|
17
|
+
description: sequelize.StringDataType;
|
|
18
|
+
default: {
|
|
19
|
+
type: sequelize.IntegerDataType;
|
|
20
|
+
defaultValue: number;
|
|
21
|
+
allowNull: boolean;
|
|
22
|
+
};
|
|
23
|
+
shared: {
|
|
24
|
+
type: sequelize.IntegerDataType;
|
|
25
|
+
allowNull: boolean;
|
|
26
|
+
defaultValue: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
declare const UserTeamModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
30
|
+
export declare const UserUserTeamAttr: {
|
|
31
|
+
staff_id: {
|
|
32
|
+
type: sequelize.IntegerDataType;
|
|
33
|
+
primaryKey: boolean;
|
|
34
|
+
allowNull: boolean;
|
|
35
|
+
};
|
|
36
|
+
team_id: {
|
|
37
|
+
type: sequelize.IntegerDataType;
|
|
38
|
+
primaryKey: boolean;
|
|
39
|
+
allowNull: boolean;
|
|
40
|
+
};
|
|
41
|
+
organ_id: sequelize.IntegerDataType;
|
|
42
|
+
};
|
|
43
|
+
declare const UserUserTeamModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
44
|
+
export declare const UserUserTeamAssociation: {
|
|
45
|
+
staff: {
|
|
46
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
47
|
+
alias: string;
|
|
48
|
+
join: (ref: any, { where, attributes }?: {
|
|
49
|
+
where?: {};
|
|
50
|
+
attributes?: any;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
where: {};
|
|
53
|
+
attributes: any;
|
|
54
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
55
|
+
as: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export { UserTeamModel, UserUserTeamModel };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserUserTeamModel = exports.UserTeamModel = exports.UserUserTeamAssociation = exports.UserUserTeamAttr = exports.UserTeamAttr = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const sequelize = require("sequelize");
|
|
6
|
+
const database_1 = require("../../database");
|
|
7
|
+
const user_1 = require("../../models/user/user");
|
|
8
|
+
exports.UserTeamAttr = {
|
|
9
|
+
id: {
|
|
10
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
11
|
+
primaryKey: true,
|
|
12
|
+
allowNull: false
|
|
13
|
+
},
|
|
14
|
+
created: {
|
|
15
|
+
type: sequelize.DATE,
|
|
16
|
+
allowNull: false
|
|
17
|
+
},
|
|
18
|
+
updated: sequelize.DATE,
|
|
19
|
+
created_by: sequelize.INTEGER({ length: 11 }),
|
|
20
|
+
organ_id: sequelize.INTEGER({ length: 11 }),
|
|
21
|
+
ordering_count: sequelize.INTEGER({ length: 11 }),
|
|
22
|
+
title: sequelize.STRING(200),
|
|
23
|
+
description: sequelize.STRING(255),
|
|
24
|
+
default: {
|
|
25
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
26
|
+
defaultValue: 0,
|
|
27
|
+
allowNull: false
|
|
28
|
+
},
|
|
29
|
+
shared: {
|
|
30
|
+
type: sequelize.INTEGER({ length: 5 }),
|
|
31
|
+
allowNull: false,
|
|
32
|
+
defaultValue: 1
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const UserTeamModel = database_1.default.define("UserTeam", exports.UserTeamAttr, {
|
|
36
|
+
tableName: 'teams'
|
|
37
|
+
});
|
|
38
|
+
exports.UserTeamModel = UserTeamModel;
|
|
39
|
+
exports.UserUserTeamAttr = {
|
|
40
|
+
staff_id: {
|
|
41
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
42
|
+
primaryKey: true,
|
|
43
|
+
allowNull: false
|
|
44
|
+
},
|
|
45
|
+
team_id: {
|
|
46
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
47
|
+
primaryKey: true,
|
|
48
|
+
allowNull: false
|
|
49
|
+
},
|
|
50
|
+
organ_id: sequelize.INTEGER({ length: 11 })
|
|
51
|
+
};
|
|
52
|
+
const UserUserTeamModel = database_1.default.define("UserUserTeam", exports.UserUserTeamAttr, {
|
|
53
|
+
tableName: 'users_teams'
|
|
54
|
+
});
|
|
55
|
+
exports.UserUserTeamModel = UserUserTeamModel;
|
|
56
|
+
exports.UserUserTeamAssociation = {
|
|
57
|
+
staff: {
|
|
58
|
+
model: user_1.UserModel,
|
|
59
|
+
alias: "staff",
|
|
60
|
+
join: (ref, { where = {}, attributes = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
return {
|
|
62
|
+
where,
|
|
63
|
+
attributes,
|
|
64
|
+
model: exports.UserUserTeamAssociation.staff.model.schema(ref, "_"),
|
|
65
|
+
as: exports.UserUserTeamAssociation.staff.alias
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// staff
|
|
71
|
+
UserUserTeamModel.belongsTo(exports.UserUserTeamAssociation.staff.model, { as: exports.UserUserTeamAssociation.staff.alias, targetKey: "id", foreignKey: "staff_id" });
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as sequelize from "sequelize";
|
|
2
|
+
export declare const UserAttr: {
|
|
3
|
+
id: {
|
|
4
|
+
type: sequelize.IntegerDataTypeConstructor;
|
|
5
|
+
primaryKey: boolean;
|
|
6
|
+
autoIncrement: boolean;
|
|
7
|
+
allowNull: boolean;
|
|
8
|
+
};
|
|
9
|
+
email: {
|
|
10
|
+
type: sequelize.StringDataType;
|
|
11
|
+
allowNull: boolean;
|
|
12
|
+
unique: boolean;
|
|
13
|
+
};
|
|
14
|
+
password: {
|
|
15
|
+
type: sequelize.StringDataType;
|
|
16
|
+
allowNull: boolean;
|
|
17
|
+
};
|
|
18
|
+
salt: {
|
|
19
|
+
type: sequelize.StringDataType;
|
|
20
|
+
allowNull: boolean;
|
|
21
|
+
defaultValue: string;
|
|
22
|
+
};
|
|
23
|
+
group_id: {
|
|
24
|
+
type: sequelize.IntegerDataType;
|
|
25
|
+
defaultValue: number;
|
|
26
|
+
};
|
|
27
|
+
ip_address: {
|
|
28
|
+
type: sequelize.StringDataType;
|
|
29
|
+
};
|
|
30
|
+
active: {
|
|
31
|
+
type: sequelize.IntegerDataType;
|
|
32
|
+
defaultValue: number;
|
|
33
|
+
};
|
|
34
|
+
activation_code: {
|
|
35
|
+
type: sequelize.StringDataType;
|
|
36
|
+
};
|
|
37
|
+
created_on: {
|
|
38
|
+
type: sequelize.IntegerDataType;
|
|
39
|
+
allowNull: boolean;
|
|
40
|
+
defaultValue: number;
|
|
41
|
+
};
|
|
42
|
+
last_login: {
|
|
43
|
+
type: sequelize.IntegerDataType;
|
|
44
|
+
allowNull: boolean;
|
|
45
|
+
defaultValue: number;
|
|
46
|
+
};
|
|
47
|
+
username: {
|
|
48
|
+
type: sequelize.StringDataType;
|
|
49
|
+
};
|
|
50
|
+
organ_id: {
|
|
51
|
+
type: sequelize.IntegerDataType;
|
|
52
|
+
};
|
|
53
|
+
member_id: {
|
|
54
|
+
type: sequelize.StringDataType;
|
|
55
|
+
};
|
|
56
|
+
provider: sequelize.StringDataType;
|
|
57
|
+
mobile: sequelize.StringDataType;
|
|
58
|
+
mobile_code: sequelize.StringDataType;
|
|
59
|
+
};
|
|
60
|
+
declare const UserModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
61
|
+
declare const UserAssociation: {
|
|
62
|
+
profile: {
|
|
63
|
+
attr_user: any[];
|
|
64
|
+
attr_profile: string[];
|
|
65
|
+
attributes: (parent?: string) => any[];
|
|
66
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
67
|
+
alias: string;
|
|
68
|
+
join: (ref: any, { attributes_all, attributes }?: {
|
|
69
|
+
attributes_all?: boolean;
|
|
70
|
+
attributes?: any;
|
|
71
|
+
}) => Promise<{
|
|
72
|
+
required: boolean;
|
|
73
|
+
attributes: any;
|
|
74
|
+
as: string;
|
|
75
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export { UserModel, UserAssociation };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAssociation = exports.UserModel = exports.UserAttr = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const database_1 = require("../../database");
|
|
6
|
+
const profile_1 = require("./profile");
|
|
7
|
+
const db_1 = require("../../utils/db");
|
|
8
|
+
const sequelize_1 = require("sequelize");
|
|
9
|
+
const sequelize = require("sequelize");
|
|
10
|
+
exports.UserAttr = {
|
|
11
|
+
id: {
|
|
12
|
+
type: sequelize.INTEGER,
|
|
13
|
+
primaryKey: true,
|
|
14
|
+
autoIncrement: true,
|
|
15
|
+
allowNull: false
|
|
16
|
+
},
|
|
17
|
+
email: {
|
|
18
|
+
type: sequelize.STRING(40),
|
|
19
|
+
allowNull: false,
|
|
20
|
+
unique: true
|
|
21
|
+
},
|
|
22
|
+
password: {
|
|
23
|
+
type: sequelize.STRING(100),
|
|
24
|
+
allowNull: false
|
|
25
|
+
},
|
|
26
|
+
salt: {
|
|
27
|
+
type: sequelize.STRING(7),
|
|
28
|
+
allowNull: false,
|
|
29
|
+
defaultValue: ""
|
|
30
|
+
},
|
|
31
|
+
group_id: {
|
|
32
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
33
|
+
defaultValue: 2
|
|
34
|
+
},
|
|
35
|
+
ip_address: {
|
|
36
|
+
type: sequelize.STRING(45)
|
|
37
|
+
},
|
|
38
|
+
active: {
|
|
39
|
+
type: sequelize.INTEGER({ length: 1 }),
|
|
40
|
+
defaultValue: 0
|
|
41
|
+
},
|
|
42
|
+
activation_code: {
|
|
43
|
+
type: sequelize.STRING(40)
|
|
44
|
+
},
|
|
45
|
+
created_on: {
|
|
46
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
47
|
+
allowNull: false,
|
|
48
|
+
defaultValue: 0
|
|
49
|
+
},
|
|
50
|
+
last_login: {
|
|
51
|
+
type: sequelize.INTEGER({ length: 11 }),
|
|
52
|
+
allowNull: false,
|
|
53
|
+
defaultValue: 0
|
|
54
|
+
},
|
|
55
|
+
username: {
|
|
56
|
+
type: sequelize.STRING(20)
|
|
57
|
+
},
|
|
58
|
+
organ_id: {
|
|
59
|
+
type: sequelize.INTEGER({ length: 11 })
|
|
60
|
+
},
|
|
61
|
+
// points:sequelize.INTEGER({length:11}),
|
|
62
|
+
member_id: {
|
|
63
|
+
type: sequelize.STRING(100)
|
|
64
|
+
},
|
|
65
|
+
provider: sequelize.STRING(40),
|
|
66
|
+
mobile: sequelize.STRING(20),
|
|
67
|
+
mobile_code: sequelize.STRING(10)
|
|
68
|
+
};
|
|
69
|
+
const UserModel = database_1.default.define("User", exports.UserAttr, {
|
|
70
|
+
tableName: 'users'
|
|
71
|
+
});
|
|
72
|
+
exports.UserModel = UserModel;
|
|
73
|
+
const UserAssociation = {
|
|
74
|
+
profile: {
|
|
75
|
+
attr_user: ['id', 'email', 'username', 'group_id'],
|
|
76
|
+
attr_profile: ['first_name', 'last_name', 'display_name', 'mobile'],
|
|
77
|
+
attributes: (parent = "") => {
|
|
78
|
+
if (parent) {
|
|
79
|
+
parent = parent + "->";
|
|
80
|
+
}
|
|
81
|
+
return UserAssociation.profile.attr_user.concat(UserAssociation.profile.attr_profile.map(i => [(0, sequelize_1.literal)("`" + parent + "profile`." + i), i]));
|
|
82
|
+
},
|
|
83
|
+
model: profile_1.UserProfileModel,
|
|
84
|
+
alias: "profile",
|
|
85
|
+
join: (ref, { attributes_all = false, attributes = undefined } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
if (attributes_all) {
|
|
87
|
+
attributes = yield (0, db_1.getFieldAll)(ref + '_' + UserAssociation.profile.model.getTableName());
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
required: false,
|
|
91
|
+
attributes,
|
|
92
|
+
as: UserAssociation.profile.alias,
|
|
93
|
+
model: UserAssociation.profile.model.schema(ref, "_")
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
exports.UserAssociation = UserAssociation;
|
|
99
|
+
// profile
|
|
100
|
+
UserModel.hasOne(UserAssociation.profile.model, { as: UserAssociation.profile.alias, foreignKey: { name: 'user_id', allowNull: false } });
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as sequelize from "sequelize";
|
|
2
|
+
export declare const UserUserOrganTable = "users_organs";
|
|
3
|
+
export declare const UserUserOrganAttr: sequelize.ModelAttributes<sequelize.Model<any, any>, any>;
|
|
4
|
+
declare const UserUserOrganModel: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
5
|
+
export declare const UserUserOrganAssociation: {
|
|
6
|
+
organ: {
|
|
7
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
8
|
+
alias: string;
|
|
9
|
+
join: (ref: any, { required, where, attributes }?: {
|
|
10
|
+
required?: boolean;
|
|
11
|
+
where?: {};
|
|
12
|
+
attributes?: any;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
where: {};
|
|
15
|
+
required: boolean;
|
|
16
|
+
attributes: any;
|
|
17
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
18
|
+
as: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
user: {
|
|
22
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
23
|
+
alias: string;
|
|
24
|
+
join: (ref: any, { attributes }?: {
|
|
25
|
+
attributes?: any;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
attributes: any;
|
|
28
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
29
|
+
as: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const UserUserAssociation: {
|
|
34
|
+
organ: {
|
|
35
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
36
|
+
alias: string;
|
|
37
|
+
join: (ref: any, { where, required, attributes, organ }?: {
|
|
38
|
+
where?: {};
|
|
39
|
+
required?: boolean;
|
|
40
|
+
attributes?: any;
|
|
41
|
+
organ?: boolean;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
where: {};
|
|
44
|
+
required: boolean;
|
|
45
|
+
attributes: any;
|
|
46
|
+
model: sequelize.ModelCtor<sequelize.Model<any, any>>;
|
|
47
|
+
as: string;
|
|
48
|
+
include: any[];
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export { UserUserOrganModel };
|