CardUtils: Add helper to get one-line formatted card info
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const { customAlphabet } = require("nanoid");
|
const { customAlphabet } = require("nanoid");
|
||||||
const { Card, Character } = require("../models");
|
const { Card, Character } = require("../models");
|
||||||
|
const { QUALITY_SYMBOLS } = require("../config/constants");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "CardUtils",
|
name: "CardUtils",
|
||||||
@@ -19,5 +20,9 @@ module.exports = {
|
|||||||
|
|
||||||
getCharacterCount: async function(characterId) {
|
getCharacterCount: async function(characterId) {
|
||||||
return await Character.count();
|
return await Character.count();
|
||||||
|
},
|
||||||
|
|
||||||
|
getShortString: function(card) {
|
||||||
|
return `[\`${card.identifier}\`] ${QUALITY_SYMBOLS[card.quality]} ${card.Character.name} (${card.printNr})`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user