WIP basic card dropping

This commit is contained in:
2022-08-18 19:24:44 +02:00
parent 29e3e6de23
commit ae60732836
13 changed files with 265 additions and 58 deletions

23
util/cards.js Normal file
View File

@@ -0,0 +1,23 @@
const { customAlphabet } = require("nanoid");
const { Card, Character } = require("../models");
module.exports = {
name: "CardUtils",
generateIdentifier: function() {
const nanoid = customAlphabet('6789BCDFGHJKLMNPQRTW',6);
return nanoid();
},
getNextPrintNumber: async function(characterId) {
let count = await Card.count({
where: {
characterId: characterId
}
});
return count + 1;
},
getCharacterCount: async function(characterId) {
return await Character.count();
}
}