@konplit-services/common 1.0.159 → 1.0.161

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.
@@ -100,6 +100,7 @@ declare class AppConfigs {
100
100
  getWalletDBURI(): string;
101
101
  getNATSURI(): string;
102
102
  getWebsiteDBURI(): string;
103
+ getSettlementDBURI(): string;
103
104
  getNATSPassword(): string;
104
105
  getNATSUsername(): string;
105
106
  getSettlementInterval(): string;
@@ -71,6 +71,12 @@ class AppConfigs {
71
71
  }
72
72
  return this.env.Mongo_WEBSITE_URI;
73
73
  }
74
+ getSettlementDBURI() {
75
+ if (!this.env.MONGO_SETTLEMENT_URI) {
76
+ throw new Error("MONGO_SETTLEMENT_URI is required");
77
+ }
78
+ return this.env.MONGO_SETTLEMENT_URI;
79
+ }
74
80
  getNATSPassword() {
75
81
  if (!this.env.NATS_PASSWORD) {
76
82
  throw new Error("NATS_PASSWORD is required");
@@ -1,6 +1,11 @@
1
1
  import { PLAN_INTERVAL } from "./plan-types";
2
2
  export declare const formatDate: (dataString: string) => string;
3
3
  export declare const formatDateTime: (dataString: string) => string;
4
+ export declare const convertToDate: (date: string) => Date;
5
+ export declare const getPreviousDayRange: () => {
6
+ startOfPreviousDay: Date;
7
+ endOfPreviousDay: Date;
8
+ };
4
9
  type PlanInterval = keyof typeof PLAN_INTERVAL;
5
10
  export declare const getDuration: (duration: PlanInterval) => number;
6
11
  export {};
@@ -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.getDuration = exports.formatDateTime = exports.formatDate = void 0;
6
+ exports.getDuration = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.formatDate = void 0;
7
7
  const dayjs_1 = __importDefault(require("dayjs"));
8
8
  const plan_types_1 = require("./plan-types");
9
9
  const formatDate = (dataString) => {
@@ -14,6 +14,18 @@ const formatDateTime = (dataString) => {
14
14
  return (0, dayjs_1.default)(dataString).format("YYYY-MM-DD HH:mm:ss");
15
15
  };
16
16
  exports.formatDateTime = formatDateTime;
17
+ const convertToDate = (date) => {
18
+ return (0, dayjs_1.default)(date).toDate();
19
+ };
20
+ exports.convertToDate = convertToDate;
21
+ const getPreviousDayRange = () => {
22
+ // Get the start of the previous day (00:00:00)
23
+ const startOfPreviousDay = (0, dayjs_1.default)().subtract(1, "day").startOf("day").toDate();
24
+ // Get the end of the previous day (23:59:59.999)
25
+ const endOfPreviousDay = (0, dayjs_1.default)(startOfPreviousDay).endOf("day").toDate();
26
+ return { startOfPreviousDay, endOfPreviousDay };
27
+ };
28
+ exports.getPreviousDayRange = getPreviousDayRange;
17
29
  const getDuration = (duration) => {
18
30
  const currentDate = (0, dayjs_1.default)();
19
31
  switch (duration) {
@@ -26,6 +26,8 @@ export declare enum LOGACTIONS {
26
26
  PAGE_CATEGORY_DELETED = "PAGE_CATEGORY_DELETED",
27
27
  CONSTANT_UPDATED = "CONSTANT_UPDATED",
28
28
  CONSTANT_DELETED = "CONSTANT_DELETED",
29
+ SETTLEMENT_SETTING_CREATED = "SETTLEMENT_SETTING_CREATED",
30
+ SETTLEMENT_SETTING_UPDATED = "SETTLEMENT_SETTING_UPDATED",
29
31
  CONTACT_UPDATED = "CONTACT_UPDATED",
30
32
  CONTACT_DELETED = "CONTACT_DELETED",
31
33
  SOCIAL_UPDATED = "SOCIAL_UPDATED",
@@ -39,6 +39,9 @@ var LOGACTIONS;
39
39
  //CONSTANT
40
40
  LOGACTIONS["CONSTANT_UPDATED"] = "CONSTANT_UPDATED";
41
41
  LOGACTIONS["CONSTANT_DELETED"] = "CONSTANT_DELETED";
42
+ //SETTLEMENTSETTING
43
+ LOGACTIONS["SETTLEMENT_SETTING_CREATED"] = "SETTLEMENT_SETTING_CREATED";
44
+ LOGACTIONS["SETTLEMENT_SETTING_UPDATED"] = "SETTLEMENT_SETTING_UPDATED";
42
45
  //CONTACT
43
46
  LOGACTIONS["CONTACT_UPDATED"] = "CONTACT_UPDATED";
44
47
  LOGACTIONS["CONTACT_DELETED"] = "CONTACT_DELETED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.159",
3
+ "version": "1.0.161",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",