@winible/winible-typed 2.5.10 → 2.6.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/dist/typed-model/application.js +66 -0
- package/dist/typed-model/application.js.map +1 -0
- package/dist/typed-model/index.js +3 -1
- package/dist/typed-model/index.js.map +1 -1
- package/dist/typed-model/user.js +1 -1
- package/package.json +1 -1
- package/typed-model/application.ts +92 -0
- package/typed-model/index.ts +1 -0
- package/typed-model/user.ts +2 -2
@@ -0,0 +1,66 @@
|
|
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
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
10
|
+
class Application extends sequelize_1.Model {
|
11
|
+
}
|
12
|
+
Application.init({
|
13
|
+
id: {
|
14
|
+
type: sequelize_1.DataTypes.BIGINT,
|
15
|
+
primaryKey: true,
|
16
|
+
allowNull: false,
|
17
|
+
defaultValue: pb_sequelize_1.default.fn("next_id"),
|
18
|
+
},
|
19
|
+
userId: {
|
20
|
+
type: sequelize_1.DataTypes.STRING,
|
21
|
+
field: "user_id",
|
22
|
+
references: {
|
23
|
+
model: user_1.default,
|
24
|
+
},
|
25
|
+
},
|
26
|
+
status: {
|
27
|
+
type: sequelize_1.DataTypes.STRING,
|
28
|
+
field: "status",
|
29
|
+
allowNull: false,
|
30
|
+
defaultValue: "pending",
|
31
|
+
},
|
32
|
+
personalInfo: {
|
33
|
+
type: sequelize_1.DataTypes.STRING,
|
34
|
+
field: "personal_info",
|
35
|
+
},
|
36
|
+
source: {
|
37
|
+
type: sequelize_1.DataTypes.STRING,
|
38
|
+
field: "source",
|
39
|
+
},
|
40
|
+
suggestion: {
|
41
|
+
type: sequelize_1.DataTypes.STRING,
|
42
|
+
field: "suggestion",
|
43
|
+
},
|
44
|
+
createdAt: sequelize_1.DataTypes.DATE,
|
45
|
+
updatedAt: sequelize_1.DataTypes.DATE,
|
46
|
+
}, {
|
47
|
+
sequelize: pb_sequelize_1.default,
|
48
|
+
tableName: "applications",
|
49
|
+
});
|
50
|
+
// Class functions
|
51
|
+
Application.getById = async (id) => {
|
52
|
+
return await Application.findOne({
|
53
|
+
where: {
|
54
|
+
id,
|
55
|
+
},
|
56
|
+
});
|
57
|
+
};
|
58
|
+
// Associations
|
59
|
+
Application.hasOne(user_1.default, {
|
60
|
+
foreignKey: "id",
|
61
|
+
sourceKey: "userId",
|
62
|
+
onDelete: "NO ACTION",
|
63
|
+
constraints: false,
|
64
|
+
});
|
65
|
+
exports.default = Application;
|
66
|
+
//# sourceMappingURL=application.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../../typed-model/application.ts"],"names":[],"mappings":";;;;;AAAA,yCAMmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAI1B,mEAAmE;AACnE,MAAM,WAAY,SAAQ,iBAGzB;CAaA;AAED,WAAW,CAAC,IAAI,CACd;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,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE;YACV,KAAK,EAAE,cAAI;SACZ;KACF;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,QAAQ;QACf,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,SAAS;KACxB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,eAAe;KACvB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,QAAQ;KAChB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,YAAY;KACpB;IACD,SAAS,EAAE,qBAAS,CAAC,IAAI;IACzB,SAAS,EAAE,qBAAS,CAAC,IAAI;CAC1B,EACD;IACE,SAAS,EAAT,sBAAS;IACT,SAAS,EAAE,cAAc;CAC1B,CACF,CAAC;AAEF,kBAAkB;AAClB,WAAW,CAAC,OAAO,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;IACzC,OAAO,MAAM,WAAW,CAAC,OAAO,CAAC;QAC/B,KAAK,EAAE;YACL,EAAE;SACH;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe;AACf,WAAW,CAAC,MAAM,CAAC,cAAI,EAAE;IACvB,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC;AAEH,kBAAe,WAAW,CAAC"}
|
@@ -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.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.pbSequelize = exports.Notification = exports.Media = exports.MediaAsset = exports.Transaction = exports.ContentLike = void 0;
|
6
|
+
exports.Application = exports.NotificationPreference = exports.SubscribersOnCreators = exports.SubscriptionPricingOptionOnCoupons = exports.User = exports.LeagueOnUsers = exports.League = exports.Withdrawal = exports.RecurlyAccount = exports.SubscriptionPricingOption = exports.SubscriptionCoupon = exports.SubscriptionPlanOnPost = exports.SubscriptionPlanOnUsers = exports.SubscriptionPlan = exports.PostsOnUsers = exports.Post = exports.pbSequelize = 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");
|
@@ -46,4 +46,6 @@ var subscribers_on_creators_1 = require("./subscribers-on-creators");
|
|
46
46
|
Object.defineProperty(exports, "SubscribersOnCreators", { enumerable: true, get: function () { return __importDefault(subscribers_on_creators_1).default; } });
|
47
47
|
var notification_preference_1 = require("./notification-preference");
|
48
48
|
Object.defineProperty(exports, "NotificationPreference", { enumerable: true, get: function () { return __importDefault(notification_preference_1).default; } });
|
49
|
+
var application_1 = require("./application");
|
50
|
+
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return __importDefault(application_1).default; } });
|
49
51
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../typed-model/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwD;AAA/C,4HAAA,OAAO,OAAe;AAC/B,6CAAuD;AAA9C,2HAAA,OAAO,OAAe;AAC/B,6CAAsD;AAA7C,0HAAA,OAAO,OAAc;AAC9B,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,+CAAwD;AAA/C,4HAAA,OAAO,OAAe;AAC/B,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,mDAA2D;AAAlD,+HAAA,OAAO,OAAgB;AAChC,y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AAA,OAAO,OAAc;AAC9B,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,qDAA6D;AAApD,iIAAA,OAAO,OAAiB;AACjC,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,mGAAyG;AAAhG,6KAAA,OAAO,OAAsC;AACtD,qEAA6E;AAApE,iJAAA,OAAO,OAAyB;AACzC,qEAA8E;AAArE,kJAAA,OAAO,OAA0B;AAC1C,6CAAuD;AAA9C,2HAAA,OAAO,OAAe"}
|
package/dist/typed-model/user.js
CHANGED
package/package.json
CHANGED
@@ -0,0 +1,92 @@
|
|
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
|
+
|
12
|
+
type ApplicationStatus = "accepted" | "rejected" | "pending";
|
13
|
+
|
14
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
15
|
+
class Application extends Model<
|
16
|
+
InferAttributes<Application>,
|
17
|
+
InferCreationAttributes<Application>
|
18
|
+
> {
|
19
|
+
// 'CreationOptional' is a special type that marks the field as optional
|
20
|
+
// when creating an instance of the model (such as using Model.create()).
|
21
|
+
declare id: CreationOptional<string>;
|
22
|
+
declare userId: string;
|
23
|
+
declare status: ApplicationStatus;
|
24
|
+
declare personalInfo: string;
|
25
|
+
declare source: string;
|
26
|
+
declare suggestion: string;
|
27
|
+
declare createdAt: CreationOptional<Date>;
|
28
|
+
declare updatedAt: CreationOptional<Date>;
|
29
|
+
|
30
|
+
static getById: (id: string) => Promise<Application | null>;
|
31
|
+
}
|
32
|
+
|
33
|
+
Application.init(
|
34
|
+
{
|
35
|
+
id: {
|
36
|
+
type: DataTypes.BIGINT,
|
37
|
+
primaryKey: true,
|
38
|
+
allowNull: false,
|
39
|
+
defaultValue: sequelize.fn("next_id"),
|
40
|
+
},
|
41
|
+
userId: {
|
42
|
+
type: DataTypes.STRING,
|
43
|
+
field: "user_id",
|
44
|
+
references: {
|
45
|
+
model: User,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
status: {
|
49
|
+
type: DataTypes.STRING,
|
50
|
+
field: "status",
|
51
|
+
allowNull: false,
|
52
|
+
defaultValue: "pending",
|
53
|
+
},
|
54
|
+
personalInfo: {
|
55
|
+
type: DataTypes.STRING,
|
56
|
+
field: "personal_info",
|
57
|
+
},
|
58
|
+
source: {
|
59
|
+
type: DataTypes.STRING,
|
60
|
+
field: "source",
|
61
|
+
},
|
62
|
+
suggestion: {
|
63
|
+
type: DataTypes.STRING,
|
64
|
+
field: "suggestion",
|
65
|
+
},
|
66
|
+
createdAt: DataTypes.DATE,
|
67
|
+
updatedAt: DataTypes.DATE,
|
68
|
+
},
|
69
|
+
{
|
70
|
+
sequelize,
|
71
|
+
tableName: "applications",
|
72
|
+
}
|
73
|
+
);
|
74
|
+
|
75
|
+
// Class functions
|
76
|
+
Application.getById = async (id: string) => {
|
77
|
+
return await Application.findOne({
|
78
|
+
where: {
|
79
|
+
id,
|
80
|
+
},
|
81
|
+
});
|
82
|
+
};
|
83
|
+
|
84
|
+
// Associations
|
85
|
+
Application.hasOne(User, {
|
86
|
+
foreignKey: "id",
|
87
|
+
sourceKey: "userId",
|
88
|
+
onDelete: "NO ACTION",
|
89
|
+
constraints: false,
|
90
|
+
});
|
91
|
+
|
92
|
+
export default Application;
|
package/typed-model/index.ts
CHANGED
@@ -19,3 +19,4 @@ export { default as User } from "./user";
|
|
19
19
|
export { default as SubscriptionPricingOptionOnCoupons } from "./subscription-pricing-option-on-coupons";
|
20
20
|
export { default as SubscribersOnCreators } from "./subscribers-on-creators";
|
21
21
|
export { default as NotificationPreference } from "./notification-preference";
|
22
|
+
export { default as Application } from "./application";
|
package/typed-model/user.ts
CHANGED
@@ -39,7 +39,7 @@ class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
|
|
39
39
|
declare units?: number;
|
40
40
|
declare winPercentage?: number;
|
41
41
|
|
42
|
-
declare referringUserId?:
|
42
|
+
declare referringUserId?: string;
|
43
43
|
declare referralPercentage?: number;
|
44
44
|
declare masspayUserToken?: string;
|
45
45
|
declare stytchUserId?: string;
|
@@ -155,7 +155,7 @@ User.init(
|
|
155
155
|
defaultValue: 0,
|
156
156
|
},
|
157
157
|
referringUserId: {
|
158
|
-
type: DataTypes.
|
158
|
+
type: DataTypes.STRING,
|
159
159
|
field: "referring_user_id",
|
160
160
|
},
|
161
161
|
referralPercentage: {
|