Update the series view command to be in greyscale if the user has not claimed the card #297

Merged
Vylpes merged 5 commits from feature/279-series-view-image-grid-2 into develop 2024-07-12 17:35:13 +01:00
2 changed files with 2 additions and 10 deletions
Showing only changes of commit 807c87d424 - Show all commits

View file

@ -47,14 +47,6 @@ export default class Inventory extends AppBaseEntity {
return single; 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[]> { public static async FetchAllByUserId(userId: string): Promise<Inventory[]> {
const repository = AppDataSource.getRepository(Inventory); const repository = AppDataSource.getRepository(Inventory);

View file

@ -39,9 +39,9 @@ export default class ImageHelper {
const imageData = await Jimp.read(filePath); const imageData = await Jimp.read(filePath);
if (userId != null) { if (userId != null) {
const claimed = await Inventory.ExistsByCardNumberAndUserId(userId, card.id); const claimed = await Inventory.FetchOneByCardNumberAndUserId(userId, card.id);
Vylpes marked this conversation as resolved Outdated

This should also actually check the Quantity of the inventory, not just if it exists

This should also actually check the Quantity of the inventory, not just if it exists
if (!claimed) { if (!claimed || claimed.Quantity == 0) {
imageData.greyscale(); imageData.greyscale();
} }
} }