This commit is contained in:
Sebastian Rindom
2020-01-18 15:08:22 +01:00
parent 2d8dd4b0a9
commit c7cf9b8061
58 changed files with 9873 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
import mongoose from "mongoose"
class IdMap {
ids = {}
getId(key) {
if (this.ids[key]) {
return this.ids[key]
}
const id = `${mongoose.Types.ObjectId()}`
this.ids[key] = id
return id
}
}
const instance = new IdMap()
export default instance