Compare commits
No commits in common. "807c87d4243130e7d1c67ae6bc43f67430daa47a" and "3b9706ae944bebfdd447aa267c190558d85d6359" have entirely different histories.
807c87d424
...
3b9706ae94
3 changed files with 11 additions and 3 deletions
|
@ -47,6 +47,14 @@ export default class Inventory extends AppBaseEntity {
|
|||
return single;
|
||||
}
|
||||
|
||||
public static async ExistsByCardNumberAndUserId(userId: string, cardNumber: string): Promise<boolean> {
|
||||
const repository = AppDataSource.getRepository(Inventory);
|
||||
|
||||
const count = await repository.count({ where: { UserId: userId, CardNumber: cardNumber }});
|
||||
|
||||
return count != 0;
|
||||
}
|
||||
|
||||
public static async FetchAllByUserId(userId: string): Promise<Inventory[]> {
|
||||
const repository = AppDataSource.getRepository(Inventory);
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ export default class ImageHelper {
|
|||
const imageData = await Jimp.read(filePath);
|
||||
|
||||
if (userId != null) {
|
||||
const claimed = await Inventory.FetchOneByCardNumberAndUserId(userId, card.id);
|
||||
const claimed = await Inventory.ExistsByCardNumberAndUserId(userId, card.id);
|
||||
|
||||
if (!claimed || claimed.Quantity == 0) {
|
||||
if (!claimed) {
|
||||
imageData.greyscale();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export default class SeriesHelper {
|
|||
const seriesOnPage = series.splice(page * itemsPerPage, itemsPerPage);
|
||||
|
||||
const description = seriesOnPage
|
||||
.map(x => `[${x.id}] ${x.name} (${x.cards.length} cards)`)
|
||||
.map(x => `[${x.id}] ${x.name} (x${x.cards.length})`)
|
||||
.join("\n");
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
Loading…
Reference in a new issue