Coding Challenge Guidelines

  • Implement post upvote
    • This should take in a Post ID and apply a single upvote to the Post.
    • What if the same user upvotes twice?
  • Implement post list
    • This should take in a PostQuery object and return an array of Posts relative to the query.
    • How would you validate the input? didn't get this
    • Bonus: Implement a Hot sort using this algorithm or make your own.
  • Implement posts by user
    • This should take in a PostQuery and a username and return an array of Posts that are by that user.

Evaluation Criteria

  • Rust best practices
  • Completeness: did you complete the features?
  • Correctness: does the functionality act in sensible, thought-out ways?
  • Maintainability: is it written in a clean, maintainable way?
  • Scalable: What if there was 100,000 Posts? 1,000,000 Posts?

Useful Links

Running the project locally

Install Internet Computer Client

DFX_VERSION=0.9.3 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

You may need the Rust WASM target added

rustup update
rustup target add wasm32-unknown-unknown

To run the project you will need to do the following.

# Starts the replica, running in the background
dfx start --background

# Deploys your canisters to the replica and generates your candid interface
dfx deploy

# Inserts some data into the canister
./scripts/setup.sh

Once the job completes, your application will be available at http://127.0.0.1:8000?canisterId={__Candid_UI}&{dscvr_takehome_rust}. Which is found in .dfx/local/canisters/canister_ids.json

Issue handling

Reinstalling rust project

Data model changes usually require a reinstall. There are work arounds for this, but for this take home test, reinstalling is fine.

npm run reinstall

Type yes at WARNING

CodeSubmit

Please organize, design, test, and document your code as if it were going into production - then push your changes to the master branch.

Have fun coding! 🚀