@amohamud23/notihub 1.0.70 → 1.0.72

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.
Files changed (75) hide show
  1. package/dist/index.d.ts +2 -142
  2. package/dist/index.js +18 -222
  3. package/dist/models/CustomerMinifiedModel.d.ts +33 -0
  4. package/dist/models/CustomerMinifiedModel.js +12 -0
  5. package/dist/models/CustomerModel.d.ts +33 -0
  6. package/dist/models/CustomerModel.js +14 -0
  7. package/dist/models/Functions.d.ts +6 -0
  8. package/dist/models/Functions.js +56 -0
  9. package/dist/models/NotiHubStatsHistoryModel.d.ts +33 -0
  10. package/dist/models/NotiHubStatsHistoryModel.js +14 -0
  11. package/dist/models/NotiHubStatsModel.d.ts +33 -0
  12. package/dist/models/NotiHubStatsModel.js +17 -0
  13. package/dist/models/NotiTypeModel.d.ts +33 -0
  14. package/dist/models/NotiTypeModel.js +14 -0
  15. package/dist/models/NotificationModel.d.ts +33 -0
  16. package/dist/models/NotificationModel.js +19 -0
  17. package/dist/models/NotificationStatsModel.d.ts +33 -0
  18. package/dist/models/NotificationStatsModel.js +15 -0
  19. package/dist/models/SubscriptionModel.d.ts +33 -0
  20. package/dist/models/SubscriptionModel.js +14 -0
  21. package/dist/models/SubscriptionTypeModel.d.ts +33 -0
  22. package/dist/models/SubscriptionTypeModel.js +14 -0
  23. package/dist/models/UserModel.d.ts +33 -0
  24. package/dist/models/UserModel.js +12 -0
  25. package/dist/models/index.d.ts +79 -0
  26. package/dist/models/index.js +27 -0
  27. package/dist/models/schemas/CustomerMinifiedSchema.d.ts +51 -0
  28. package/dist/models/schemas/CustomerMinifiedSchema.js +14 -0
  29. package/dist/models/schemas/CustomerSchema.d.ts +73 -0
  30. package/dist/models/schemas/CustomerSchema.js +17 -0
  31. package/dist/models/schemas/NotiTypeSchema.d.ts +83 -0
  32. package/dist/models/schemas/NotiTypeSchema.js +14 -0
  33. package/dist/models/schemas/NotificationSchema.d.ts +76 -0
  34. package/dist/models/schemas/NotificationSchema.js +18 -0
  35. package/dist/models/schemas/NotificationStatsHistorySchema.d.ts +53 -0
  36. package/dist/models/schemas/NotificationStatsHistorySchema.js +12 -0
  37. package/dist/models/schemas/NotificationStatsSchema.d.ts +13 -0
  38. package/dist/models/schemas/NotificationStatsSchema.js +8 -0
  39. package/dist/models/schemas/SubscriptionSchema.d.ts +106 -0
  40. package/dist/models/schemas/SubscriptionSchema.js +16 -0
  41. package/dist/models/schemas/SubscriptionTypeSchema.d.ts +15 -0
  42. package/dist/models/schemas/SubscriptionTypeSchema.js +8 -0
  43. package/dist/models/schemas/UserSchema.d.ts +50 -0
  44. package/dist/models/schemas/UserSchema.js +11 -0
  45. package/dist/{index.d.mts → types.d.ts} +20 -22
  46. package/dist/types.js +2 -0
  47. package/dist/util/index.d.ts +10 -0
  48. package/dist/util/index.js +56 -0
  49. package/dist/util/types.d.ts +4 -0
  50. package/dist/util/types.js +2 -0
  51. package/package.json +4 -4
  52. package/dist/index.mjs +0 -204
  53. package/src/index.ts +0 -4
  54. package/src/models/CustomerMinifiedModel.ts +0 -17
  55. package/src/models/CustomerModel.ts +0 -13
  56. package/src/models/NotiHubStatsHistoryModel.ts +0 -19
  57. package/src/models/NotiHubStatsModel.ts +0 -22
  58. package/src/models/NotiTypeModel.ts +0 -13
  59. package/src/models/NotificationModel.ts +0 -24
  60. package/src/models/NotificationStatsModel.ts +0 -20
  61. package/src/models/SubscriptionModel.ts +0 -20
  62. package/src/models/SubscriptionTypeModel.ts +0 -20
  63. package/src/models/UserModel.ts +0 -11
  64. package/src/models/index.ts +0 -21
  65. package/src/models/schemas/CustomerMinifiedSchema.ts +0 -14
  66. package/src/models/schemas/CustomerSchema.ts +0 -14
  67. package/src/models/schemas/NotiTypeSchema.ts +0 -11
  68. package/src/models/schemas/NotificationSchema.ts +0 -15
  69. package/src/models/schemas/NotificationStatsHistorySchema.ts +0 -12
  70. package/src/models/schemas/NotificationStatsSchema.ts +0 -9
  71. package/src/models/schemas/SubscriptionSchema.ts +0 -13
  72. package/src/models/schemas/SubscriptionTypeSchema.ts +0 -7
  73. package/src/models/schemas/UserSchema.ts +0 -11
  74. package/src/types.ts +0 -161
  75. package/src/util/DateUtil.ts +0 -60
package/dist/index.d.ts CHANGED
@@ -1,142 +1,2 @@
1
- type CreateNotiRequestBody = {
2
- subscriptionId: string;
3
- userId: string;
4
- title: string;
5
- message: string;
6
- type: string;
7
- };
8
- type CreateSubscriptionRequestBody = {
9
- subscriptionId: string;
10
- type: string;
11
- };
12
- type CreateUserRequestBody = {
13
- name: string;
14
- email: string;
15
- token: string;
16
- };
17
- type ICreateCustomerRequestBody = {
18
- email: string;
19
- username: string;
20
- name: string;
21
- };
22
- type ICreateNotiRequestBody = {};
23
- type INotiHubCustomerMinified = {
24
- _id: string;
25
- name: string;
26
- img: INotiHubImage;
27
- username: string;
28
- createdAt: string;
29
- updatedAt: string;
30
- };
31
- type INotiHubCustomer = {
32
- _id: string;
33
- name: string;
34
- email: string;
35
- minified: INotiHubCustomerMinified;
36
- verified: boolean;
37
- paid: boolean;
38
- confirmed: boolean;
39
- createdAt: string;
40
- updatedAt: string;
41
- };
42
- type INotiHubNotification = {
43
- _id?: string;
44
- title: string;
45
- message: string;
46
- type: string;
47
- entityId: string;
48
- entityMinified: INotiHubCustomerMinified;
49
- body: string;
50
- createdAt: string;
51
- updatedAt: string;
52
- };
53
- type INotiHubNotificationStats = {
54
- _id?: string;
55
- notification: INotiHubNotification;
56
- views: number;
57
- };
58
- type INotiHubUser = {
59
- _id?: string;
60
- pushToken: string;
61
- name: string;
62
- email: string;
63
- subscriptions: number;
64
- events: number;
65
- };
66
- type INotiHubImage = {
67
- bucket: string;
68
- key: string;
69
- };
70
- type INotiHubStats = {
71
- entityRef: string;
72
- entity: INotiHubCustomer;
73
- subscription: number;
74
- notifications: number;
75
- views: number;
76
- };
77
- type INotiHubStatsHistory = {
78
- entityId: string;
79
- type: "MONTH" | "YEAR";
80
- subscription: number;
81
- notifications: number;
82
- views: number;
83
- };
84
- type INotiType = {
85
- _id?: string;
86
- type: string;
87
- entity: string;
88
- createdAt: string;
89
- updatedAt: string;
90
- };
91
- type INotiTypeStats = {
92
- _id?: string;
93
- notiTypeId: string;
94
- subscribed: number;
95
- createdAt: string;
96
- };
97
- type IUserSubscription = {
98
- user: INotiHubUser;
99
- entity: INotiHubCustomer;
100
- subscriptionId: string;
101
- type: "SUBSCRIBED" | "UNSUBSCRIBED";
102
- createdAt: string;
103
- updatedAt: string;
104
- };
105
- type IUserSubscribeNotifier = {
106
- userId: string;
107
- entityId: string;
108
- notiTypeId: string;
109
- createdAt: string;
110
- updatedAt: string;
111
- };
112
- type INotiHubUserView = {
113
- userId: string;
114
- entityId: string;
115
- notificationId: string;
116
- createdAt: string;
117
- };
118
- type INotiHubSubscription = {
119
- _id?: string;
120
- subscriptionId: string;
121
- entity: INotiHubCustomer;
122
- user: INotiHubUser;
123
- type: "SUBSCRIBED" | "UNSUBSCRIBED";
124
- createdAt: string;
125
- updatedAt: string;
126
- };
127
- type NotiHubTypes = {
128
- INotiHubUserView: INotiHubUserView;
129
- IUserSubscribeNotifier: IUserSubscribeNotifier;
130
- IUserSubscription: IUserSubscription;
131
- INotiHubUser: INotiHubUser;
132
- INotiTypeStats: INotiTypeStats;
133
- INotiHubImage: INotiHubImage;
134
- INotiHubSubscription: INotiHubSubscription;
135
- INotiHubNotificationStats: INotiHubNotificationStats;
136
- INotiHubNotification: INotiHubNotification;
137
- INotiHubCustomer: INotiHubCustomer;
138
- INotiHubCustomerMinified: INotiHubCustomerMinified;
139
- INotiHubStatsHistory: INotiHubStatsHistory;
140
- };
141
-
142
- export type { CreateNotiRequestBody, CreateSubscriptionRequestBody, CreateUserRequestBody, ICreateCustomerRequestBody, ICreateNotiRequestBody, INotiHubCustomer, INotiHubCustomerMinified, INotiHubImage, INotiHubNotification, INotiHubNotificationStats, INotiHubStats, INotiHubStatsHistory, INotiHubSubscription, INotiHubUser, INotiHubUserView, INotiType, INotiTypeStats, IUserSubscribeNotifier, IUserSubscription, NotiHubTypes };
1
+ export * from "./util/index";
2
+ export * from "./models/index";
package/dist/index.js CHANGED
@@ -1,223 +1,19 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/index.ts
17
- var src_exports = {};
18
- module.exports = __toCommonJS(src_exports);
19
-
20
- // src/models/UserModel.ts
21
- var import_mongoose2 = require("mongoose");
22
-
23
- // src/models/schemas/UserSchema.ts
24
- var import_mongoose = require("mongoose");
25
- var UserSchema = {
26
- id: { type: import_mongoose.Schema.Types.UUID, default: true },
27
- name: { type: String, required: true },
28
- email: { type: String, required: true },
29
- pushToken: { type: String, required: true },
30
- signedIn: { type: Boolean, required: true, default: false }
31
- };
32
- var UserSchema_default = UserSchema;
33
-
34
- // src/models/UserModel.ts
35
- var userSchema = new import_mongoose2.Schema(UserSchema_default, { timestamps: true });
36
- var UserModel = (0, import_mongoose2.model)("User", userSchema);
37
-
38
- // src/models/SubscriptionModel.ts
39
- var import_mongoose6 = require("mongoose");
40
-
41
- // src/models/schemas/SubscriptionSchema.ts
42
- var import_mongoose5 = require("mongoose");
43
-
44
- // src/models/schemas/CustomerSchema.ts
45
- var import_mongoose4 = require("mongoose");
46
-
47
- // src/models/schemas/CustomerMinifiedSchema.ts
48
- var import_mongoose3 = require("mongoose");
49
- var CustomerMinifiedSchema = {
50
- id: { type: import_mongoose3.Schema.Types.UUID, default: true },
51
- username: { type: String, required: true },
52
- img: {
53
- bucket: { type: String, required: true },
54
- key: { type: String, required: true }
55
- },
56
- name: { type: String, required: true }
57
- };
58
- var CustomerMinifiedSchema_default = CustomerMinifiedSchema;
59
-
60
- // src/models/schemas/CustomerSchema.ts
61
- var CustomerSchema = {
62
- id: { type: import_mongoose4.Schema.Types.UUID, default: true },
63
- minified: CustomerMinifiedSchema_default,
64
- paid: { type: Boolean, default: false },
65
- email: { type: String, required: true },
66
- verified: { type: Boolean, default: false },
67
- confirmed: { type: Boolean, default: false }
68
- };
69
- var CustomerSchema_default = CustomerSchema;
70
-
71
- // src/models/schemas/SubscriptionSchema.ts
72
- var SubscriptionSchema = {
73
- id: { type: import_mongoose5.Schema.Types.UUID, default: true },
74
- subscriptionId: { type: String, required: true },
75
- user: UserSchema_default,
76
- entity: CustomerSchema_default
77
- };
78
- var SubscriptionSchema_default = SubscriptionSchema;
79
-
80
- // src/models/SubscriptionModel.ts
81
- var subscriptionSchema = new import_mongoose6.Schema(
82
- SubscriptionSchema_default,
83
- {
84
- timestamps: true
85
- }
86
- );
87
- var Subscription = (0, import_mongoose6.model)(
88
- "Subscriptions",
89
- subscriptionSchema
90
- );
91
-
92
- // src/models/NotiTypeModel.ts
93
- var import_mongoose8 = require("mongoose");
94
-
95
- // src/models/schemas/NotiTypeSchema.ts
96
- var import_mongoose7 = require("mongoose");
97
- var NotiTypeSchema = {
98
- id: { type: import_mongoose7.Schema.Types.UUID, default: true },
99
- entity: CustomerSchema_default,
100
- type: { type: String, required: true }
101
- };
102
- var NotiTypeSchema_default = NotiTypeSchema;
103
-
104
- // src/models/NotiTypeModel.ts
105
- var notiTypeSchema = new import_mongoose8.Schema(NotiTypeSchema_default, {
106
- timestamps: true
107
- });
108
- var NotiTypeModel = (0, import_mongoose8.model)("NotiTypes", notiTypeSchema);
109
-
110
- // src/models/NotiHubStatsHistoryModel.ts
111
- var import_mongoose10 = require("mongoose");
112
-
113
- // src/models/schemas/NotificationStatsHistorySchema.ts
114
- var import_mongoose9 = require("mongoose");
115
- var NotihubStatsHistorySchema = {
116
- id: { type: import_mongoose9.Schema.Types.UUID, default: true },
117
- entityId: { type: String, required: true },
118
- notifications: { type: Number, required: true },
119
- subscription: { type: Number, required: true },
120
- views: { type: Number, required: true },
121
- type: { type: String, required: true }
122
- };
123
- var NotificationStatsHistorySchema_default = NotihubStatsHistorySchema;
124
-
125
- // src/models/NotiHubStatsHistoryModel.ts
126
- var notihubStatsHistorySchema = new import_mongoose10.Schema(
127
- NotificationStatsHistorySchema_default,
128
- {
129
- timestamps: true
130
- }
131
- );
132
- var NotiHubStatsHistory = (0, import_mongoose10.model)(
133
- "INotiHubStatsHistories",
134
- notihubStatsHistorySchema
135
- );
136
-
137
- // src/models/NotificationStatsModel.ts
138
- var import_mongoose12 = require("mongoose");
139
-
140
- // src/models/schemas/NotificationSchema.ts
141
- var import_mongoose11 = require("mongoose");
142
- var NotificationSchema = {
143
- id: { type: import_mongoose11.Schema.Types.UUID, default: true },
144
- title: { type: String, required: true },
145
- message: { type: String, required: true },
146
- type: { type: String, required: true },
147
- body: { type: String },
148
- entityId: { type: String, required: true },
149
- entityMinified: CustomerMinifiedSchema_default
150
- };
151
- var NotificationSchema_default = NotificationSchema;
152
-
153
- // src/models/NotificationStatsModel.ts
154
- var notificationSchema = new import_mongoose12.Schema(
155
- {
156
- notification: NotificationSchema_default,
157
- views: { type: Number, default: 0 }
158
- },
159
- { timestamps: true }
160
- );
161
- var NotificationStatsModel = (0, import_mongoose12.model)(
162
- "NotificationStats",
163
- notificationSchema
164
- );
165
-
166
- // src/models/NotificationModel.ts
167
- var import_mongoose13 = require("mongoose");
168
- var notificationSchema2 = new import_mongoose13.Schema(
169
- {
170
- title: { type: String, required: true },
171
- message: { type: String, required: true },
172
- type: { type: String, required: true },
173
- body: { type: String },
174
- entityId: { type: String, required: true },
175
- entityMinified: CustomerSchema_default
176
- },
177
- { timestamps: true }
178
- );
179
- var NotificationModel = (0, import_mongoose13.model)(
180
- "Notification",
181
- notificationSchema2
182
- );
183
-
184
- // src/models/CustomerModel.ts
185
- var import_mongoose14 = require("mongoose");
186
- var customerSchema = new import_mongoose14.Schema(CustomerSchema_default, {
187
- timestamps: true
188
- });
189
- var Customer = (0, import_mongoose14.model)("Customer", customerSchema);
190
-
191
- // src/models/CustomerMinifiedModel.ts
192
- var import_mongoose15 = require("mongoose");
193
- var customerMinifiedSchema = new import_mongoose15.Schema(
194
- CustomerMinifiedSchema_default,
195
- { timestamps: true }
196
- );
197
- var CustomerMinified = (0, import_mongoose15.model)(
198
- "CustomerMinified",
199
- customerMinifiedSchema
200
- );
201
-
202
- // src/models/SubscriptionTypeModel.ts
203
- var import_mongoose16 = require("mongoose");
204
-
205
- // src/models/schemas/SubscriptionTypeSchema.ts
206
- var SubscriptionSchema2 = {
207
- userId: { type: String, required: true },
208
- entityId: { type: String, required: true },
209
- notiTypeId: { type: String, required: true }
210
- };
211
- var SubscriptionTypeSchema_default = SubscriptionSchema2;
212
-
213
- // src/models/SubscriptionTypeModel.ts
214
- var subscriptionSchema2 = new import_mongoose16.Schema(
215
- SubscriptionTypeSchema_default,
216
- {
217
- timestamps: true
218
- }
219
- );
220
- var SubscriptionType = (0, import_mongoose16.model)(
221
- "SubscriptionTypes",
222
- subscriptionSchema2
223
- );
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // export * from "./types";
18
+ __exportStar(require("./util/index"), exports);
19
+ __exportStar(require("./models/index"), exports);
@@ -0,0 +1,33 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import { INotiHubCustomerMinified } from "../types";
28
+ declare const CustomerMinified: import("mongoose").Model<INotiHubCustomerMinified, {}, {}, {}, import("mongoose").Document<unknown, {}, INotiHubCustomerMinified> & INotiHubCustomerMinified & Required<{
29
+ _id: string;
30
+ }> & {
31
+ __v?: number | undefined;
32
+ }, any>;
33
+ export default CustomerMinified;
@@ -0,0 +1,12 @@
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 mongoose_1 = require("mongoose");
7
+ const CustomerMinifiedSchema_1 = __importDefault(require("./schemas/CustomerMinifiedSchema"));
8
+ // 2. Create a Schema corresponding to the document interface.
9
+ const customerMinifiedSchema = new mongoose_1.Schema(CustomerMinifiedSchema_1.default, { timestamps: true });
10
+ // 3. Create a Model.
11
+ const CustomerMinified = (0, mongoose_1.model)("CustomerMinified", customerMinifiedSchema);
12
+ exports.default = CustomerMinified;
@@ -0,0 +1,33 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import { INotiHubCustomer } from "../types";
28
+ declare const Customer: import("mongoose").Model<INotiHubCustomer, {}, {}, {}, import("mongoose").Document<unknown, {}, INotiHubCustomer> & INotiHubCustomer & Required<{
29
+ _id: string;
30
+ }> & {
31
+ __v?: number | undefined;
32
+ }, any>;
33
+ export default Customer;
@@ -0,0 +1,14 @@
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 mongoose_1 = require("mongoose");
7
+ const CustomerSchema_1 = __importDefault(require("./schemas/CustomerSchema"));
8
+ // 2. Create a Schema corresponding to the document interface.
9
+ const customerSchema = new mongoose_1.Schema(CustomerSchema_1.default, {
10
+ timestamps: true,
11
+ });
12
+ // 3. Create a Model.
13
+ const Customer = (0, mongoose_1.model)("Customer", customerSchema);
14
+ exports.default = Customer;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ getDate: (dateStr: string) => string;
3
+ getDateFormat: (dateStr: string) => string;
4
+ addMonths: (date: Date, months: number) => Date;
5
+ };
6
+ export default _default;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getDate = (dateStr) => {
4
+ const date = new Date(dateStr); // Convert seconds to milliseconds
5
+ const year = date.getFullYear();
6
+ const month = (date.getMonth() + 1).toString().padStart(2, "0"); // Months are zero-based
7
+ const day = date.getDate().toString().padStart(2, "0");
8
+ const formattedDate = `${month}-${day}-${year}`;
9
+ return formattedDate;
10
+ };
11
+ const getDateFormat = (dateStr) => {
12
+ const date = new Date(dateStr);
13
+ const now = new Date();
14
+ const seconds = Math.floor((now.getTime() - date.getTime()) / 1000);
15
+ let interval = seconds / 31536000;
16
+ if (interval > 1) {
17
+ return date.toLocaleDateString("en-US", {
18
+ year: "numeric",
19
+ month: "short",
20
+ day: "numeric",
21
+ });
22
+ }
23
+ interval = seconds / 2592000;
24
+ if (interval > 1) {
25
+ return date.toLocaleDateString("en-US", {
26
+ year: "numeric",
27
+ month: "short",
28
+ day: "numeric",
29
+ });
30
+ }
31
+ interval = seconds / 86400;
32
+ if (interval > 7) {
33
+ return date.toLocaleDateString("en-US", {
34
+ year: "numeric",
35
+ month: "short",
36
+ day: "numeric",
37
+ });
38
+ }
39
+ else if (interval > 1) {
40
+ return Math.floor(interval) + "d ago";
41
+ }
42
+ interval = seconds / 3600;
43
+ if (interval > 1) {
44
+ return Math.floor(interval) + "h ago";
45
+ }
46
+ interval = seconds / 60;
47
+ if (interval > 1) {
48
+ return Math.floor(interval) + "m ago";
49
+ }
50
+ return Math.floor(seconds) + "s ago";
51
+ };
52
+ const addMonths = (date, months) => {
53
+ date.setMonth(date.getMonth() + months);
54
+ return date;
55
+ };
56
+ exports.default = { getDate, getDateFormat, addMonths };
@@ -0,0 +1,33 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import { INotiHubStatsHistory } from "../types";
28
+ declare const NotiHubStatsHistory: import("mongoose").Model<INotiHubStatsHistory, {}, {}, {}, import("mongoose").Document<unknown, {}, INotiHubStatsHistory> & INotiHubStatsHistory & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ } & {
31
+ __v?: number | undefined;
32
+ }, any>;
33
+ export default NotiHubStatsHistory;
@@ -0,0 +1,14 @@
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 mongoose_1 = require("mongoose");
7
+ const NotificationStatsHistorySchema_1 = __importDefault(require("./schemas/NotificationStatsHistorySchema"));
8
+ // 2. Create a Schema corresponding to the document interface.
9
+ const notihubStatsHistorySchema = new mongoose_1.Schema(NotificationStatsHistorySchema_1.default, {
10
+ timestamps: true,
11
+ });
12
+ // 3. Create a Model.
13
+ const NotiHubStatsHistory = (0, mongoose_1.model)("INotiHubStatsHistories", notihubStatsHistorySchema);
14
+ exports.default = NotiHubStatsHistory;
@@ -0,0 +1,33 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import { INotiHubStats } from "../types";
28
+ declare const EntityNotiHubStats: import("mongoose").Model<INotiHubStats, {}, {}, {}, import("mongoose").Document<unknown, {}, INotiHubStats> & INotiHubStats & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ } & {
31
+ __v?: number | undefined;
32
+ }, any>;
33
+ export default EntityNotiHubStats;
@@ -0,0 +1,17 @@
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 mongoose_1 = require("mongoose");
7
+ const CustomerSchema_1 = __importDefault(require("./schemas/CustomerSchema"));
8
+ // 2. Create a Schema corresponding to the document interface.
9
+ const entityNotiHubStatsSchema = new mongoose_1.Schema({
10
+ entity: CustomerSchema_1.default,
11
+ notifications: { type: Number, default: 0 },
12
+ subscription: { type: Number, default: 0 },
13
+ views: { type: Number, default: 0 },
14
+ }, { timestamps: true });
15
+ // 3. Create a Model.
16
+ const EntityNotiHubStats = (0, mongoose_1.model)("EntityNotiHubStats", entityNotiHubStatsSchema);
17
+ exports.default = EntityNotiHubStats;