@winible/winible-typed 2.22.8 → 2.22.10
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/subscription-plan.js +1 -1
- package/dist/typed-model/subscription-plan.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +10 -0
- package/typed-model/affiliate-code.ts +131 -0
- package/typed-model/subscriber-telegram-integration.ts +6 -1
- package/typed-model/telegram-integration.ts +16 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"subscription-plan.js","sourceRoot":"","sources":["../../typed-model/subscription-plan.ts"],"names":[],"mappings":";;;;;AAAA,yCAOmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAG1B,wCAAoD;AAEpD,mEAAmE;AACnE,MAAM,gBAAiB,SAAQ,iBAG9B;CAyBA;AAED,gBAAgB,CAAC,IAAI,CACnB;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,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,WAAW;KACnB;IACD,eAAe,EAAE;QACf,IAAI,EAAE,qBAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,KAAK,EAAE,kBAAkB;KAC1B;IACD,UAAU,EAAE;QACV,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,KAAK,EAAE,aAAa;QACpB,YAAY,EAAE,KAAK;KACpB;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,qBAAS,CAAC,OAAO;QACvB,KAAK,EAAE,OAAO;QACd,YAAY,EAAE,CAAC;KAChB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,4BAAoB,CAAC,CAAC;QAC5D,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,4BAAoB,CAAC,SAAS;KAC7C;IACD,SAAS,EAAE;QACT,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,KAAK,EAAE,YAAY;QACnB,YAAY,EAAE,SAAS;KACxB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,qBAAS,CAAC,IAAI;QACpB,KAAK,EAAE,UAAU;QACjB,YAAY,EAAE,SAAS;KACxB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,qBAAS,CAAC,
|
1
|
+
{"version":3,"file":"subscription-plan.js","sourceRoot":"","sources":["../../typed-model/subscription-plan.ts"],"names":[],"mappings":";;;;;AAAA,yCAOmB;AAEnB,kEAAuC;AACvC,kDAA0B;AAG1B,wCAAoD;AAEpD,mEAAmE;AACnE,MAAM,gBAAiB,SAAQ,iBAG9B;CAyBA;AAED,gBAAgB,CAAC,IAAI,CACnB;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,QAAQ,EAAE;QACR,IAAI,EAAE,qBAAS,CAAC,MAAM;QACtB,KAAK,EAAE,WAAW;KACnB;IACD,eA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;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,KAAK,EAAE,MAAc,EAAE,EAAE;IACtD,OAAO,MAAM,gBAAgB,CAAC,OAAO,CAAC;QACpC,KAAK,EAAE;YACL,MAAM;SACP;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,cAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;IAC7B,UAAU,EAAE,QAAQ;IACpB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,KAAK;CACnB,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,cAAI,EAAE;IAC5B,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,QAAQ;CACpB,CAAC,CAAC;AAEH,kBAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
@@ -85,3 +85,13 @@ export enum ShouldRemoveSubscriberStatus {
|
|
85
85
|
TRUE = "TRUE",
|
86
86
|
FALSE = "FALSE",
|
87
87
|
}
|
88
|
+
|
89
|
+
export enum RewardFrequency {
|
90
|
+
SINGLE = "SINGLE",
|
91
|
+
RECURRING = "RECURRING",
|
92
|
+
}
|
93
|
+
|
94
|
+
export enum RewardType {
|
95
|
+
CENTS = "CENTS",
|
96
|
+
PERCENTAGE = "PERCENTAGE",
|
97
|
+
}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import {
|
2
|
+
Model,
|
3
|
+
InferAttributes,
|
4
|
+
InferCreationAttributes,
|
5
|
+
CreationOptional,
|
6
|
+
DataTypes,
|
7
|
+
} from "sequelize";
|
8
|
+
|
9
|
+
import sequelize from "./pb-sequelize";
|
10
|
+
import { RewardFrequency, RewardType } from "../src/types";
|
11
|
+
import User from "./user";
|
12
|
+
|
13
|
+
// order of InferAttributes & InferCreationAttributes is important.
|
14
|
+
class AffiliateCode extends Model<
|
15
|
+
InferAttributes<AffiliateCode>,
|
16
|
+
InferCreationAttributes<AffiliateCode>
|
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
|
+
declare affiliateCode: string;
|
22
|
+
declare userId: string;
|
23
|
+
declare creatorId: string;
|
24
|
+
declare emailInvite: string;
|
25
|
+
declare pageViews: number;
|
26
|
+
|
27
|
+
declare rewardFrequency: RewardFrequency;
|
28
|
+
declare rewardType: RewardType;
|
29
|
+
declare rewardAmountInCents: number;
|
30
|
+
declare rewardAmountInPercent: number;
|
31
|
+
|
32
|
+
declare allPlansEligible: string;
|
33
|
+
declare allPostsEligible: string;
|
34
|
+
declare pricingOptionIdsEligible: string[];
|
35
|
+
|
36
|
+
declare createdAt: CreationOptional<Date>;
|
37
|
+
declare updatedAt: CreationOptional<Date>;
|
38
|
+
}
|
39
|
+
|
40
|
+
AffiliateCode.init(
|
41
|
+
{
|
42
|
+
id: {
|
43
|
+
type: DataTypes.BIGINT,
|
44
|
+
primaryKey: true,
|
45
|
+
allowNull: false,
|
46
|
+
defaultValue: sequelize.fn("next_id"),
|
47
|
+
},
|
48
|
+
affiliateCode: {
|
49
|
+
type: DataTypes.STRING,
|
50
|
+
field: "affiliate_code",
|
51
|
+
allowNull: false,
|
52
|
+
},
|
53
|
+
userId: {
|
54
|
+
type: DataTypes.BIGINT,
|
55
|
+
field: "user_id",
|
56
|
+
defaultValue: null,
|
57
|
+
references: {
|
58
|
+
model: User,
|
59
|
+
},
|
60
|
+
},
|
61
|
+
creatorId: {
|
62
|
+
type: DataTypes.BIGINT,
|
63
|
+
allowNull: false,
|
64
|
+
field: "creator_id",
|
65
|
+
references: {
|
66
|
+
model: User,
|
67
|
+
},
|
68
|
+
},
|
69
|
+
emailInvite: {
|
70
|
+
type: DataTypes.STRING,
|
71
|
+
allowNull: false,
|
72
|
+
field: "email_invite",
|
73
|
+
},
|
74
|
+
pageViews: {
|
75
|
+
type: DataTypes.INTEGER,
|
76
|
+
allowNull: false,
|
77
|
+
field: "page_views",
|
78
|
+
defaultValue: 0,
|
79
|
+
},
|
80
|
+
|
81
|
+
rewardFrequency: {
|
82
|
+
type: DataTypes.ENUM(...Object.values(RewardFrequency)),
|
83
|
+
field: "reward_frequency",
|
84
|
+
},
|
85
|
+
rewardType: {
|
86
|
+
type: DataTypes.ENUM(...Object.values(RewardType)),
|
87
|
+
field: "reward_type",
|
88
|
+
},
|
89
|
+
rewardAmountInCents: {
|
90
|
+
type: DataTypes.INTEGER,
|
91
|
+
field: "reward_amount_in_cents",
|
92
|
+
},
|
93
|
+
rewardAmountInPercent: {
|
94
|
+
type: DataTypes.FLOAT,
|
95
|
+
field: "reward_amount_in_percent",
|
96
|
+
},
|
97
|
+
|
98
|
+
allPlansEligible: {
|
99
|
+
type: DataTypes.STRING,
|
100
|
+
field: "all_plans_eligible",
|
101
|
+
},
|
102
|
+
allPostsEligible: {
|
103
|
+
type: DataTypes.STRING,
|
104
|
+
field: "all_posts_eligible",
|
105
|
+
},
|
106
|
+
pricingOptionIdsEligible: {
|
107
|
+
type: DataTypes.ARRAY(DataTypes.BIGINT),
|
108
|
+
field: "pricing_option_ids_eligible",
|
109
|
+
defaultValue: [],
|
110
|
+
},
|
111
|
+
|
112
|
+
createdAt: DataTypes.DATE,
|
113
|
+
updatedAt: DataTypes.DATE,
|
114
|
+
},
|
115
|
+
{
|
116
|
+
tableName: "affiliate_codes",
|
117
|
+
sequelize,
|
118
|
+
}
|
119
|
+
);
|
120
|
+
|
121
|
+
AffiliateCode.belongsTo(User, {
|
122
|
+
foreignKey: "userId",
|
123
|
+
as: "User",
|
124
|
+
targetKey: "id",
|
125
|
+
});
|
126
|
+
|
127
|
+
AffiliateCode.belongsTo(User, {
|
128
|
+
foreignKey: "creatorId",
|
129
|
+
as: "Creator",
|
130
|
+
targetKey: "id",
|
131
|
+
});
|
@@ -21,6 +21,7 @@ class SubscriberTelegramIntegration extends Model<
|
|
21
21
|
declare userId: string;
|
22
22
|
declare telegramIntegrationId: string;
|
23
23
|
declare telegramUserId: string;
|
24
|
+
declare isDeleted?: boolean;
|
24
25
|
|
25
26
|
declare createdAt: CreationOptional<Date>;
|
26
27
|
declare updatedAt: CreationOptional<Date>;
|
@@ -55,7 +56,11 @@ SubscriberTelegramIntegration.init(
|
|
55
56
|
allowNull: false,
|
56
57
|
field: "telegram_user_id",
|
57
58
|
},
|
58
|
-
|
59
|
+
isDeleted: {
|
60
|
+
type: DataTypes.BOOLEAN,
|
61
|
+
allowNull: true,
|
62
|
+
field: "is_deleted",
|
63
|
+
},
|
59
64
|
createdAt: DataTypes.DATE,
|
60
65
|
updatedAt: DataTypes.DATE,
|
61
66
|
},
|
@@ -27,6 +27,9 @@ class TelegramIntegration extends Model<
|
|
27
27
|
declare archived: boolean;
|
28
28
|
declare shouldRemoveSubscriber: ShouldRemoveSubscriberStatus;
|
29
29
|
declare autoPost: boolean;
|
30
|
+
declare isDeleted?: boolean;
|
31
|
+
declare deletedAt?: Date;
|
32
|
+
declare archivedAt?: Date;
|
30
33
|
|
31
34
|
declare createdAt: CreationOptional<Date>;
|
32
35
|
declare updatedAt: CreationOptional<Date>;
|
@@ -89,6 +92,19 @@ TelegramIntegration.init(
|
|
89
92
|
defaultValue: false,
|
90
93
|
field: "auto_post",
|
91
94
|
},
|
95
|
+
isDeleted: {
|
96
|
+
type: DataTypes.BOOLEAN,
|
97
|
+
allowNull: true,
|
98
|
+
field: "is_deleted",
|
99
|
+
},
|
100
|
+
deletedAt: {
|
101
|
+
type: DataTypes.DATE,
|
102
|
+
allowNull: true,
|
103
|
+
},
|
104
|
+
archivedAt: {
|
105
|
+
type: DataTypes.DATE,
|
106
|
+
allowNull: true,
|
107
|
+
},
|
92
108
|
createdAt: DataTypes.DATE,
|
93
109
|
updatedAt: DataTypes.DATE,
|
94
110
|
},
|