@positivegrid/pg-mongoose-schema 27.8.4 → 28.0.0-beta.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.
Files changed (120) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +34 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/models/banks.d.ts +3 -0
  5. package/dist/models/banks.js +33 -0
  6. package/dist/models/banks.js.map +1 -0
  7. package/dist/models/device.d.ts +3 -0
  8. package/dist/models/device.js +48 -0
  9. package/dist/models/device.js.map +1 -0
  10. package/dist/models/featuredList.d.ts +3 -0
  11. package/dist/models/featuredList.js +70 -0
  12. package/dist/models/featuredList.js.map +1 -0
  13. package/dist/models/hardware.d.ts +3 -0
  14. package/dist/models/hardware.js +213 -0
  15. package/dist/models/hardware.js.map +1 -0
  16. package/dist/models/homeConfig.d.ts +3 -0
  17. package/dist/models/homeConfig.js +38 -0
  18. package/dist/models/homeConfig.js.map +1 -0
  19. package/dist/models/oauth.d.ts +3 -0
  20. package/dist/models/oauth.js +48 -0
  21. package/dist/models/oauth.js.map +1 -0
  22. package/dist/models/partner.d.ts +3 -0
  23. package/dist/models/partner.js +165 -0
  24. package/dist/models/partner.js.map +1 -0
  25. package/dist/models/payment.d.ts +3 -0
  26. package/dist/models/payment.js +859 -0
  27. package/dist/models/payment.js.map +1 -0
  28. package/dist/models/pgConfig.d.ts +3 -0
  29. package/dist/models/pgConfig.js +64 -0
  30. package/dist/models/pgConfig.js.map +1 -0
  31. package/dist/models/preset.d.ts +3 -0
  32. package/dist/models/preset.js +802 -0
  33. package/dist/models/preset.js.map +1 -0
  34. package/dist/models/promotion.d.ts +3 -0
  35. package/dist/models/promotion.js +585 -0
  36. package/dist/models/promotion.js.map +1 -0
  37. package/dist/models/redeem.d.ts +3 -0
  38. package/dist/models/redeem.js +26 -0
  39. package/dist/models/redeem.js.map +1 -0
  40. package/dist/models/toneTheme.d.ts +3 -0
  41. package/dist/models/toneTheme.js +29 -0
  42. package/dist/models/toneTheme.js.map +1 -0
  43. package/dist/models/toneThemeFeaturedList.d.ts +3 -0
  44. package/dist/models/toneThemeFeaturedList.js +18 -0
  45. package/dist/models/toneThemeFeaturedList.js.map +1 -0
  46. package/dist/models/user.d.ts +3 -0
  47. package/dist/models/user.js +565 -0
  48. package/dist/models/user.js.map +1 -0
  49. package/dist/models/userTrack.d.ts +3 -0
  50. package/dist/models/userTrack.js +82 -0
  51. package/dist/models/userTrack.js.map +1 -0
  52. package/dist/types/banks.types.d.ts +25 -0
  53. package/dist/types/banks.types.js +3 -0
  54. package/dist/types/banks.types.js.map +1 -0
  55. package/dist/types/device.types.d.ts +41 -0
  56. package/dist/types/device.types.js +3 -0
  57. package/dist/types/device.types.js.map +1 -0
  58. package/dist/types/featuredList.types.d.ts +32 -0
  59. package/dist/types/featuredList.types.js +3 -0
  60. package/dist/types/featuredList.types.js.map +1 -0
  61. package/dist/types/hardware.types.d.ts +123 -0
  62. package/dist/types/hardware.types.js +3 -0
  63. package/dist/types/hardware.types.js.map +1 -0
  64. package/dist/types/homeConfig.types.d.ts +24 -0
  65. package/dist/types/homeConfig.types.js +3 -0
  66. package/dist/types/homeConfig.types.js.map +1 -0
  67. package/dist/types/index.d.ts +17 -0
  68. package/dist/types/index.js +34 -0
  69. package/dist/types/index.js.map +1 -0
  70. package/dist/types/oauth.types.d.ts +38 -0
  71. package/dist/types/oauth.types.js +3 -0
  72. package/dist/types/oauth.types.js.map +1 -0
  73. package/dist/types/partner.types.d.ts +91 -0
  74. package/dist/types/partner.types.js +3 -0
  75. package/dist/types/partner.types.js.map +1 -0
  76. package/dist/types/payment.types.d.ts +304 -0
  77. package/dist/types/payment.types.js +3 -0
  78. package/dist/types/payment.types.js.map +1 -0
  79. package/dist/types/pgConfig.types.d.ts +35 -0
  80. package/dist/types/pgConfig.types.js +3 -0
  81. package/dist/types/pgConfig.types.js.map +1 -0
  82. package/dist/types/preset.types.d.ts +110 -0
  83. package/dist/types/preset.types.js +3 -0
  84. package/dist/types/preset.types.js.map +1 -0
  85. package/dist/types/promotion.types.d.ts +282 -0
  86. package/dist/types/promotion.types.js +3 -0
  87. package/dist/types/promotion.types.js.map +1 -0
  88. package/dist/types/redeem.types.d.ts +16 -0
  89. package/dist/types/redeem.types.js +3 -0
  90. package/dist/types/redeem.types.js.map +1 -0
  91. package/dist/types/toneTheme.types.d.ts +16 -0
  92. package/dist/types/toneTheme.types.js +3 -0
  93. package/dist/types/toneTheme.types.js.map +1 -0
  94. package/dist/types/toneThemeFeaturedList.types.d.ts +9 -0
  95. package/dist/types/toneThemeFeaturedList.types.js +3 -0
  96. package/dist/types/toneThemeFeaturedList.types.js.map +1 -0
  97. package/dist/types/user.types.d.ts +166 -0
  98. package/dist/types/user.types.js +6 -0
  99. package/dist/types/user.types.js.map +1 -0
  100. package/dist/types/userTrack.types.d.ts +39 -0
  101. package/dist/types/userTrack.types.js +12 -0
  102. package/dist/types/userTrack.types.js.map +1 -0
  103. package/package.json +38 -12
  104. package/index.js +0 -28
  105. package/models/banks.js +0 -42
  106. package/models/device.js +0 -51
  107. package/models/featuredList.js +0 -91
  108. package/models/hardware.js +0 -256
  109. package/models/homeConfig.js +0 -86
  110. package/models/oauth.js +0 -52
  111. package/models/partner.js +0 -265
  112. package/models/payment.js +0 -899
  113. package/models/pgConfig.js +0 -88
  114. package/models/preset.js +0 -845
  115. package/models/promotion.js +0 -590
  116. package/models/redeem.js +0 -26
  117. package/models/toneTheme.js +0 -78
  118. package/models/toneThemeFeaturedList.js +0 -49
  119. package/models/user.js +0 -639
  120. package/models/userTrack.js +0 -107
@@ -0,0 +1,82 @@
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.default = default_1;
7
+ const userTrack_types_1 = require("../types/userTrack.types");
8
+ const debug_1 = __importDefault(require("debug"));
9
+ const log = (0, debug_1.default)("model:usertrack");
10
+ function default_1(mongoose) {
11
+ const { Schema } = mongoose;
12
+ const { ObjectId } = Schema.Types;
13
+ const GenericDataSchema = new Schema({
14
+ data_type: { type: String, required: true },
15
+ data_key: { type: String, required: true },
16
+ data_value: { type: Schema.Types.Mixed, required: true },
17
+ data_meta: { type: Schema.Types.Mixed, default: null },
18
+ created_on: { type: Date, default: Date.now },
19
+ }, { collection: "pg_generic_data" });
20
+ const IapEventSchema = new Schema({
21
+ user_id: { type: ObjectId, ref: "User", required: true },
22
+ app_name: { type: String, required: true },
23
+ onesignal_id: { type: String, default: null },
24
+ redeem_code: { type: ObjectId, default: null },
25
+ created_on: { type: Date, default: Date.now },
26
+ region: { type: String, required: false },
27
+ }, { collection: "pg_iap_event" });
28
+ const DemoUserTrackerSchema = new Schema({
29
+ user_id: { type: ObjectId, ref: "User", required: true },
30
+ product: { type: String, required: true },
31
+ addition: { type: Number, required: true },
32
+ started_at: { type: Date, required: true },
33
+ updated_at: { type: Date, default: null },
34
+ created_on: { type: Date, default: Date.now },
35
+ }, { collection: "demo_user_tracker" });
36
+ DemoUserTrackerSchema.index({ user_id: 1, product: 1, addition: 1, started_at: 1, updated_at: 1 }, { unique: true });
37
+ DemoUserTrackerSchema.static({
38
+ async saveTrackData(data) {
39
+ try {
40
+ const { product, addition } = data;
41
+ const userID = new mongoose.Types.ObjectId(data.userID);
42
+ const startedAt = parseInt(data.startedAt, 10);
43
+ const startedAtDate = new Date(startedAt);
44
+ log("!!", data, startedAtDate, !isNaN(startedAtDate.getTime()), mongoose.Types.ObjectId.isValid(userID), userID);
45
+ if (!mongoose.Types.ObjectId.isValid(userID) ||
46
+ !userTrack_types_1.PRODUCTS.includes(product) ||
47
+ !(addition in userTrack_types_1.LICENSE_ADDITION)) {
48
+ throw new Error(`Invalid parameter: ${String(userID)}/${product}/${addition}`);
49
+ }
50
+ if (!startedAt || isNaN(startedAtDate.getTime())) {
51
+ throw new Error(`Invalid timestamp format: ${startedAt}`);
52
+ }
53
+ const trackData = {
54
+ user_id: userID,
55
+ product,
56
+ addition: userTrack_types_1.LICENSE_ADDITION[addition],
57
+ started_at: startedAtDate,
58
+ };
59
+ if ("updatedAt" in data && data.updatedAt !== undefined) {
60
+ const updatedAt = parseInt(data.updatedAt, 10);
61
+ const updatedAtDate = new Date(updatedAt);
62
+ if (updatedAt && !isNaN(updatedAtDate.getTime())) {
63
+ trackData.updated_at = updatedAtDate;
64
+ }
65
+ }
66
+ const ret = await this.findOne(trackData).exec();
67
+ if (!ret) {
68
+ await this.create(trackData);
69
+ }
70
+ return true;
71
+ }
72
+ catch (err) {
73
+ log("ERR:handleLicensePurchaseData:%j", err);
74
+ throw err;
75
+ }
76
+ },
77
+ });
78
+ mongoose.model("GenericData", GenericDataSchema);
79
+ mongoose.model("IapEvent", IapEventSchema);
80
+ mongoose.model("DemoUserTracker", DemoUserTrackerSchema);
81
+ }
82
+ //# sourceMappingURL=userTrack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userTrack.js","sourceRoot":"","sources":["../../src/models/userTrack.ts"],"names":[],"mappings":";;;;;AAgBA,4BAwGC;AA9GD,8DAAsE;AAEtE,kDAA0B;AAE1B,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,iBAAiB,CAAC,CAAC;AAErC,mBAAyB,QAAkB;IACzC,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IAC5B,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAElC,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAClC;QACE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC3C,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC1C,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxD,SAA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AAQ,CAAC,KAAK,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IBankListDocument extends Document {
3
+ name: string;
4
+ creator_id: Types.ObjectId;
5
+ description?: string;
6
+ preset_for: string;
7
+ created_on: Date;
8
+ updated_on: Date;
9
+ }
10
+ export type IBankListModel = Model<IBankListDocument>;
11
+ export interface IBankPresetsDocument extends Document {
12
+ name: string;
13
+ creator_id: Types.ObjectId;
14
+ bank_id: Types.ObjectId;
15
+ status: number;
16
+ description?: string;
17
+ preset_data: unknown;
18
+ preset_meta?: unknown;
19
+ image_url?: string;
20
+ thumb_url?: string;
21
+ created_on: Date;
22
+ updated_on: Date;
23
+ }
24
+ export type IBankPresetsModel = Model<IBankPresetsDocument>;
25
+ //# sourceMappingURL=banks.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=banks.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banks.types.js","sourceRoot":"","sources":["../../src/types/banks.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IDevice {
3
+ user_id: Types.ObjectId;
4
+ device_udid: string;
5
+ display_name?: string;
6
+ mac_address?: string;
7
+ machine_id?: string;
8
+ platform?: string;
9
+ architecture?: string;
10
+ os_version?: string;
11
+ model?: string;
12
+ activate_random?: string;
13
+ other_info?: string;
14
+ created_on: Date;
15
+ }
16
+ export type IDeviceDocument = Document & IDevice;
17
+ export interface IDeviceQueryParams {
18
+ [key: string]: unknown;
19
+ }
20
+ export interface IDeviceModel extends Model<IDeviceDocument> {
21
+ getFeaturedPresetListByCondition(queryObj: IDeviceQueryParams): Promise<IDeviceDocument[]>;
22
+ }
23
+ export interface IIapActivationDocument extends Document {
24
+ user_id: Types.ObjectId;
25
+ device_id: Types.ObjectId;
26
+ main_product: string;
27
+ status: number;
28
+ created_on: Date;
29
+ updated_on: Date;
30
+ }
31
+ export type IIapActivationModel = Model<IIapActivationDocument>;
32
+ export interface IActivationStatusDocument extends Document {
33
+ user_id: Types.ObjectId;
34
+ device_id: Types.ObjectId;
35
+ license_id: Types.ObjectId;
36
+ status: number;
37
+ created_on: Date;
38
+ updated_on: Date;
39
+ }
40
+ export type IActivationStatusModel = Model<IActivationStatusDocument>;
41
+ //# sourceMappingURL=device.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=device.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.types.js","sourceRoot":"","sources":["../../src/types/device.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IFeaturedListDocument extends Document {
3
+ title: string;
4
+ description: string | null;
5
+ image_url: string | null;
6
+ thumb_url: string | null;
7
+ embed_url: string | null;
8
+ bg_url: string | null;
9
+ order: number;
10
+ type: string | null;
11
+ permission: unknown;
12
+ metadata: unknown[] | null;
13
+ is_shown: boolean;
14
+ list_for: string;
15
+ created_on: Date;
16
+ updated_on: Date;
17
+ }
18
+ export interface IFeaturedListQueryParams {
19
+ list_for?: string;
20
+ }
21
+ export interface IFeaturedListModel extends Model<IFeaturedListDocument> {
22
+ getFeaturedPresetListByCondition(reqQuery: IFeaturedListQueryParams): Promise<IFeaturedListDocument[]>;
23
+ getLimitedPresetLists(reqQuery: IFeaturedListQueryParams): Promise<IFeaturedListDocument[]>;
24
+ }
25
+ export interface IFeaturedPresetDocument extends Document {
26
+ featured_list_id: Types.ObjectId;
27
+ preset_id: Types.ObjectId;
28
+ order: number;
29
+ created_on: Date;
30
+ }
31
+ export type IFeaturedPresetModel = Model<IFeaturedPresetDocument>;
32
+ //# sourceMappingURL=featuredList.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=featuredList.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"featuredList.types.js","sourceRoot":"","sources":["../../src/types/featuredList.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,123 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IHardwareSeriesNumberDocument extends Document {
3
+ hw_sn: string;
4
+ channel: string | null;
5
+ status: number;
6
+ metadata?: unknown;
7
+ created_on: Date;
8
+ }
9
+ export interface IHardwareParsedResultWithPhase {
10
+ hwModel: string;
11
+ hwWattage: string;
12
+ hwVersion: string;
13
+ hwProductionPhase: string;
14
+ hwName: string;
15
+ hwPattern: string[];
16
+ }
17
+ export interface IHardwareParsedResultSpark {
18
+ hwName: string;
19
+ hwModel: string;
20
+ hwWattage: string;
21
+ hwProductType: string;
22
+ hwVersion: string;
23
+ hwYear: string;
24
+ hwMonth: string;
25
+ hwPattern: string[];
26
+ }
27
+ export type IHardwareParsedResult = IHardwareParsedResultWithPhase | IHardwareParsedResultSpark;
28
+ export interface IHardwareSeriesNumberModel extends Model<IHardwareSeriesNumberDocument> {
29
+ parseHardwareSeriesNumber(hwSn: string): Promise<IHardwareParsedResult>;
30
+ parseHardwareSerialNumberNoPromise(hwSn: string): IHardwareParsedResult | string;
31
+ }
32
+ export interface IHardwareActivationMetaDocument extends Document {
33
+ pattern: string[];
34
+ hw_sn_pattern: unknown;
35
+ hw_activate_license: Types.ObjectId[];
36
+ status: number;
37
+ created_on: Date;
38
+ }
39
+ export interface IFindMostMatchingMetaOptions {
40
+ allowEmpty?: boolean;
41
+ }
42
+ export interface IHardwareActivationMetaModel extends Model<IHardwareActivationMetaDocument> {
43
+ findMostMatchingMeta(snPatternArr: string[], opts?: IFindMostMatchingMetaOptions): Promise<IHardwareActivationMetaDocument | null>;
44
+ }
45
+ export interface IHardwareActivationRecordDocument extends Document {
46
+ user_id: Types.ObjectId;
47
+ hw_sn_id: Types.ObjectId;
48
+ hw_meta_id: Types.ObjectId | null;
49
+ hw_partner_id: Types.ObjectId | null;
50
+ activate_license: Types.ObjectId[];
51
+ status: number;
52
+ activate_on: Date;
53
+ }
54
+ export type IHardwareActivationRecordModel = Model<IHardwareActivationRecordDocument>;
55
+ export interface IHardwareActivationConflictDocument extends Document {
56
+ user_id: Types.ObjectId;
57
+ hw_sn_id: Types.ObjectId;
58
+ created_on: Date;
59
+ }
60
+ export type IHardwareActivationConflictModel = Model<IHardwareActivationConflictDocument>;
61
+ export interface IPartnerCouponDocument extends Document {
62
+ partner: string;
63
+ code: string;
64
+ status: number;
65
+ hw_sn_id?: Types.ObjectId;
66
+ created_on: Date;
67
+ }
68
+ export type IPartnerCouponModel = Model<IPartnerCouponDocument>;
69
+ export interface IWarehouseInventoryItem {
70
+ sku: string;
71
+ type: string;
72
+ total: number;
73
+ available: number;
74
+ transit: number;
75
+ lock: number;
76
+ }
77
+ export interface IWarehouseInventoryDocument extends Document {
78
+ warehouse: string;
79
+ country: string[];
80
+ status: number;
81
+ items: IWarehouseInventoryItem[];
82
+ created_on: Date;
83
+ }
84
+ export type IWarehouseInventoryModel = Model<IWarehouseInventoryDocument>;
85
+ export interface IItemInventoryHistoryDocument extends Document {
86
+ warehouse: string;
87
+ sku: string;
88
+ total: number;
89
+ available: number;
90
+ transit: number;
91
+ lock: number;
92
+ created_on: Date;
93
+ }
94
+ export type IItemInventoryHistoryModel = Model<IItemInventoryHistoryDocument>;
95
+ export interface ICountryHardwareSkuItem {
96
+ name?: string;
97
+ hw_sku: string[];
98
+ }
99
+ export interface ICountryHardwareSkuLevel {
100
+ level: number;
101
+ min: number;
102
+ max: number;
103
+ days: string;
104
+ }
105
+ export interface ICountryHardwareSkuSaleOverwrite {
106
+ level: number;
107
+ days: string;
108
+ }
109
+ export interface ICountryHardwareSkuDocument extends Document {
110
+ country: string[];
111
+ items: ICountryHardwareSkuItem[];
112
+ level: ICountryHardwareSkuLevel[];
113
+ sale_threshold?: number;
114
+ sale_region?: string;
115
+ sale_overwrite: ICountryHardwareSkuSaleOverwrite[];
116
+ not_sold: string[];
117
+ not_sold_threshold?: number;
118
+ express_ship_days?: string;
119
+ status: number;
120
+ created_on: Date;
121
+ }
122
+ export type ICountryHardwareSkuModel = Model<ICountryHardwareSkuDocument>;
123
+ //# sourceMappingURL=hardware.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=hardware.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hardware.types.js","sourceRoot":"","sources":["../../src/types/hardware.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import type { Document, Model } from "mongoose";
2
+ export interface IDataSource {
3
+ type: "tone_theme_query" | "tone_theme_ids" | "tone_theme_id";
4
+ tone_theme_id: string | null;
5
+ query: unknown;
6
+ ids: string[];
7
+ limit: number;
8
+ }
9
+ export interface ISection {
10
+ section_type: "tone_theme_banner" | "tone_theme_list" | "tone_theme_lists";
11
+ title: string | null;
12
+ order: number;
13
+ data_source: IDataSource;
14
+ }
15
+ export interface IHomeConfigDocument extends Document {
16
+ config_for: string;
17
+ locale: string;
18
+ sections: ISection[];
19
+ is_active: boolean;
20
+ created_on: Date;
21
+ updated_on: Date;
22
+ }
23
+ export type IHomeConfigModel = Model<IHomeConfigDocument>;
24
+ //# sourceMappingURL=homeConfig.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=homeConfig.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homeConfig.types.js","sourceRoot":"","sources":["../../src/types/homeConfig.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export * from "./banks.types";
2
+ export * from "./redeem.types";
3
+ export * from "./toneThemeFeaturedList.types";
4
+ export * from "./homeConfig.types";
5
+ export * from "./toneTheme.types";
6
+ export * from "./featuredList.types";
7
+ export * from "./pgConfig.types";
8
+ export * from "./device.types";
9
+ export * from "./oauth.types";
10
+ export * from "./userTrack.types";
11
+ export * from "./hardware.types";
12
+ export * from "./partner.types";
13
+ export * from "./user.types";
14
+ export * from "./preset.types";
15
+ export * from "./promotion.types";
16
+ export * from "./payment.types";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,34 @@
1
+ "use strict";
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
+ // Re-export all type interfaces for consumers
18
+ __exportStar(require("./banks.types"), exports);
19
+ __exportStar(require("./redeem.types"), exports);
20
+ __exportStar(require("./toneThemeFeaturedList.types"), exports);
21
+ __exportStar(require("./homeConfig.types"), exports);
22
+ __exportStar(require("./toneTheme.types"), exports);
23
+ __exportStar(require("./featuredList.types"), exports);
24
+ __exportStar(require("./pgConfig.types"), exports);
25
+ __exportStar(require("./device.types"), exports);
26
+ __exportStar(require("./oauth.types"), exports);
27
+ __exportStar(require("./userTrack.types"), exports);
28
+ __exportStar(require("./hardware.types"), exports);
29
+ __exportStar(require("./partner.types"), exports);
30
+ __exportStar(require("./user.types"), exports);
31
+ __exportStar(require("./preset.types"), exports);
32
+ __exportStar(require("./promotion.types"), exports);
33
+ __exportStar(require("./payment.types"), exports);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA8C;AAC9C,gDAA8B;AAC9B,iDAA+B;AAC/B,gEAA8C;AAC9C,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC;AACrC,mDAAiC;AACjC,iDAA+B;AAC/B,gDAA8B;AAC9B,oDAAkC;AAClC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC"}
@@ -0,0 +1,38 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IOauthClientDocument extends Document {
3
+ name: string;
4
+ clientId: string;
5
+ clientSecret: string;
6
+ }
7
+ export type IOauthClientModel = Model<IOauthClientDocument>;
8
+ export interface IAuthorizationCodeDocument extends Document {
9
+ code: string;
10
+ clientId: Types.ObjectId;
11
+ redirectURI: string;
12
+ userId: Types.ObjectId;
13
+ scopes: string[];
14
+ expiresAt: Date;
15
+ codeChallenge?: string;
16
+ codeChallengeMethod: string;
17
+ date: Date;
18
+ }
19
+ export type IAuthorizationCodeModel = Model<IAuthorizationCodeDocument>;
20
+ export interface IAccessTokenDocument extends Document {
21
+ token: string;
22
+ expirationDate: Date;
23
+ userId: Types.ObjectId;
24
+ clientId: Types.ObjectId;
25
+ scopes: string[];
26
+ date: Date;
27
+ }
28
+ export type IAccessTokenModel = Model<IAccessTokenDocument>;
29
+ export interface IRefreshTokenDocument extends Document {
30
+ refreshToken: string;
31
+ clientId: Types.ObjectId;
32
+ expirationDate: Date;
33
+ userId: Types.ObjectId;
34
+ scopes: string[];
35
+ date: Date;
36
+ }
37
+ export type IRefreshTokenModel = Model<IRefreshTokenDocument>;
38
+ //# sourceMappingURL=oauth.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=oauth.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.types.js","sourceRoot":"","sources":["../../src/types/oauth.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,91 @@
1
+ import type { Document, Model, Types } from "mongoose";
2
+ export interface IPartnerSalesMetaDocument extends Document {
3
+ partner_name: string;
4
+ sales_product: Types.ObjectId | null;
5
+ sales_bundle: Types.ObjectId | null;
6
+ b2b_redeem_id: number | null;
7
+ pg_sales_price: number;
8
+ purchase_price: number;
9
+ status: number;
10
+ created_on: Date;
11
+ }
12
+ export interface IPartnerSalesMetaModel extends Model<IPartnerSalesMetaDocument> {
13
+ getPartnerSalesMeta(partnerName: string): Promise<unknown[]>;
14
+ getSalesMetaWithSku(sku: string, partnerName: string): Promise<unknown>;
15
+ }
16
+ export interface IPartnerRedeemDocument extends Document {
17
+ partner_name: string;
18
+ sales_item_id: Types.ObjectId;
19
+ purchase_price: number;
20
+ redeem_keycode: string;
21
+ buyer: unknown;
22
+ order_number: string | null;
23
+ status: number;
24
+ metadata: unknown;
25
+ created_on: Date;
26
+ updated_on: Date;
27
+ }
28
+ export type IPartnerRedeemModel = Model<IPartnerRedeemDocument>;
29
+ export interface IPartnerSalesHistoryDocument extends Document {
30
+ partner_name: string;
31
+ sku: string;
32
+ title: string;
33
+ previous_price: number;
34
+ current_price: number;
35
+ updated_on: Date;
36
+ }
37
+ export type IPartnerSalesHistoryModel = Model<IPartnerSalesHistoryDocument>;
38
+ export interface IB2bRedeemOrderDetail {
39
+ product_id: Types.ObjectId | null;
40
+ bundle_id: Types.ObjectId | null;
41
+ quantity: number;
42
+ }
43
+ export interface IB2bRedeemOrderDocument extends Document {
44
+ dealer_id: Types.ObjectId;
45
+ order_id: number | null;
46
+ order_detail: IB2bRedeemOrderDetail[];
47
+ order_amount: number;
48
+ status: number;
49
+ created_on: Date;
50
+ }
51
+ export type IB2bRedeemOrderModel = Model<IB2bRedeemOrderDocument>;
52
+ export interface IB2bRedeemDocument extends Document {
53
+ redeem_code: string;
54
+ status: number;
55
+ redeem_order_id: Types.ObjectId;
56
+ apply_user_id: Types.ObjectId | null;
57
+ created_on: Date;
58
+ }
59
+ export type IB2bRedeemModel = Model<IB2bRedeemDocument>;
60
+ export interface IB2bDealerDocument extends Document {
61
+ dealer_id: Types.ObjectId;
62
+ business_name: string;
63
+ business_address: string;
64
+ business_phone: string;
65
+ business_website: string | null;
66
+ business_tax_id: string | null;
67
+ business_vat_id: string | null;
68
+ members: string[];
69
+ created_on: Date;
70
+ }
71
+ export type IB2bDealerModel = Model<IB2bDealerDocument>;
72
+ export interface IOemRedeemPromotionDocument extends Document {
73
+ redeem_product: string;
74
+ product_type: string;
75
+ partner_name: string;
76
+ promotion_type: string;
77
+ promotion_data: unknown;
78
+ status: number;
79
+ created_on: Date;
80
+ }
81
+ export interface IOemRedeemData {
82
+ metadata?: {
83
+ OEM_Name?: string;
84
+ product_name?: string;
85
+ type?: string;
86
+ };
87
+ }
88
+ export interface IOemRedeemPromotionModel extends Model<IOemRedeemPromotionDocument> {
89
+ findRedeemFullfillPromotion(redeemData: IOemRedeemData): Promise<IOemRedeemPromotionDocument[]>;
90
+ }
91
+ //# sourceMappingURL=partner.types.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=partner.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.types.js","sourceRoot":"","sources":["../../src/types/partner.types.ts"],"names":[],"mappings":""}