gambling-bot-shared 0.1.31 → 0.1.32

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.
@@ -9,17 +9,23 @@ exports.TransactionSchema = new mongoose_1.Schema({
9
9
  type: {
10
10
  type: String,
11
11
  required: true,
12
- enum: ['deposit', 'withdraw', 'bet', 'win', 'refund', 'bonus', 'vip'],
12
+ enum: ['deposit', 'withdraw', 'bet', 'win', 'refund', 'bonus', 'vip']
13
13
  },
14
14
  source: {
15
15
  type: String,
16
16
  required: true,
17
- enum: ['command', 'manual', 'web', 'system', 'casino'],
17
+ enum: ['command', 'manual', 'web', 'system', 'casino']
18
18
  },
19
19
  meta: { type: mongoose_1.Schema.Types.Mixed, default: {} },
20
20
  betId: { type: String, default: null },
21
- handledBy: { type: String, default: null },
21
+ handledBy: { type: String, default: null }
22
22
  }, { timestamps: { createdAt: true, updatedAt: false } });
23
+ exports.TransactionSchema.index({ betId: 1, type: 1 }, {
24
+ unique: true,
25
+ partialFilterExpression: {
26
+ betId: { $exists: true, $ne: null }
27
+ }
28
+ });
23
29
  // for pagination / sorting
24
30
  exports.TransactionSchema.index({ guildId: 1, createdAt: -1 });
25
31
  // filter + sort
@@ -46,6 +46,15 @@ export declare const UserSchema: Schema<TUser, import("mongoose").Model<TUser, a
46
46
  }, "id"> & {
47
47
  id: string;
48
48
  }> | undefined;
49
+ bonusBalance?: import("mongoose").SchemaDefinitionProperty<number, TUser, import("mongoose").Document<unknown, {}, TUser, {
50
+ id: string;
51
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TUser & {
52
+ _id: import("mongoose").Types.ObjectId;
53
+ } & {
54
+ __v: number;
55
+ }, "id"> & {
56
+ id: string;
57
+ }> | undefined;
49
58
  lockedBalance?: import("mongoose").SchemaDefinitionProperty<number, TUser, import("mongoose").Document<unknown, {}, TUser, {
50
59
  id: string;
51
60
  }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TUser & {
@@ -5,9 +5,10 @@ const mongoose_1 = require("mongoose");
5
5
  exports.UserSchema = new mongoose_1.Schema({
6
6
  userId: { type: String, required: true },
7
7
  guildId: { type: String, required: true },
8
- balance: { type: Number, default: 0 },
9
- lockedBalance: { type: Number, default: 0 },
8
+ balance: { type: Number, default: 0 }, // CASH (withdrawable)
9
+ bonusBalance: { type: Number, default: 0 }, // BONUS (non-withdrawable)
10
+ lockedBalance: { type: Number, default: 0 }, // ONLY for in-flight bets
10
11
  lastDailyClaim: { type: Date, default: null },
11
- dailyStreak: { type: Number, default: 0 },
12
+ dailyStreak: { type: Number, default: 0 }
12
13
  }, { timestamps: true });
13
14
  exports.UserSchema.index({ userId: 1, guildId: 1 }, { unique: true });
@@ -2,6 +2,7 @@ export type TUser = {
2
2
  userId: string;
3
3
  guildId: string;
4
4
  balance: number;
5
+ bonusBalance: number;
5
6
  lockedBalance: number;
6
7
  lastDailyClaim: Date | null;
7
8
  dailyStreak: number;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "gambling-bot-shared",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
7
- "type": "commonjs",
7
+ "type": "module",
8
8
  "files": [
9
9
  "dist"
10
10
  ],
@@ -23,9 +23,11 @@
23
23
  "release": "pnpm build && npm version patch && npm publish"
24
24
  },
25
25
  "peerDependencies": {
26
- "mongoose": "^9.0.0"
26
+ "mongoose": "^9.0.0",
27
+ "discord.js": "^14.25.1"
27
28
  },
28
29
  "devDependencies": {
30
+ "discord.js": "^14.25.1",
29
31
  "mongoose": "^9.1.4",
30
32
  "typescript": "^5.9.3"
31
33
  },