File size: 1,568 Bytes
44eba2f
 
908a44c
 
 
 
 
 
 
 
44eba2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00eae7f
 
 
908a44c
 
 
 
 
 
 
44eba2f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const mongoose = require('mongoose');

const CollectionItemSchema = new mongoose.Schema({
    itemId: String,
    itemName: String,
    from: String,       // 'self' or userId who gifted
    fromName: String,   // display name of gifter
    date: { type: Date, default: Date.now },
}, { _id: false });

const UserSchema = new mongoose.Schema({
    userId: { type: String, required: true, unique: true },
    username: String,
    wallet: { type: Number, default: 500 },
    bank: { type: Number, default: 0 },
    health: { type: Number, default: 100 },
    isDead: { type: Boolean, default: false },
    lastDeath: { type: Date, default: null },
    lastDaily: { type: Date, default: null },
    lastMissionClaim: { type: Date, default: null },
    lastInpageMissionClaim: { type: Date, default: null },
    dailyAdsCount: { type: Number, default: 0 },
    lastAdWatchDate: { type: Date, default: null },
    lastRob: { type: Date, default: null },
    lastKill: { type: Date, default: null },
    xp: { type: Number, default: 0 },
    level: { type: Number, default: 1 },
    kills: { type: Number, default: 0 },
    robs: { type: Number, default: 0 },
    totalEarned: { type: Number, default: 0 },
    // Shop & inventory
    inventory: { type: [CollectionItemSchema], default: [] },
    // Chat activity auto-earn
    lastChatEarnDate: { type: String, default: null }, // 'YYYY-MM-DD'
    chatEarnedToday: { type: Number, default: 0 },
    // Blacklist
    blacklisted: { type: Boolean, default: false },
});

module.exports = mongoose.model('User', UserSchema);