parent
e0a88ff461
commit
c9e25c7d99
@ -0,0 +1,8 @@ |
|||||||
|
const mongoose = require('mongoose'); |
||||||
|
|
||||||
|
const SaveSchema = new mongoose.Schema({ |
||||||
|
name: {type: String, unique: true}, |
||||||
|
saves: {type: Map, default: new Map()} |
||||||
|
}); |
||||||
|
|
||||||
|
module.exports = mongoose.model('saves', SaveSchema); |
@ -0,0 +1,10 @@ |
|||||||
|
module.exports = (length) => { |
||||||
|
let result = ''; |
||||||
|
let characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; |
||||||
|
let charactersLength = characters.length; |
||||||
|
let i; |
||||||
|
for (i = 0; i < length; i++ ) { |
||||||
|
result += characters.charAt(Math.floor(Math.random() * charactersLength)); |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
Loading…
Reference in new issue