crazy-odds-bet-shared 1.0.21 → 1.0.23

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.
@@ -17,9 +17,7 @@ const competitionSchema = new Schema(
17
17
  season: { type: String, required: false, sparse: true },
18
18
  isActive: { type: Boolean, default: true },
19
19
  externalRefs: { type: Schema.Types.Mixed, default: {} },
20
- providerRefs: { type: Schema.Types.Mixed, default: {} },
21
- provider: { type: String, sparse: true },
22
- feeds: { type: Schema.Types.Mixed, default: {} }
20
+ providerRefs: { type: Schema.Types.Mixed, default: {} }
23
21
  },
24
22
  {
25
23
  ...baseSchemaOptions,
@@ -15,6 +15,7 @@ const providerSchema = new Schema(
15
15
  baseUrl: { type: String, required: true },
16
16
  apiKey: { type: String, required: true },
17
17
  isActive: { type: Boolean, default: true },
18
+ params: { type: [String], default: [] },
18
19
  metadata: { type: Schema.Types.Mixed, default: {} }
19
20
  },
20
21
  {
package/models/team.js CHANGED
@@ -11,6 +11,7 @@ const teamSchema = new Schema(
11
11
  {
12
12
  ...createBaseSchema(),
13
13
  sportId: { type: String, required: true, ref: 'Sport' },
14
+ competitionId: { type: String, required: true, ref: 'Competition' },
14
15
  name: { type: String, required: true },
15
16
  slug: { type: String, unique: true, sparse: true },
16
17
  isActive: { type: Boolean, default: true },
@@ -23,6 +24,7 @@ const teamSchema = new Schema(
23
24
 
24
25
  // Indexes (slug unique/sparse from schema)
25
26
  teamSchema.index({ sportId: 1 });
27
+ teamSchema.index({ competitionId: 1 });
26
28
  teamSchema.index({ isActive: 1 });
27
29
  teamSchema.index({ name: 'text' });
28
30
 
@@ -34,6 +36,13 @@ teamSchema.virtual('sport', {
34
36
  justOne: true
35
37
  });
36
38
 
39
+ teamSchema.virtual('competition', {
40
+ ref: 'Competition',
41
+ localField: 'competitionId',
42
+ foreignField: '_id',
43
+ justOne: true
44
+ });
45
+
37
46
  // Static methods
38
47
  teamSchema.static('findBySlug', function (slug) {
39
48
  return this.findOne({ slug });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crazy-odds-bet-shared",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Shared MongoDB models and utilities for odds project",
5
5
  "main": "index.js",
6
6
  "exports": {