UVicMartletplace / martletplace

Recreating FB Marketplace for Students - UVic SENG499 Capstone Project
0 stars 0 forks source link

Emila/70 search engine operations #201

Closed emilasuska closed 3 months ago

emilasuska commented 3 months ago

Description

This is a PR implementing search reindex API post, patch, and delete methods and their corresponding tests.

It includes completing:

  1. All of these API endpoints with backend:

    • /api/search/reindex/listing-created
    • /api/search/reindex/listing-edited
    • /api/search/reindex/listing-deleted
  2. Integration tests using a test-index which is initialized before each test and destroyed after each test. All tests use the elasticsearch endpoint.

Closes #70

How to Test

  1. Checkout this branch

  2. In a terminal, navigate to the martletplace directory and run docker-compose up --build

  3. Wait a minute for the data layer (particularly elasticsearch) to get ready for input

  4. In a terminal, run docker exec -it martletplace_search bash

  5. In the bash terminal, run pytest src/test_server.py

How to manually test:

  1. Uncomment this port in docker-compose.yml image

  2. Build the container

  3. Wait a minute for the data layer (particularly elasticsearch) to get ready for input

  4. In a browser, navigate to localhost:8221/docs

  5. Play with the reindexing endpoints and search endpoint there by creating listings, searching for them based on different parameters, and deleting them

Checklist

GDeane commented 3 months ago

In terms of security. The user_id field is currently acting as a template which should be parsed from an authorization token (the method should fail if that isn't valid. That wasn't in our PR but we were assuming @MNThomson was going to add that when setting up the JWT token stuff.

As far as errors and PGSync, we're sticking to the working implementation based on our agreement for Sprint 2 to implement a minimum viable product, but for Sprint 3 it's a great idea.