@amohamud23/notihub 1.0.27 → 1.0.29
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/index.js +10 -0
- package/dist/lib/db/CustomerMinifiedModel.js +12 -0
- package/dist/lib/db/CustomerModel.js +12 -0
- package/dist/lib/db/NotiHubStatsHistoryModel.js +14 -0
- package/dist/lib/db/NotiHubStatsModel.js +17 -0
- package/dist/lib/db/NotiTypeModel.js +14 -0
- package/dist/lib/db/NotificationModel.js +18 -0
- package/dist/lib/db/NotificationStatsModel.js +15 -0
- package/dist/lib/db/SubscriptionModel.js +14 -0
- package/dist/lib/db/UserModel.js +12 -0
- package/dist/lib/db/index.js +23 -0
- package/dist/lib/db/schemas/CustomerMinifiedSchema.js +14 -0
- package/dist/lib/db/schemas/CustomerSchema.js +17 -0
- package/dist/lib/db/schemas/NotiTypeSchema.js +14 -0
- package/dist/lib/db/schemas/NotificationSchema.js +18 -0
- package/dist/lib/db/schemas/NotificationStatsHistorySchema.js +12 -0
- package/dist/lib/db/schemas/NotificationStatsSchema.js +8 -0
- package/dist/lib/db/schemas/SubscriptionSchema.js +16 -0
- package/dist/lib/db/schemas/UserSchema.js +11 -0
- package/dist/lib/util/DateUtil.js +56 -0
- package/index.d.ts +0 -1
- package/lib/db/CustomerMinifiedModel.ts +2 -8
- package/lib/db/CustomerModel.ts +2 -3
- package/lib/db/NotiHubStatsHistoryModel.ts +4 -8
- package/lib/db/NotiHubStatsModel.ts +2 -3
- package/lib/db/NotiTypeModel.ts +2 -3
- package/lib/db/NotificationModel.ts +2 -6
- package/lib/db/NotificationStatsModel.ts +2 -6
- package/lib/db/SubscriptionModel.ts +5 -11
- package/lib/db/UserModel.ts +2 -3
- package/lib/db/schemas/CustomerMinifiedSchema.ts +0 -1
- package/package.json +3 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
exports.schemas = exports.dateUtil = void 0;
|
|
7
|
+
const DateUtil_1 = __importDefault(require("./lib/util/DateUtil"));
|
|
8
|
+
const index_1 = __importDefault(require("./lib/db/index"));
|
|
9
|
+
exports.dateUtil = DateUtil_1.default;
|
|
10
|
+
exports.schemas = index_1.default;
|
|
@@ -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);
|
|
10
|
+
// 3. Create a Model.
|
|
11
|
+
const CustomerMinified = (0, mongoose_1.model)("CustomerMinified", customerMinifiedSchema);
|
|
12
|
+
exports.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 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
|
+
// 3. Create a Model.
|
|
11
|
+
const Customer = (0, mongoose_1.model)("Customer", customerSchema);
|
|
12
|
+
exports.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 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,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;
|
|
@@ -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 NotiTypeSchema_1 = __importDefault(require("./schemas/NotiTypeSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const notiTypeSchema = new mongoose_1.Schema(NotiTypeSchema_1.default, {
|
|
10
|
+
timestamps: true,
|
|
11
|
+
});
|
|
12
|
+
// 3. Create a Model.
|
|
13
|
+
const NotiTypeModel = (0, mongoose_1.model)("NotiTypes", notiTypeSchema);
|
|
14
|
+
exports.default = NotiTypeModel;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 notificationSchema = new mongoose_1.Schema({
|
|
10
|
+
title: { type: String, required: true },
|
|
11
|
+
message: { type: String, required: true },
|
|
12
|
+
type: { type: String, required: true },
|
|
13
|
+
body: { type: String },
|
|
14
|
+
entityMinified: CustomerSchema_1.default,
|
|
15
|
+
}, { timestamps: true });
|
|
16
|
+
// 3. Create a Model.
|
|
17
|
+
const NotificationModel = (0, mongoose_1.model)("Notification", notificationSchema);
|
|
18
|
+
exports.default = NotificationModel;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 NotificationSchema_1 = __importDefault(require("./schemas/NotificationSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const notificationSchema = new mongoose_1.Schema({
|
|
10
|
+
notification: NotificationSchema_1.default,
|
|
11
|
+
views: { type: Number, default: 0 },
|
|
12
|
+
}, { timestamps: true });
|
|
13
|
+
// 3. Create a Model.
|
|
14
|
+
const NotificationStatsModel = (0, mongoose_1.model)("NotificationStats", notificationSchema);
|
|
15
|
+
exports.default = NotificationStatsModel;
|
|
@@ -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 SubscriptionSchema_1 = __importDefault(require("./schemas/SubscriptionSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const subscriptionSchema = new mongoose_1.Schema(SubscriptionSchema_1.default, {
|
|
10
|
+
timestamps: true,
|
|
11
|
+
});
|
|
12
|
+
// 3. Create a Model.
|
|
13
|
+
const Subscription = (0, mongoose_1.model)("Subscriptions", subscriptionSchema);
|
|
14
|
+
exports.default = Subscription;
|
|
@@ -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 UserSchema_1 = __importDefault(require("./schemas/UserSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const userSchema = new mongoose_1.Schema(UserSchema_1.default, { timestamps: true });
|
|
10
|
+
// 3. Create a Model.
|
|
11
|
+
const UserModel = (0, mongoose_1.model)("User", userSchema);
|
|
12
|
+
exports.default = UserModel;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 UserModel_1 = __importDefault(require("./UserModel"));
|
|
7
|
+
const SubscriptionModel_1 = __importDefault(require("./SubscriptionModel"));
|
|
8
|
+
const NotiTypeModel_1 = __importDefault(require("./NotiTypeModel"));
|
|
9
|
+
const NotiHubStatsHistoryModel_1 = __importDefault(require("./NotiHubStatsHistoryModel"));
|
|
10
|
+
const NotificationStatsModel_1 = __importDefault(require("./NotificationStatsModel"));
|
|
11
|
+
const NotificationModel_1 = __importDefault(require("./NotificationModel"));
|
|
12
|
+
const CustomerModel_1 = __importDefault(require("./CustomerModel"));
|
|
13
|
+
const CustomerMinifiedModel_1 = __importDefault(require("./CustomerMinifiedModel"));
|
|
14
|
+
exports.default = {
|
|
15
|
+
UserModel: UserModel_1.default,
|
|
16
|
+
Subscription: SubscriptionModel_1.default,
|
|
17
|
+
NotiTypeModel: NotiTypeModel_1.default,
|
|
18
|
+
NotificationStatsModel: NotificationStatsModel_1.default,
|
|
19
|
+
NotiHubStatsHistory: NotiHubStatsHistoryModel_1.default,
|
|
20
|
+
NotificationModel: NotificationModel_1.default,
|
|
21
|
+
Customer: CustomerModel_1.default,
|
|
22
|
+
CustomerMinified: CustomerMinifiedModel_1.default,
|
|
23
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
5
|
+
const CustomerMinifiedSchema = {
|
|
6
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
7
|
+
username: { type: String, required: true },
|
|
8
|
+
img: {
|
|
9
|
+
bucket: { type: String, required: true },
|
|
10
|
+
key: { type: String, required: true },
|
|
11
|
+
},
|
|
12
|
+
name: { type: String, required: true },
|
|
13
|
+
};
|
|
14
|
+
exports.default = CustomerMinifiedSchema;
|
|
@@ -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 CustomerMinifiedSchema_1 = __importDefault(require("./CustomerMinifiedSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const CustomerSchema = {
|
|
10
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
11
|
+
minified: CustomerMinifiedSchema_1.default,
|
|
12
|
+
paid: { type: Boolean, default: false },
|
|
13
|
+
email: { type: String, required: true },
|
|
14
|
+
verified: { type: Boolean, default: false },
|
|
15
|
+
confirmed: { type: Boolean, default: false },
|
|
16
|
+
};
|
|
17
|
+
exports.default = CustomerSchema;
|
|
@@ -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("./CustomerSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const NotiTypeSchema = {
|
|
10
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
11
|
+
entity: CustomerSchema_1.default,
|
|
12
|
+
type: { type: String, required: true },
|
|
13
|
+
};
|
|
14
|
+
exports.default = NotiTypeSchema;
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./CustomerMinifiedSchema"));
|
|
8
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
9
|
+
const NotificationSchema = {
|
|
10
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
11
|
+
title: { type: String, required: true },
|
|
12
|
+
message: { type: String, required: true },
|
|
13
|
+
type: { type: String, required: true },
|
|
14
|
+
body: { type: String },
|
|
15
|
+
entityId: { type: String, required: true },
|
|
16
|
+
entityMinified: CustomerMinifiedSchema_1.default,
|
|
17
|
+
};
|
|
18
|
+
exports.default = NotificationSchema;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const NotihubStatsHistorySchema = {
|
|
5
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
6
|
+
entityId: { type: String, required: true },
|
|
7
|
+
notifications: { type: Number, required: true },
|
|
8
|
+
subscription: { type: Number, required: true },
|
|
9
|
+
views: { type: Number, required: true },
|
|
10
|
+
type: { type: String, required: true },
|
|
11
|
+
};
|
|
12
|
+
exports.default = NotihubStatsHistorySchema;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
4
|
+
const NotificationSchema = {
|
|
5
|
+
notification: Notification,
|
|
6
|
+
views: { type: Number, default: 0 },
|
|
7
|
+
};
|
|
8
|
+
exports.default = NotificationSchema;
|
|
@@ -0,0 +1,16 @@
|
|
|
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("./CustomerSchema"));
|
|
8
|
+
const UserSchema_1 = __importDefault(require("./UserSchema"));
|
|
9
|
+
// 2. Create a Schema corresponding to the document interface.
|
|
10
|
+
const SubscriptionSchema = {
|
|
11
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
12
|
+
subscriptionId: { type: String, required: true },
|
|
13
|
+
user: UserSchema_1.default,
|
|
14
|
+
entity: CustomerSchema_1.default,
|
|
15
|
+
};
|
|
16
|
+
exports.default = SubscriptionSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const UserSchema = {
|
|
5
|
+
id: { type: mongoose_1.Schema.Types.UUID, default: true },
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
email: { type: String, required: true },
|
|
8
|
+
pushToken: { type: String, required: true },
|
|
9
|
+
signedIn: { type: Boolean, required: true, default: false },
|
|
10
|
+
};
|
|
11
|
+
exports.default = UserSchema;
|
|
@@ -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
|
+
function addMonths(date, months) {
|
|
53
|
+
date.setMonth(date.getMonth() + months);
|
|
54
|
+
return date;
|
|
55
|
+
}
|
|
56
|
+
exports.default = { addMonths, getDate, getDateFormat };
|
package/index.d.ts
CHANGED
|
@@ -157,7 +157,6 @@ export interface NotiHubTypes {
|
|
|
157
157
|
INotiHubUserView: INotiHubUserView;
|
|
158
158
|
IUserSubscribeNotifier: IUserSubscribeNotifier;
|
|
159
159
|
IUserSubscription: IUserSubscription;
|
|
160
|
-
IUserSubscription: IUserSubscription;
|
|
161
160
|
INotiHubUser: INotiHubUser;
|
|
162
161
|
INotiTypeStats: INotiTypeStats;
|
|
163
162
|
INotiHubImage: INotiHubImage;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
2
|
import CustomerMinifiedSchema from "./schemas/CustomerMinifiedSchema";
|
|
3
|
-
import { INotiHubCustomerMinified } from "../..";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const customerMinifiedSchema = new Schema
|
|
7
|
-
CustomerMinifiedSchema
|
|
8
|
-
);
|
|
5
|
+
const customerMinifiedSchema = new Schema(CustomerMinifiedSchema);
|
|
9
6
|
|
|
10
7
|
// 3. Create a Model.
|
|
11
|
-
const CustomerMinified = model
|
|
12
|
-
"CustomerMinified",
|
|
13
|
-
customerMinifiedSchema
|
|
14
|
-
);
|
|
8
|
+
const CustomerMinified = model("CustomerMinified", customerMinifiedSchema);
|
|
15
9
|
|
|
16
10
|
export default CustomerMinified;
|
package/lib/db/CustomerModel.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
2
|
import CustomerMinifiedSchema from "./schemas/CustomerMinifiedSchema";
|
|
3
|
-
import { INotiHubCustomer } from "../..";
|
|
4
3
|
import CustomerSchema from "./schemas/CustomerSchema";
|
|
5
4
|
|
|
6
5
|
// 2. Create a Schema corresponding to the document interface.
|
|
7
|
-
const customerSchema = new Schema
|
|
6
|
+
const customerSchema = new Schema(CustomerSchema);
|
|
8
7
|
|
|
9
8
|
// 3. Create a Model.
|
|
10
|
-
const Customer = model
|
|
9
|
+
const Customer = model("Customer", customerSchema);
|
|
11
10
|
|
|
12
11
|
export default Customer;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
|
-
import { INotiHubStatsHistory } from "../..";
|
|
3
2
|
import NotihubStatsHistorySchema from "./schemas/NotificationStatsHistorySchema";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const notihubStatsHistorySchema = new Schema
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
timestamps: true,
|
|
10
|
-
}
|
|
11
|
-
);
|
|
5
|
+
const notihubStatsHistorySchema = new Schema(NotihubStatsHistorySchema, {
|
|
6
|
+
timestamps: true,
|
|
7
|
+
});
|
|
12
8
|
|
|
13
9
|
// 3. Create a Model.
|
|
14
|
-
const NotiHubStatsHistory = model
|
|
10
|
+
const NotiHubStatsHistory = model(
|
|
15
11
|
"INotiHubStatsHistories",
|
|
16
12
|
notihubStatsHistorySchema
|
|
17
13
|
);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
|
-
import { INotiHubStats } from "../..";
|
|
3
2
|
import CustomerSchema from "./schemas/CustomerSchema";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const entityNotiHubStatsSchema = new Schema
|
|
5
|
+
const entityNotiHubStatsSchema = new Schema(
|
|
7
6
|
{
|
|
8
7
|
entity: CustomerSchema,
|
|
9
8
|
notifications: { type: Number, default: 0 },
|
|
@@ -14,7 +13,7 @@ const entityNotiHubStatsSchema = new Schema<INotiHubStats>(
|
|
|
14
13
|
);
|
|
15
14
|
|
|
16
15
|
// 3. Create a Model.
|
|
17
|
-
const EntityNotiHubStats = model
|
|
16
|
+
const EntityNotiHubStats = model(
|
|
18
17
|
"EntityNotiHubStats",
|
|
19
18
|
entityNotiHubStatsSchema
|
|
20
19
|
);
|
package/lib/db/NotiTypeModel.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
|
-
import { INotiType } from "../..";
|
|
3
2
|
import NotiTypeSchema from "./schemas/NotiTypeSchema";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const notiTypeSchema = new Schema
|
|
5
|
+
const notiTypeSchema = new Schema(NotiTypeSchema, {
|
|
7
6
|
timestamps: true,
|
|
8
7
|
});
|
|
9
8
|
|
|
10
9
|
// 3. Create a Model.
|
|
11
|
-
const NotiTypeModel = model
|
|
10
|
+
const NotiTypeModel = model("NotiTypes", notiTypeSchema);
|
|
12
11
|
|
|
13
12
|
export default NotiTypeModel;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Schema, model, ObjectId } from "mongoose";
|
|
2
2
|
import CustomerSchema from "./schemas/CustomerSchema";
|
|
3
|
-
import { INotiHubNotification } from "../..";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const notificationSchema = new Schema
|
|
5
|
+
const notificationSchema = new Schema(
|
|
7
6
|
{
|
|
8
7
|
title: { type: String, required: true },
|
|
9
8
|
message: { type: String, required: true },
|
|
@@ -15,9 +14,6 @@ const notificationSchema = new Schema<INotiHubNotification>(
|
|
|
15
14
|
);
|
|
16
15
|
|
|
17
16
|
// 3. Create a Model.
|
|
18
|
-
const NotificationModel = model
|
|
19
|
-
"Notification",
|
|
20
|
-
notificationSchema
|
|
21
|
-
);
|
|
17
|
+
const NotificationModel = model("Notification", notificationSchema);
|
|
22
18
|
|
|
23
19
|
export default NotificationModel;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
2
|
import NotificationSchema from "./schemas/NotificationSchema";
|
|
3
|
-
import { INotiHubNotificationStats } from "../..";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const notificationSchema = new Schema
|
|
5
|
+
const notificationSchema = new Schema(
|
|
7
6
|
{
|
|
8
7
|
notification: NotificationSchema,
|
|
9
8
|
views: { type: Number, default: 0 },
|
|
@@ -12,9 +11,6 @@ const notificationSchema = new Schema<INotiHubNotificationStats>(
|
|
|
12
11
|
);
|
|
13
12
|
|
|
14
13
|
// 3. Create a Model.
|
|
15
|
-
const NotificationStatsModel = model
|
|
16
|
-
"NotificationStats",
|
|
17
|
-
notificationSchema
|
|
18
|
-
);
|
|
14
|
+
const NotificationStatsModel = model("NotificationStats", notificationSchema);
|
|
19
15
|
|
|
20
16
|
export default NotificationStatsModel;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import mongoose, { Document, Schema, Types, model } from "mongoose";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import SubscriptionSchema from "./schemas/SubscriptionSchema";
|
|
4
4
|
|
|
5
5
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const subscriptionSchema = new Schema
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
timestamps: true,
|
|
10
|
-
}
|
|
11
|
-
);
|
|
6
|
+
const subscriptionSchema = new Schema(SubscriptionSchema, {
|
|
7
|
+
timestamps: true,
|
|
8
|
+
});
|
|
12
9
|
|
|
13
10
|
// 3. Create a Model.
|
|
14
|
-
const Subscription = model
|
|
15
|
-
"Subscriptions",
|
|
16
|
-
subscriptionSchema
|
|
17
|
-
);
|
|
11
|
+
const Subscription = model("Subscriptions", subscriptionSchema);
|
|
18
12
|
|
|
19
13
|
export default Subscription;
|
package/lib/db/UserModel.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Schema, model } from "mongoose";
|
|
2
2
|
import UserSchema from "./schemas/UserSchema";
|
|
3
|
-
import { INotiHubUser } from "../..";
|
|
4
3
|
|
|
5
4
|
// 2. Create a Schema corresponding to the document interface.
|
|
6
|
-
const userSchema = new Schema
|
|
5
|
+
const userSchema = new Schema(UserSchema, { timestamps: true });
|
|
7
6
|
|
|
8
7
|
// 3. Create a Model.
|
|
9
|
-
const UserModel = model
|
|
8
|
+
const UserModel = model("User", userSchema);
|
|
10
9
|
|
|
11
10
|
export default UserModel;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amohamud23/notihub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "Notihub Package",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npx tsc",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|