@bprotsyk/aso-core 1.2.42 → 1.2.44

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.
@@ -0,0 +1,4 @@
1
+ export declare enum FlashAppType {
2
+ GAMBLING = 0,
3
+ FINANCES = 1
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlashAppType = void 0;
4
+ var FlashAppType;
5
+ (function (FlashAppType) {
6
+ FlashAppType[FlashAppType["GAMBLING"] = 0] = "GAMBLING";
7
+ FlashAppType[FlashAppType["FINANCES"] = 1] = "FINANCES"; // do not change the order!
8
+ })(FlashAppType = exports.FlashAppType || (exports.FlashAppType = {}));
@@ -1,3 +1,4 @@
1
+ import { FlashAppType } from "flash/flash-app-type";
1
2
  import mongoose, { Model } from "mongoose";
2
3
  export interface IFlashApp {
3
4
  id: number;
@@ -21,6 +22,8 @@ export interface IFlashAppUpdated {
21
22
  plugUrl: string;
22
23
  reservePlugUrl?: string;
23
24
  policyUrl?: string;
25
+ type: FlashAppType;
26
+ geos: string;
24
27
  onesignalAppId: string;
25
28
  onesignalRestApiKey: string;
26
29
  developerName: string;
@@ -76,6 +79,7 @@ export declare const FlashAppSchema: mongoose.Schema<any, mongoose.Model<any, an
76
79
  } | undefined;
77
80
  }>;
78
81
  export declare const FlashAppSchemaUpdated: mongoose.Schema<any, mongoose.Model<any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
82
+ type: string;
79
83
  id: number;
80
84
  bundle: string;
81
85
  trackingUrl: string;
@@ -83,6 +87,7 @@ export declare const FlashAppSchemaUpdated: mongoose.Schema<any, mongoose.Model<
83
87
  onesignalRestApiKey: string;
84
88
  plugUrl: string;
85
89
  reservePlugUrl: string;
90
+ geos: string;
86
91
  developerName: string;
87
92
  developerEmail: string;
88
93
  developerOrganization: string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateSchemaAndMoveValue = exports.FlashAppSchemaUpdated = exports.FlashAppSchema = void 0;
4
+ const flash_app_type_1 = require("flash/flash-app-type");
4
5
  const mongoose_1 = require("mongoose");
5
6
  exports.FlashAppSchema = new mongoose_1.Schema({
6
7
  id: {
@@ -126,6 +127,15 @@ exports.FlashAppSchemaUpdated = new mongoose_1.Schema({
126
127
  unique: true,
127
128
  required: false
128
129
  },
130
+ type: {
131
+ type: String,
132
+ enum: flash_app_type_1.FlashAppType,
133
+ default: flash_app_type_1.FlashAppType.GAMBLING
134
+ },
135
+ geos: {
136
+ type: String,
137
+ required: true
138
+ },
129
139
  onesignalAppId: {
130
140
  type: String,
131
141
  unique: true,
@@ -175,27 +185,37 @@ exports.FlashAppSchemaUpdated = new mongoose_1.Schema({
175
185
  },
176
186
  }
177
187
  });
188
+ // TODO app type (casino / fin)
178
189
  async function updateSchemaAndMoveValue(model) {
179
- const updateOperation = {
180
- $addFields: {
181
- plugUrl: "$pastebinUrl",
182
- reservePlugUrl: null,
183
- developerName: "$generationOptions.keyDeveloperName",
184
- developerEmail: "$email",
185
- developerOrganization: "$generationOptions.keyDeveloperOrganization",
186
- },
187
- $project: {
188
- pastebinUrl: 0,
189
- email: 0,
190
- "generationOptions.keyFileName": 0,
191
- "generationOptions.keyDeveloperName": 0,
192
- "generationOptions.keyDeveloperOrganization": 0,
193
- "generationOptions.keyCountryCode": 0,
194
- "generationOptions.keyCity": 0,
195
- "generationOptions.keyAlias": 0,
196
- "generationOptions.keyPassword": 0,
197
- },
198
- };
199
- await model.updateMany({}, updateOperation);
190
+ let pipelineStage = [
191
+ {
192
+ $project: {
193
+ plugUrl: 0
194
+ }
195
+ }
196
+ ];
197
+ let aggregation = model.aggregate(pipelineStage);
198
+ await aggregation.exec();
199
+ // const updateOperation: UpdateQuery<IFlashAppUpdated> = {
200
+ // $set: {
201
+ // plugUrl: "$pastebinUrl",
202
+ // reservePlugUrl: null,
203
+ // developerName: "$generationOptions.keyDeveloperName",
204
+ // developerEmail: "$email",
205
+ // developerOrganization: "$generationOptions.keyDeveloperOrganization",
206
+ // },
207
+ // $unset: [
208
+ // "pastebinUrl",
209
+ // "email",
210
+ // "generationOptions.keyFileName",
211
+ // "generationOptions.keyDeveloperName",
212
+ // "generationOptions.keyDeveloperOrganization",
213
+ // "generationOptions.keyCountryCode",
214
+ // "generationOptions.keyCity",
215
+ // "generationOptions.keyAlias",
216
+ // "generationOptions.keyPassword",
217
+ // ],
218
+ // };
219
+ // await model.updateMany({}, updateOperation);
200
220
  }
201
221
  exports.updateSchemaAndMoveValue = updateSchemaAndMoveValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bprotsyk/aso-core",
3
- "version": "1.2.42",
3
+ "version": "1.2.44",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ export enum FlashAppType {
2
+ GAMBLING, FINANCES // do not change the order!
3
+ }
@@ -1,4 +1,5 @@
1
- import mongoose, { Model, model, Schema, UpdateQuery } from "mongoose";
1
+ import { FlashAppType } from "flash/flash-app-type";
2
+ import mongoose, { Model, model, PipelineStage, Schema, UpdateQuery, UpdateWithAggregationPipeline } from "mongoose";
2
3
 
3
4
  // TODO add date of policy in case we need to recreate it
4
5
  // and all data necessary. test
@@ -28,6 +29,8 @@ export interface IFlashAppUpdated {
28
29
  plugUrl: string
29
30
  reservePlugUrl?: string
30
31
  policyUrl?: string
32
+ type: FlashAppType,
33
+ geos: string,
31
34
 
32
35
  onesignalAppId: string
33
36
  onesignalRestApiKey: string
@@ -191,6 +194,15 @@ export const FlashAppSchemaUpdated = new Schema({
191
194
  unique: true,
192
195
  required: false
193
196
  },
197
+ type: {
198
+ type: String,
199
+ enum: FlashAppType,
200
+ default: FlashAppType.GAMBLING
201
+ },
202
+ geos: {
203
+ type: String,
204
+ required: true
205
+ },
194
206
 
195
207
  onesignalAppId: {
196
208
  type: String,
@@ -244,28 +256,40 @@ export const FlashAppSchemaUpdated = new Schema({
244
256
  },
245
257
  }
246
258
  })
247
-
259
+ // TODO app type (casino / fin)
248
260
  export async function updateSchemaAndMoveValue(model: Model<IFlashAppUpdated>): Promise<void> {
249
- const updateOperation: UpdateQuery<IFlashAppUpdated> = {
250
- $addFields: {
251
- plugUrl: "$pastebinUrl",
252
- reservePlugUrl: null,
253
- developerName: "$generationOptions.keyDeveloperName",
254
- developerEmail: "$email",
255
- developerOrganization: "$generationOptions.keyDeveloperOrganization",
256
- },
257
- $project: {
258
- pastebinUrl: 0,
259
- email: 0,
260
- "generationOptions.keyFileName": 0,
261
- "generationOptions.keyDeveloperName": 0,
262
- "generationOptions.keyDeveloperOrganization": 0,
263
- "generationOptions.keyCountryCode": 0,
264
- "generationOptions.keyCity": 0,
265
- "generationOptions.keyAlias": 0,
266
- "generationOptions.keyPassword": 0,
267
- },
268
- };
261
+ let pipelineStage: PipelineStage[] = [
262
+ {
263
+ $project: {
264
+ plugUrl: 0
265
+ }
266
+ }
267
+ ]
268
+
269
+ let aggregation = model.aggregate(pipelineStage)
270
+
271
+ await aggregation.exec()
272
+
273
+ // const updateOperation: UpdateQuery<IFlashAppUpdated> = {
274
+ // $set: {
275
+ // plugUrl: "$pastebinUrl",
276
+ // reservePlugUrl: null,
277
+ // developerName: "$generationOptions.keyDeveloperName",
278
+ // developerEmail: "$email",
279
+ // developerOrganization: "$generationOptions.keyDeveloperOrganization",
280
+ // },
281
+ // $unset: [
282
+ // "pastebinUrl",
283
+ // "email",
284
+ // "generationOptions.keyFileName",
285
+ // "generationOptions.keyDeveloperName",
286
+ // "generationOptions.keyDeveloperOrganization",
287
+ // "generationOptions.keyCountryCode",
288
+ // "generationOptions.keyCity",
289
+ // "generationOptions.keyAlias",
290
+ // "generationOptions.keyPassword",
291
+ // ],
292
+ // };
269
293
 
270
- await model.updateMany({}, updateOperation);
294
+ // await model.updateMany({}, updateOperation);
271
295
  }