@winible/winible-typed 2.16.5 → 2.17.0
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/typed-model/index.js +7 -1
- package/dist/typed-model/index.js.map +1 -1
- package/dist/typed-model/organization.js +58 -0
- package/dist/typed-model/organization.js.map +1 -0
- package/dist/typed-model/stores_on_organizations.js +56 -0
- package/dist/typed-model/stores_on_organizations.js.map +1 -0
- package/dist/typed-model/user.js +1 -1
- package/dist/typed-model/users_on_organizations.js +56 -0
- package/dist/typed-model/users_on_organizations.js.map +1 -0
- package/package.json +1 -1
- package/typed-model/index.ts +3 -0
- package/typed-model/organization.ts +80 -0
- package/typed-model/stores_on_organizations.ts +78 -0
- package/typed-model/user.ts +2 -2
- package/typed-model/users_on_organizations.ts +78 -0
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.pbSequelize = exports.SubscriberDiscordIntegration = exports.DiscordIntegration = exports.SportOnPosts = exports.Sport = exports.Integration = exports.UsersOnCreators = exports.Store = exports.Application = exports.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.FreeSubscriptionPlan = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.Notification = exports.Media = exports.MediaAsset = exports.Transaction = exports.ContentLike = void 0;
|
6
|
+
exports.pbSequelize = exports.StoresOnOrganizations = exports.UsersOnOrganizations = exports.Organization = exports.SubscriberDiscordIntegration = exports.DiscordIntegration = exports.SportOnPosts = exports.Sport = exports.Integration = exports.UsersOnCreators = exports.Store = exports.Application = exports.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.FreeSubscriptionPlan = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.Notification = exports.Media = exports.MediaAsset = exports.Transaction = exports.ContentLike = void 0;
|
7
7
|
var content_like_1 = require("./content-like");
|
8
8
|
Object.defineProperty(exports, "ContentLike", { enumerable: true, get: function () { return __importDefault(content_like_1).default; } });
|
9
9
|
var transaction_1 = require("./transaction");
|
@@ -62,6 +62,12 @@ var discord_integration_1 = require("./discord-integration");
|
|
62
62
|
Object.defineProperty(exports, "DiscordIntegration", { enumerable: true, get: function () { return __importDefault(discord_integration_1).default; } });
|
63
63
|
var subscriber_discord_integration_1 = require("./subscriber-discord-integration");
|
64
64
|
Object.defineProperty(exports, "SubscriberDiscordIntegration", { enumerable: true, get: function () { return __importDefault(subscriber_discord_integration_1).default; } });
|
65
|
+
var organization_1 = require("./organization");
|
66
|
+
Object.defineProperty(exports, "Organization", { enumerable: true, get: function () { return __importDefault(organization_1).default; } });
|
67
|
+
var users_on_organizations_1 = require("./users_on_organizations");
|
68
|
+
Object.defineProperty(exports, "UsersOnOrganizations", { enumerable: true, get: function () { return __importDefault(users_on_organizations_1).default; } });
|
69
|
+
var stores_on_organizations_1 = require("./stores_on_organizations");
|
70
|
+
Object.defineProperty(exports, "StoresOnOrganizations", { enumerable: true, get: function () { return __importDefault(stores_on_organizations_1).default; } });
|
65
71
|
var pb_sequelize_1 = require("./pb-sequelize");
|
66
72
|
Object.defineProperty(exports, "pbSequelize", { enumerable: true, get: function () { return __importDefault(pb_sequelize_1).default; } });
|
67
73
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../typed-model/index.ts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AAlD,+HAAA,OAAO,OAAgB;AAChC,6DAAsE;AAA7D,0IAAA,OAAO,OAAsB;AACtC,mFAA2F;AAAlF,+JAAA,OAAO,OAAgC;AAChD,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,mEAA2E;AAAlE,+IAAA,OAAO,OAAwB;AACxC,qEAA6E;AAApE,iJAAA,OAAO,OAAyB;AACzC,+CAAwD;AAA/C,4HAAA,OAAO,OAAe"}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const sequelize_1 = require("sequelize");
|
7
|
+
const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
|
8
|
+
const user_1 = __importDefault(require("./user"));
|
9
|
+
const integration_1 = __importDefault(require("./integration"));
|
10
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
11
|
+
class Organization extends sequelize_1.Model {
|
12
|
+
}
|
13
|
+
Organization.init({
|
14
|
+
id: {
|
15
|
+
type: sequelize_1.DataTypes.BIGINT,
|
16
|
+
primaryKey: true,
|
17
|
+
allowNull: false,
|
18
|
+
defaultValue: pb_sequelize_1.default.fn("next_id"),
|
19
|
+
},
|
20
|
+
ownerId: {
|
21
|
+
type: sequelize_1.DataTypes.BIGINT,
|
22
|
+
allowNull: false,
|
23
|
+
field: "owner_id",
|
24
|
+
references: {
|
25
|
+
model: user_1.default,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
integrationId: {
|
29
|
+
type: sequelize_1.DataTypes.BIGINT,
|
30
|
+
allowNull: true,
|
31
|
+
field: "integration_id",
|
32
|
+
references: {
|
33
|
+
model: integration_1.default,
|
34
|
+
},
|
35
|
+
},
|
36
|
+
organizationName: {
|
37
|
+
type: sequelize_1.DataTypes.STRING,
|
38
|
+
allowNull: false,
|
39
|
+
field: "organization_name",
|
40
|
+
},
|
41
|
+
createdAt: sequelize_1.DataTypes.DATE,
|
42
|
+
updatedAt: sequelize_1.DataTypes.DATE,
|
43
|
+
}, {
|
44
|
+
tableName: "organizations",
|
45
|
+
sequelize: pb_sequelize_1.default,
|
46
|
+
});
|
47
|
+
Organization.hasOne(user_1.default, {
|
48
|
+
foreignKey: "id",
|
49
|
+
sourceKey: "ownerId",
|
50
|
+
onDelete: "NO ACTION",
|
51
|
+
});
|
52
|
+
Organization.hasOne(integration_1.default, {
|
53
|
+
foreignKey: "id",
|
54
|
+
sourceKey: "integrationId",
|
55
|
+
onDelete: "NO ACTION",
|
56
|
+
});
|
57
|
+
exports.default = Organization;
|
58
|
+
//# sourceMappingURL=organization.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"organization.js","sourceRoot":"","sources":["../../typed-model/organization.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAC1B,gEAAwC;AAExC,mEAAmE;AACnE,MAAM,YAAa,SAAQ,iBAG1B;CAWA;AAED,YAAY,CAAC,IAAI,CACf;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,OAAO,EAAE;QACP,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,IAAI;QACf,KAAK,EAAE,gBAAgB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,qBAAW;SACnB;KACF;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,mBAAmB;KAC3B;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,eAAe;IAC1B,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,YAAY,CAAC,MAAM,CAAC,cAAI,EAAE;IACxB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC;AAEH,YAAY,CAAC,MAAM,CAAC,qBAAW,EAAE;IAC/B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC;AAEH,kBAAe,YAAY,CAAC"}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const sequelize_1 = require("sequelize");
|
7
|
+
const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
|
8
|
+
const store_1 = __importDefault(require("./store"));
|
9
|
+
const organization_1 = __importDefault(require("./organization"));
|
10
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
11
|
+
class StoresOnOrganizations extends sequelize_1.Model {
|
12
|
+
}
|
13
|
+
StoresOnOrganizations.init({
|
14
|
+
id: {
|
15
|
+
type: sequelize_1.DataTypes.BIGINT,
|
16
|
+
primaryKey: true,
|
17
|
+
allowNull: false,
|
18
|
+
defaultValue: pb_sequelize_1.default.fn("next_id"),
|
19
|
+
},
|
20
|
+
storeId: {
|
21
|
+
type: sequelize_1.DataTypes.BIGINT,
|
22
|
+
allowNull: false,
|
23
|
+
field: "store_id",
|
24
|
+
references: {
|
25
|
+
model: store_1.default,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
organizationId: {
|
29
|
+
type: sequelize_1.DataTypes.BIGINT,
|
30
|
+
allowNull: false,
|
31
|
+
field: "organization_id",
|
32
|
+
references: {
|
33
|
+
model: organization_1.default,
|
34
|
+
},
|
35
|
+
},
|
36
|
+
ratePercentage: {
|
37
|
+
type: sequelize_1.DataTypes.INTEGER,
|
38
|
+
allowNull: false,
|
39
|
+
field: "rate_percentage",
|
40
|
+
},
|
41
|
+
createdAt: sequelize_1.DataTypes.DATE,
|
42
|
+
updatedAt: sequelize_1.DataTypes.DATE,
|
43
|
+
}, {
|
44
|
+
tableName: "stores_on_organizations",
|
45
|
+
sequelize: pb_sequelize_1.default,
|
46
|
+
});
|
47
|
+
store_1.default.hasMany(StoresOnOrganizations, {
|
48
|
+
foreignKey: "storeId",
|
49
|
+
sourceKey: "id",
|
50
|
+
});
|
51
|
+
organization_1.default.hasMany(StoresOnOrganizations, {
|
52
|
+
foreignKey: "organizationId",
|
53
|
+
sourceKey: "id",
|
54
|
+
});
|
55
|
+
exports.default = StoresOnOrganizations;
|
56
|
+
//# sourceMappingURL=stores_on_organizations.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"stores_on_organizations.js","sourceRoot":"","sources":["../../typed-model/stores_on_organizations.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,oDAA4B;AAC5B,kEAA0C;AAE1C,mEAAmE;AACnE,MAAM,qBAAsB,SAAQ,iBAGnC;CAWA;AAED,qBAAqB,CAAC,IAAI,CACxB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,OAAO,EAAE;QACP,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE;YACV,KAAK,EAAE,eAAK;SACb;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE;YACV,KAAK,EAAE,sBAAY;SACpB;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,iBAAiB;KACzB;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,yBAAyB;IACpC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,eAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE;IACnC,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,sBAAY,CAAC,OAAO,CAAC,qBAAqB,EAAE;IAC1C,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,kBAAe,qBAAqB,CAAC"}
|
package/dist/typed-model/user.js
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const sequelize_1 = require("sequelize");
|
7
|
+
const pb_sequelize_1 = __importDefault(require("./pb-sequelize"));
|
8
|
+
const user_1 = __importDefault(require("./user"));
|
9
|
+
const organization_1 = __importDefault(require("./organization"));
|
10
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
11
|
+
class UsersOnOrganizations extends sequelize_1.Model {
|
12
|
+
}
|
13
|
+
UsersOnOrganizations.init({
|
14
|
+
id: {
|
15
|
+
type: sequelize_1.DataTypes.BIGINT,
|
16
|
+
primaryKey: true,
|
17
|
+
allowNull: false,
|
18
|
+
defaultValue: pb_sequelize_1.default.fn("next_id"),
|
19
|
+
},
|
20
|
+
userId: {
|
21
|
+
type: sequelize_1.DataTypes.BIGINT,
|
22
|
+
allowNull: false,
|
23
|
+
field: "user_id",
|
24
|
+
references: {
|
25
|
+
model: user_1.default,
|
26
|
+
},
|
27
|
+
},
|
28
|
+
organizationId: {
|
29
|
+
type: sequelize_1.DataTypes.BIGINT,
|
30
|
+
allowNull: false,
|
31
|
+
field: "organization_id",
|
32
|
+
references: {
|
33
|
+
model: organization_1.default,
|
34
|
+
},
|
35
|
+
},
|
36
|
+
role: {
|
37
|
+
type: sequelize_1.DataTypes.STRING,
|
38
|
+
allowNull: false,
|
39
|
+
field: "role",
|
40
|
+
},
|
41
|
+
createdAt: sequelize_1.DataTypes.DATE,
|
42
|
+
updatedAt: sequelize_1.DataTypes.DATE,
|
43
|
+
}, {
|
44
|
+
tableName: "users_on_organizations",
|
45
|
+
sequelize: pb_sequelize_1.default,
|
46
|
+
});
|
47
|
+
user_1.default.hasMany(UsersOnOrganizations, {
|
48
|
+
foreignKey: "userId",
|
49
|
+
sourceKey: "id",
|
50
|
+
});
|
51
|
+
organization_1.default.hasMany(UsersOnOrganizations, {
|
52
|
+
foreignKey: "organizationId",
|
53
|
+
sourceKey: "id",
|
54
|
+
});
|
55
|
+
exports.default = UsersOnOrganizations;
|
56
|
+
//# sourceMappingURL=users_on_organizations.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"users_on_organizations.js","sourceRoot":"","sources":["../../typed-model/users_on_organizations.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAC1B,kEAA0C;AAE1C,mEAAmE;AACnE,MAAM,oBAAqB,SAAQ,iBAGlC;CAWA;AAED,oBAAoB,CAAC,IAAI,CACvB;IACE,EAAE,EAAE;QACF,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,sBAAS,CAAC,EAAE,CAAC,SAAS,CAAC;KACtC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,cAAc,EAAE;QACd,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE;YACV,KAAK,EAAE,sBAAY;SACpB;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAE,wBAAwB;IACnC,SAAS,EAAT,sBAAS;CACV,CACF,CAAC;AAEF,cAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE;IACjC,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,sBAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE;IACzC,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,kBAAe,oBAAoB,CAAC"}
|
package/package.json
CHANGED
package/typed-model/index.ts
CHANGED
@@ -27,4 +27,7 @@ export { default as Sport } from "./sport";
|
|
27
27
|
export { default as SportOnPosts } from "./sport-on-posts";
|
28
28
|
export { default as DiscordIntegration } from "./discord-integration";
|
29
29
|
export { default as SubscriberDiscordIntegration } from "./subscriber-discord-integration";
|
30
|
+
export { default as Organization } from "./organization";
|
31
|
+
export { default as UsersOnOrganizations } from "./users_on_organizations";
|
32
|
+
export { default as StoresOnOrganizations } from "./stores_on_organizations";
|
30
33
|
export { default as pbSequelize } from "./pb-sequelize";
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import {
|
2
|
+
Model,
|
3
|
+
InferAttributes,
|
4
|
+
InferCreationAttributes,
|
5
|
+
CreationOptional,
|
6
|
+
DataTypes,
|
7
|
+
} from "sequelize";
|
8
|
+
|
9
|
+
import sequelize from "./pb-sequelize";
|
10
|
+
import User from "./user";
|
11
|
+
import Integration from "./integration";
|
12
|
+
|
13
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
14
|
+
class Organization extends Model<
|
15
|
+
InferAttributes<Organization>,
|
16
|
+
InferCreationAttributes<Organization>
|
17
|
+
> {
|
18
|
+
// 'CreationOptional' is a special type that marks the field as optional
|
19
|
+
// when creating an instance of the model (such as using Model.create()).
|
20
|
+
declare id: CreationOptional<string>;
|
21
|
+
|
22
|
+
declare ownerId: string;
|
23
|
+
declare integrationId?: string;
|
24
|
+
declare organizationName: string;
|
25
|
+
|
26
|
+
declare createdAt: CreationOptional<Date>;
|
27
|
+
declare updatedAt: CreationOptional<Date>;
|
28
|
+
}
|
29
|
+
|
30
|
+
Organization.init(
|
31
|
+
{
|
32
|
+
id: {
|
33
|
+
type: DataTypes.BIGINT,
|
34
|
+
primaryKey: true,
|
35
|
+
allowNull: false,
|
36
|
+
defaultValue: sequelize.fn("next_id"),
|
37
|
+
},
|
38
|
+
ownerId: {
|
39
|
+
type: DataTypes.BIGINT,
|
40
|
+
allowNull: false,
|
41
|
+
field: "owner_id",
|
42
|
+
references: {
|
43
|
+
model: User,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
integrationId: {
|
47
|
+
type: DataTypes.BIGINT,
|
48
|
+
allowNull: true,
|
49
|
+
field: "integration_id",
|
50
|
+
references: {
|
51
|
+
model: Integration,
|
52
|
+
},
|
53
|
+
},
|
54
|
+
organizationName: {
|
55
|
+
type: DataTypes.STRING,
|
56
|
+
allowNull: false,
|
57
|
+
field: "organization_name",
|
58
|
+
},
|
59
|
+
createdAt: DataTypes.DATE,
|
60
|
+
updatedAt: DataTypes.DATE,
|
61
|
+
},
|
62
|
+
{
|
63
|
+
tableName: "organizations",
|
64
|
+
sequelize,
|
65
|
+
}
|
66
|
+
);
|
67
|
+
|
68
|
+
Organization.hasOne(User, {
|
69
|
+
foreignKey: "id",
|
70
|
+
sourceKey: "ownerId",
|
71
|
+
onDelete: "NO ACTION",
|
72
|
+
});
|
73
|
+
|
74
|
+
Organization.hasOne(Integration, {
|
75
|
+
foreignKey: "id",
|
76
|
+
sourceKey: "integrationId",
|
77
|
+
onDelete: "NO ACTION",
|
78
|
+
});
|
79
|
+
|
80
|
+
export default Organization;
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import {
|
2
|
+
Model,
|
3
|
+
InferAttributes,
|
4
|
+
InferCreationAttributes,
|
5
|
+
CreationOptional,
|
6
|
+
DataTypes,
|
7
|
+
} from "sequelize";
|
8
|
+
|
9
|
+
import sequelize from "./pb-sequelize";
|
10
|
+
import Store from "./store";
|
11
|
+
import Organization from "./organization";
|
12
|
+
|
13
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
14
|
+
class StoresOnOrganizations extends Model<
|
15
|
+
InferAttributes<StoresOnOrganizations>,
|
16
|
+
InferCreationAttributes<StoresOnOrganizations>
|
17
|
+
> {
|
18
|
+
// 'CreationOptional' is a special type that marks the field as optional
|
19
|
+
// when creating an instance of the model (such as using Model.create()).
|
20
|
+
declare id: CreationOptional<string>;
|
21
|
+
|
22
|
+
declare storeId: string;
|
23
|
+
declare organizationId: string;
|
24
|
+
declare ratePercentage: number;
|
25
|
+
|
26
|
+
declare createdAt: CreationOptional<Date>;
|
27
|
+
declare updatedAt: CreationOptional<Date>;
|
28
|
+
}
|
29
|
+
|
30
|
+
StoresOnOrganizations.init(
|
31
|
+
{
|
32
|
+
id: {
|
33
|
+
type: DataTypes.BIGINT,
|
34
|
+
primaryKey: true,
|
35
|
+
allowNull: false,
|
36
|
+
defaultValue: sequelize.fn("next_id"),
|
37
|
+
},
|
38
|
+
storeId: {
|
39
|
+
type: DataTypes.BIGINT,
|
40
|
+
allowNull: false,
|
41
|
+
field: "store_id",
|
42
|
+
references: {
|
43
|
+
model: Store,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
organizationId: {
|
47
|
+
type: DataTypes.BIGINT,
|
48
|
+
allowNull: false,
|
49
|
+
field: "organization_id",
|
50
|
+
references: {
|
51
|
+
model: Organization,
|
52
|
+
},
|
53
|
+
},
|
54
|
+
ratePercentage: {
|
55
|
+
type: DataTypes.INTEGER,
|
56
|
+
allowNull: false,
|
57
|
+
field: "rate_percentage",
|
58
|
+
},
|
59
|
+
createdAt: DataTypes.DATE,
|
60
|
+
updatedAt: DataTypes.DATE,
|
61
|
+
},
|
62
|
+
{
|
63
|
+
tableName: "stores_on_organizations",
|
64
|
+
sequelize,
|
65
|
+
}
|
66
|
+
);
|
67
|
+
|
68
|
+
Store.hasMany(StoresOnOrganizations, {
|
69
|
+
foreignKey: "storeId",
|
70
|
+
sourceKey: "id",
|
71
|
+
});
|
72
|
+
|
73
|
+
Organization.hasMany(StoresOnOrganizations, {
|
74
|
+
foreignKey: "organizationId",
|
75
|
+
sourceKey: "id",
|
76
|
+
});
|
77
|
+
|
78
|
+
export default StoresOnOrganizations;
|
package/typed-model/user.ts
CHANGED
@@ -50,7 +50,7 @@ class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
|
|
50
50
|
declare profileViews?: number;
|
51
51
|
declare optInStatus?: OptInStatus;
|
52
52
|
declare lastPasswordLogin: CreationOptional<Date>;
|
53
|
-
declare
|
53
|
+
declare interconHash?: string;
|
54
54
|
declare createdAt: CreationOptional<Date>;
|
55
55
|
declare updatedAt: CreationOptional<Date>;
|
56
56
|
|
@@ -209,7 +209,7 @@ User.init(
|
|
209
209
|
type: DataTypes.DATE,
|
210
210
|
field: "last_password_login",
|
211
211
|
},
|
212
|
-
|
212
|
+
interconHash: {
|
213
213
|
type: DataTypes.STRING,
|
214
214
|
field: "intercom_hash",
|
215
215
|
},
|
@@ -0,0 +1,78 @@
|
|
1
|
+
import {
|
2
|
+
Model,
|
3
|
+
InferAttributes,
|
4
|
+
InferCreationAttributes,
|
5
|
+
CreationOptional,
|
6
|
+
DataTypes,
|
7
|
+
} from "sequelize";
|
8
|
+
|
9
|
+
import sequelize from "./pb-sequelize";
|
10
|
+
import User from "./user";
|
11
|
+
import Organization from "./organization";
|
12
|
+
|
13
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
14
|
+
class UsersOnOrganizations extends Model<
|
15
|
+
InferAttributes<UsersOnOrganizations>,
|
16
|
+
InferCreationAttributes<UsersOnOrganizations>
|
17
|
+
> {
|
18
|
+
// 'CreationOptional' is a special type that marks the field as optional
|
19
|
+
// when creating an instance of the model (such as using Model.create()).
|
20
|
+
declare id: CreationOptional<string>;
|
21
|
+
|
22
|
+
declare userId: string;
|
23
|
+
declare organizationId: string;
|
24
|
+
declare role: string;
|
25
|
+
|
26
|
+
declare createdAt: CreationOptional<Date>;
|
27
|
+
declare updatedAt: CreationOptional<Date>;
|
28
|
+
}
|
29
|
+
|
30
|
+
UsersOnOrganizations.init(
|
31
|
+
{
|
32
|
+
id: {
|
33
|
+
type: DataTypes.BIGINT,
|
34
|
+
primaryKey: true,
|
35
|
+
allowNull: false,
|
36
|
+
defaultValue: sequelize.fn("next_id"),
|
37
|
+
},
|
38
|
+
userId: {
|
39
|
+
type: DataTypes.BIGINT,
|
40
|
+
allowNull: false,
|
41
|
+
field: "user_id",
|
42
|
+
references: {
|
43
|
+
model: User,
|
44
|
+
},
|
45
|
+
},
|
46
|
+
organizationId: {
|
47
|
+
type: DataTypes.BIGINT,
|
48
|
+
allowNull: false,
|
49
|
+
field: "organization_id",
|
50
|
+
references: {
|
51
|
+
model: Organization,
|
52
|
+
},
|
53
|
+
},
|
54
|
+
role: {
|
55
|
+
type: DataTypes.STRING,
|
56
|
+
allowNull: false,
|
57
|
+
field: "role",
|
58
|
+
},
|
59
|
+
createdAt: DataTypes.DATE,
|
60
|
+
updatedAt: DataTypes.DATE,
|
61
|
+
},
|
62
|
+
{
|
63
|
+
tableName: "users_on_organizations",
|
64
|
+
sequelize,
|
65
|
+
}
|
66
|
+
);
|
67
|
+
|
68
|
+
User.hasMany(UsersOnOrganizations, {
|
69
|
+
foreignKey: "userId",
|
70
|
+
sourceKey: "id",
|
71
|
+
});
|
72
|
+
|
73
|
+
Organization.hasMany(UsersOnOrganizations, {
|
74
|
+
foreignKey: "organizationId",
|
75
|
+
sourceKey: "id",
|
76
|
+
});
|
77
|
+
|
78
|
+
export default UsersOnOrganizations;
|