@wrcb/cb-common 1.0.89 → 1.0.94

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.
@@ -1,5 +1,5 @@
1
1
  import { Subjects } from './subjects';
2
- import { OddConfiguration } from './types/oddConfiguration';
2
+ import { OddType } from './types/oddType';
3
3
  import { PredictionOptions } from './types/predictions';
4
4
  export interface PredictionStartedEvent {
5
5
  subject: Subjects.PredictionStarted;
@@ -12,7 +12,7 @@ export interface PredictionStartedEvent {
12
12
  image: string;
13
13
  version: number;
14
14
  deadLine: Date;
15
- oddConfiguration: OddConfiguration;
15
+ oddType: OddType;
16
16
  predictionOptions: PredictionOptions[];
17
17
  market: {
18
18
  id: string;
@@ -1,5 +1,5 @@
1
1
  import { Subjects } from './subjects';
2
- import { OddConfiguration } from './types/oddConfiguration';
2
+ import { OddType } from './types/oddType';
3
3
  import { PredictionOptions } from './types/predictions';
4
4
  export interface PredictionUpdatedEvent {
5
5
  subject: Subjects.PredictionUpdated;
@@ -12,7 +12,7 @@ export interface PredictionUpdatedEvent {
12
12
  image: string;
13
13
  version: number;
14
14
  deadLine: Date;
15
- oddConfiguration: OddConfiguration;
15
+ oddType: OddType;
16
16
  predictionOptions: PredictionOptions[];
17
17
  market: {
18
18
  id: string;
@@ -1,4 +1,4 @@
1
- export declare enum OddConfiguration {
1
+ export declare enum OddType {
2
2
  Automatic05 = "Autom\u00E1tico 05",
3
3
  Automatic06 = "Autom\u00E1tico 06",
4
4
  Automatic07 = "Autom\u00E1tico 07",
@@ -7,3 +7,8 @@ export declare enum OddConfiguration {
7
7
  Automatic10 = "Autom\u00E1tico 10",
8
8
  Manual = "Manual"
9
9
  }
10
+ export interface OddConfiguration {
11
+ oddType: OddType;
12
+ housePercentage: number;
13
+ }
14
+ export declare const oddInfoMap: Record<OddType, OddConfiguration>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oddInfoMap = exports.OddType = void 0;
4
+ var OddType;
5
+ (function (OddType) {
6
+ OddType["Automatic05"] = "Autom\u00E1tico 05";
7
+ OddType["Automatic06"] = "Autom\u00E1tico 06";
8
+ OddType["Automatic07"] = "Autom\u00E1tico 07";
9
+ OddType["Automatic08"] = "Autom\u00E1tico 08";
10
+ OddType["Automatic09"] = "Autom\u00E1tico 09";
11
+ OddType["Automatic10"] = "Autom\u00E1tico 10";
12
+ OddType["Manual"] = "Manual";
13
+ })(OddType || (exports.OddType = OddType = {}));
14
+ exports.oddInfoMap = {
15
+ [OddType.Automatic05]: {
16
+ oddType: OddType.Automatic05,
17
+ housePercentage: 5,
18
+ },
19
+ [OddType.Automatic06]: {
20
+ oddType: OddType.Automatic06,
21
+ housePercentage: 6,
22
+ },
23
+ [OddType.Automatic07]: {
24
+ oddType: OddType.Automatic07,
25
+ housePercentage: 7,
26
+ },
27
+ [OddType.Automatic08]: {
28
+ oddType: OddType.Automatic08,
29
+ housePercentage: 8,
30
+ },
31
+ [OddType.Automatic09]: {
32
+ oddType: OddType.Automatic09,
33
+ housePercentage: 9,
34
+ },
35
+ [OddType.Automatic10]: {
36
+ oddType: OddType.Automatic10,
37
+ housePercentage: 10,
38
+ },
39
+ [OddType.Manual]: {
40
+ oddType: OddType.Manual,
41
+ housePercentage: 0, // Pode ser 0 por padrão, já que será manualmente definido
42
+ },
43
+ };
@@ -1,5 +1,5 @@
1
1
  import { Market } from './market';
2
- import { OddConfiguration } from './oddConfiguration';
2
+ import { OddType } from './oddType';
3
3
  import { PredictionStatus } from './predictionStatus';
4
4
  export interface Prediction {
5
5
  market: Market;
@@ -10,7 +10,7 @@ export interface Prediction {
10
10
  slug: string;
11
11
  status: PredictionStatus;
12
12
  deadLine: Date;
13
- oddConfiguration: OddConfiguration;
13
+ oddType: OddType;
14
14
  predictionOptions: PredictionOptions[];
15
15
  }
16
16
  export interface PredictionOptions {
@@ -21,4 +21,5 @@ export interface Options {
21
21
  optionId: string;
22
22
  optionLabel: string;
23
23
  optionWinner: boolean;
24
+ optionInitialOdd: number;
24
25
  }
@@ -1,5 +1,5 @@
1
1
  import { MarketStatus } from '../events/types/marketStatus';
2
- import { OddConfiguration } from '../events/types/oddConfiguration';
2
+ import { OddType } from '../events/types/oddType';
3
3
  import { PredictionOptions } from '../events/types/predictions';
4
4
  import { PredictionStatus } from '../events/types/predictionStatus';
5
5
  export declare function BuildMarketObject(title?: string, description?: string, status?: MarketStatus, priority?: number): {
@@ -8,12 +8,12 @@ export declare function BuildMarketObject(title?: string, description?: string,
8
8
  status: MarketStatus;
9
9
  priority: number;
10
10
  };
11
- export declare function BuildPredictionObject(market: any, predictionOptions?: any, title?: string, details?: string, status?: PredictionStatus, deadLine?: Date, oddConfiguration?: OddConfiguration, image?: string, rules?: string, slug?: string): {
11
+ export declare function BuildPredictionObject(market: any, predictionOptions?: any, title?: string, details?: string, status?: PredictionStatus, deadLine?: Date, oddType?: OddType, image?: string, rules?: string, slug?: string): {
12
12
  title: string;
13
13
  details: string;
14
14
  status: PredictionStatus;
15
15
  deadLine: Date;
16
- oddConfiguration: OddConfiguration;
16
+ oddType: OddType;
17
17
  image: string;
18
18
  rules: string;
19
19
  slug: string;
@@ -10,7 +10,7 @@ exports.BuildPredictionOptionsMultipleOptionsArray = BuildPredictionOptionsMulti
10
10
  exports.BuildBetObject = BuildBetObject;
11
11
  const uuid_1 = require("uuid");
12
12
  const marketStatus_1 = require("../events/types/marketStatus");
13
- const oddConfiguration_1 = require("../events/types/oddConfiguration");
13
+ const oddType_1 = require("../events/types/oddType");
14
14
  const predictionStatus_1 = require("../events/types/predictionStatus");
15
15
  const createIdMongoose_1 = __importDefault(require("./createIdMongoose"));
16
16
  function BuildMarketObject(title, description, status, priority) {
@@ -21,13 +21,13 @@ function BuildMarketObject(title, description, status, priority) {
21
21
  priority: priority !== null && priority !== void 0 ? priority : 1,
22
22
  };
23
23
  }
24
- function BuildPredictionObject(market, predictionOptions, title, details, status, deadLine, oddConfiguration, image, rules, slug) {
24
+ function BuildPredictionObject(market, predictionOptions, title, details, status, deadLine, oddType, image, rules, slug) {
25
25
  return {
26
26
  title: title !== null && title !== void 0 ? title : 'Will Donald Trump win?',
27
27
  details: details !== null && details !== void 0 ? details : 'prediction about elections',
28
28
  status: status !== null && status !== void 0 ? status : predictionStatus_1.PredictionStatus.Created,
29
29
  deadLine: deadLine !== null && deadLine !== void 0 ? deadLine : new Date(),
30
- oddConfiguration: oddConfiguration !== null && oddConfiguration !== void 0 ? oddConfiguration : oddConfiguration_1.OddConfiguration.Automatic05,
30
+ oddType: oddType !== null && oddType !== void 0 ? oddType : oddType_1.OddType.Automatic05,
31
31
  image: image !== null && image !== void 0 ? image : 'image',
32
32
  rules: rules !== null && rules !== void 0 ? rules : 'rules',
33
33
  slug: slug !== null && slug !== void 0 ? slug : 'slug',
@@ -43,12 +43,14 @@ function BuildPredictionOptionsTwoOptionsArray() {
43
43
  {
44
44
  optionId: (0, uuid_1.v4)(),
45
45
  optionLabel: 'Sim',
46
- optionWinner: false
46
+ optionWinner: false,
47
+ optionInitialOdd: 0
47
48
  },
48
49
  {
49
50
  optionId: (0, uuid_1.v4)(),
50
51
  optionLabel: 'Não',
51
- optionWinner: false
52
+ optionWinner: false,
53
+ optionInitialOdd: 0
52
54
  },
53
55
  ],
54
56
  },
package/build/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export * from './events/types/ledgerOperation';
22
22
  export * from './events/types/ledgerOperationMode';
23
23
  export * from './events/types/country';
24
24
  export * from './events/types/userRole';
25
- export * from './events/types/oddConfiguration';
25
+ export * from './events/types/oddType';
26
26
  export * from './events/types/predictions';
27
27
  export * from './events/commentCreatedEvent';
28
28
  export * from './events/commentUpdatedEvent';
package/build/index.js CHANGED
@@ -38,7 +38,7 @@ __exportStar(require("./events/types/ledgerOperation"), exports);
38
38
  __exportStar(require("./events/types/ledgerOperationMode"), exports);
39
39
  __exportStar(require("./events/types/country"), exports);
40
40
  __exportStar(require("./events/types/userRole"), exports);
41
- __exportStar(require("./events/types/oddConfiguration"), exports);
41
+ __exportStar(require("./events/types/oddType"), exports);
42
42
  __exportStar(require("./events/types/predictions"), exports);
43
43
  __exportStar(require("./events/commentCreatedEvent"), exports);
44
44
  __exportStar(require("./events/commentUpdatedEvent"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.89",
3
+ "version": "1.0.94",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OddConfiguration = void 0;
4
- var OddConfiguration;
5
- (function (OddConfiguration) {
6
- OddConfiguration["Automatic05"] = "Autom\u00E1tico 05";
7
- OddConfiguration["Automatic06"] = "Autom\u00E1tico 06";
8
- OddConfiguration["Automatic07"] = "Autom\u00E1tico 07";
9
- OddConfiguration["Automatic08"] = "Autom\u00E1tico 08";
10
- OddConfiguration["Automatic09"] = "Autom\u00E1tico 09";
11
- OddConfiguration["Automatic10"] = "Autom\u00E1tico 10";
12
- OddConfiguration["Manual"] = "Manual";
13
- })(OddConfiguration || (exports.OddConfiguration = OddConfiguration = {}));