Compare commits
3 commits
3b9706ae94
...
807c87d424
Author | SHA1 | Date | |
---|---|---|---|
807c87d424 | |||
a419513ea3 | |||
29bb22a819 |
3 changed files with 3 additions and 11 deletions
|
@ -47,14 +47,6 @@ 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.ExistsByCardNumberAndUserId(userId, card.id);
|
||||
const claimed = await Inventory.FetchOneByCardNumberAndUserId(userId, card.id);
|
||||
|
||||
if (!claimed) {
|
||||
if (!claimed || claimed.Quantity == 0) {
|
||||
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${x.cards.length})`)
|
||||
.map(x => `[${x.id}] ${x.name} (${x.cards.length} cards)`)
|
||||
.join("\n");
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
|
|
Loading…
Reference in a new issue