gameguard
Version:
GameGuard is a NodeJS game server that can be used to manage the players connecting to your game, manage rooms and the players in them, and more.
38 lines (29 loc) • 713 B
text/typescript
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
/**
* Defines the structure of a player in mongodb.
*/
const PlayerSchema = new Schema({
/**
* The id of the player as determined by the client.
*/
id: String,
/**
* This player's username.
*/
username: String,
/**
* The timestamp of when the player last connected to the GameGuard server.
*/
lastConnectedAt: Date,
/**
* Indicates whether the player is banned or not.
*/
isBanned: {
type: Boolean,
default: false,
},
});
PlayerSchema.index({ 'username': 'text' });
export default PlayerSchema;