CardUtils: Add helper to get one-line formatted card info

This commit is contained in:
2022-11-23 17:34:01 +01:00
parent 42797eb90e
commit 78fe0857e8

View File

@@ -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})`;
} }
} }