Coder Social home page Coder Social logo

clubhouse-pos-importer's People

Contributors

jaikamat avatar

Stargazers

 avatar

clubhouse-pos-importer's Issues

Fix receipt printer error

Steps to reproduce:

  • Unsuspend a sale
  • Attempt to print a receipt
  • The printer spools paper infinitely until manual intervention is required

Current fix:

  • The user adds and removes a card from the suspending sale, and the receipt prints as normal

Notes: There might be a DOM artifact lying around that creates a style of variable height

Remove partial Mongo URI to .env file

Currently we interpolate the username and password for the mongo connection URI in gc_functions/updatePrices/mongoBulkImport. Move all this data to a dotenv .env file for added security and ease of use via crontab.

We should still be getting the database name from the user to differentiate between test and production collections.

Improve logout component

Clicking 'log out' in menu should sign the user out immediately, rather than the two clicks it currently takes to log out

  • Edit e2e tests for this feature, as logout workflow has changed

Advanced search, facing customers

Customers currently can only search for cards based on title. We should be allowing customers to search based on certain qualities, such a borderless/EA art, foil/nonfoil availability, and other parameters.

Circle back with staff to determine what customers ask for most, and what search features could be useful to them. Also, think about general keyword searches, not exact title searches.

Move to TCGmedian for pricing guidelines

Due to spikes in demand for recent cards, use a new pricing provider or scraper for displaying prices to customers under the Search tab. Right now we're using TCGmarket, should be using TCGmedian.

New API tests

Can we mock out a testing database to create integration tests for the interactors?

This should be created and destroyed before and after the runner executes the suite.

Tenth Edition cards continue to hassle

We need to remove these errors in one shot on a quiet day while a manager is on duty. Single-removal adds too much user overhead; the inventory is not kept up to date

Suspend Sale replacement needs to occur on the backend

When users currently re-suspend a suspended sale, we delete and re-suspend the sale client-side. We need to be doing this backend, passing through an ID via params if we want to overwrite (edit), and no ID if we want to create a new suspendedSale.

Refactor Receiving to use Context API

Receiving is a hot mess of tightly-coupled and prop-drilled top-level component methods. It could use a refactor to make the base more maintainable and extensible for (inevitable) updates going forward.

Card variants need to be visible on receipts

Staff currently see items like CARDNAME | NONFOIL_NM | QTY: 1 on line items when fetching inventory for customers. Printed receipts also need to highlight the border treatments (alternate or Godzilla art) as well for clarity.

Staff search by frame type

border_color: borderless and frame_effects including the string extendedart should be supported so staff can field these requests from customers.

Idle logout

After ten minutes of idle time, a user should be logged out and redirected to the login page

Integrate Mongoose for strict schema management

The inventory entities remain untyped, which may cause frustration in future feature releases. We should be typing them via an ODM or through Typescript classes to coerce, for more stability at compile-time

Round prices on customer view

Customers should see not only cards lower than 50 cents at 50 cents, but also all cards should be rounded to the nearest 50 cents.

Always round to the nearest 50 cent price on any view that faces customers.

ex. $1.18 => $1.50
ex. $0.18 => $0.50

Suspend Receiving

Users should be able to suspend receiving of cards in-progress.

Implementation: Store suspended array in mongo tied to a UUID.

Prices in aggregation should pull directly from bulk data

Scryfall will soon implement bulk pricing! This will greatly improve lookup speed on the deckbox clone method, getCardsByFilter.

We should be refactoring the aggregation pipeline operations to pull directly from the prices property on bulk data rather than performing a $lookup on the scraped pricing collection.

Display "Today's Sales" under Browse Sales tab

Users have to search for each card by title, which is a cumbersome way to view sales. Create one endpoint that retrieves the day's singles sales for at-a-glance reporting, and refactor the existing getSales endpoint to retrieve single cards. Both endpoints should expose more data about the sale, price, id, etc for use cross-platform ins Lightspeed POS.

$unset legalities property on documents in card_inventory collection

When we fetch cards with getCardsByFilter, we merge objects in both the card_inventory and scryfall_bulk_cards tables by using the $replaceRoot functionality in the Mongo aggregation pipeline. However, some cards have legalities within their inventory entries because of legacy persistence functions, and these legalities conflict with the newer, fresh bulk legalities - $replaceRoot does not replace them. Because format legalities are mutable and may change over time, we should look to $unset only legalities in the card_inventory collection.

  • $unset the legalities property in the card_inventory collection in the test db
  • Write testing to confirm that getCardsByFilter works as expected
  • $unset the legalities property in the production inventory collection

Monitor/refactor updatePrices functionality on cloud VM

Need to create a .env file to manage the mongo connection URI, and ensure the update prices function doesn't hang. Perhaps scrape/bulkUpdate in batches to avoid memory-space issues.

  • Refactor the updatePrices main function to scrape in batches
  • Refactor to bulk update in batches
  • Reinstate daily cron tasks

Must be able to view lists of all multicolored cards

There must be a selector in the colors dropdown that allows users to query the inventory for a list of cards with two or more colors in their mana costs.

Select 'multi' for a list of all multicolored cards, which deselects and overrides all other color selectors in the React form. Then collate a list by checking for cards with more than one color in the colors property on the backend.

Refactor database and API to use Scryfall bulk file as source of truth

This goes deeper than we'd thought. May have to make some drastic changes to the db layer and how data is stored/retrieved. The ultimate source of truth should be Scryfall's bulk data file. Currently, when inventory is added, we are copying a data source that may/may not mutate over time, into the inventory collection.

What should be happening is, we should make a collection of just QOH and other store-relevant properties tied to an _id property, and use the aggregation pipeline to "zip" these up, especially when retrieving cards for title queries and altering inventory.

We can test this in development - start thinking about just the Manage Inventory view and routes, and what changes will propagate out site-wide.

Possible low-hanging fruit: Some React components rely on either GET_SCRYFALL_BULK_BY_TITLE or GET_CARDS_BY_TITLE. Unify these by aggregating them against available inventory and scryfall_bulk_cards into their own endpoint GET_CARDS_AND_QOH (don't alter the database yet). Test them thoroughly within their necessary components.

Then, migrate the inventory data to a suitably concise and compact model. Something along the lines of:

{ _id: <id>, qoh: <qoh_object> }

Originally posted by @jaikamat in #8 (comment)

Foreign card support

Staff need to be able to:

  • Add and remove foreign language cards
  • Sell foreign language cards

Customers need to be able to:

  • Query and view foreign language cards

Todo:

  • Add a language dropdown to the staff search bar in all views
  • Alter the getCardsWithInfo endpoint to receive a language filter. If language is provided, filter on that language. Otherwise if not provided, retrieve all cards.
  • Default the UI to English for all views
  • Test queries for time and efficiency, and functionality

Notes:

  • Download the scryfall all-cards bulk and upsert that (alter the upsertion script)

  • Ensure the scryfall _ids are all the same

  • Ensure the get function retrieves cards as normal

  • Edit the backend function to filter on language if provided in queryparams

  • Stream the and filter all_cards bulk into separate language files by filtering on language property, then update to the database using the new upsert file

  • One script for the default_cards, one script for language support. Should save the json as scryfall-bulk-language-<lang>.json and take in params of lang for language to parse out and write

  • Add "language" label to all card headers to show the language of the card in the event of no image available

  • Add the lang property to the ScryfallCard class on the frontend

Make edits to splash page

Core 2021 booster box preorders are over, so those should reflect the $110 price point. Collector boosters stay the same until July 3rd.

Receiving endpoint should take in list of cards

When receiving cards, we currently map over the receiving list of cards with promised calls to addCardToInventory. Any failures within the Promise.all will not be rolled back. We need to create an endpoint that takes in a list of cards, increments each one in the database, and returns a list that was persisted for frontend use so this is not managed client-side.

API endpoint receiveCards should:

  • take in an array of scryfallCards
  • $set and increment the quantity received
  • insert card documents that do not exist in inventory yet

Move Sale and Customer Sale-List to use Context API

Sale components are extremely tightly-coupled around top-level state management and prop-drilling, which makes testing individual component testing difficult outside of e2e tests. Decouple the view from its corresponding model by using the context API and Hooks.

Update TCGmarket prices in DB using cron

Prices for the whole dataset take about 5-6 hours to scrape politely. We should not be executing this script and pushing it to Mongo manually.

Using the Google VM, write a cron task to execute this script once or twice per week. Refactor the script as needed, too!

Devoid sorted as colorless

Cards with the Devoid attribute are sorted as colorless, despite having colored pips in their casting costs. Presumably because Scryfall (rightly so) designates these cards as colorless. Will have to explore the data for other options to identify cards with Devoid correctly.

Create landing page

The current landing page is not designed with UX in mind - gather some reference to make it look nice and clean, modern, etc.

Support buylist receipts

We need a history of buylist records. Customers may want to know what they were offered if the trade was store credit.

Image hover on SaleList and ReceivingList line items

Users should be able to hover on line-items to see the image previews of cards, rather than relying solely on title and set data to inform them (this is especially true in the current climate of alternate art printings and variants).

  • Sale list should show images on title hover
  • Receiving list should show images on title hover

Customers should be able to create sale tickets

Customers should be able to create their own sale tickets, to be viewed and fulfilled by Clubhouse employees. Brainstorm a workflow and edge-cases for implementation. This will likely be a large, comprehensive feature spanning multiple fullstack services.

IP Series/Showcase should be visible on Receiving list

Users currently can't differentiate between Borderless, Extended, IP Series, or other special treatments across cards in Receiving.

  • Expose these properties to the receiving components
  • Perhaps add an image hover over title to allow users to see the actual cards rather than descriptors
  • Add a sufficient amount of e2e testing coverage

Linking #26 here, because it could use a refactor prior to making the change.

SaleContext does not clear searched cards on finalizeSale

When a user clicks 'Finalize Sale' and then 'Yes', the searched-cards (on the left) are not cleared and their inventory values not updated, which may lead to edge cases when the same card is sold back-to-back. Users choose the incorrect quantity to sell, and thus are unable to fulfill an order in its entirety.

Clear the searched-cards by integrating them into the SaleContext emptying the array on sale submission.

Report on cards queried with no results

Useful data would be cards searched for by customers which yield no results. Would allow staff to place orders that directly target in-store demand.

This should ideally be placed in the 'Reporting' feature and allow users to set a variable time frame.

Implementation could be as easy as tacking on a resultQuantity: <int> message to each getCardsWithInfo log and querying the logs API somehow by resultQuantity: 0 to then collate, filter and yield. Odds are it'll be far more involved than that.

Refactor mongoImport script

Refactor the mongoImport script (which updates bulk files) to instead use the bulkWrite API.

There will be some conflicts transitioning from using the natively-assigned ObjectID() to the Scryfall id, most notably in $lookups and perhaps some frontend components that require the card _id

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.