No description
Find a file
Katie Purser 50e9191bac
All checks were successful
/ check_lfs (push) Successful in 3s
Documentation changes
2025-11-24 16:30:35 +00:00
.forgejo/workflows Initial commit 2025-11-20 18:27:26 +00:00
.vscode adding maven dependencies 2025-11-22 10:14:55 +00:00
api-gateway adding local instance of db; supabase broke :( 2025-11-23 02:23:27 +00:00
backend Admin panel Integration NOTE: was shown in demo (#59) 2025-11-23 23:48:35 +00:00
doc Initial commit 2025-11-20 18:27:26 +00:00
frontend Dockerizing frontend 2025-11-24 16:30:20 +00:00
infrastructure Dockerizing frontend 2025-11-24 16:30:20 +00:00
.gitattributes Initial commit 2025-11-20 18:27:26 +00:00
.gitignore created all microservices 2025-11-22 10:02:49 +00:00
.gitkeep Folder Restructuring for Clarity 2025-11-22 09:37:33 +00:00
.mailmap Initial commit 2025-11-20 18:27:26 +00:00
LICENSE Initial commit 2025-11-20 18:27:26 +00:00
package-lock.json API Gateway (#26) 2025-11-22 14:53:16 +00:00
README.md Documentation changes 2025-11-24 16:30:35 +00:00

Our demo was using the main branch, we integrated Admin page to connect with admin-service on another branch and did no push it to main until later Sunday evening. The functionality of admin page was demoed to the mentors and no additional changes were made after it. Our login and register service is fully integrated aswell. Rest of the website uses mock data.

NOTE: ensure you are in root of your cloned project.
To start our project you first need to direct to the infrastructure directory by running:


cd infrastructure


Next create an .env file in infrastructure and paste the following config into it.


POSTGRES_USER=dev_user POSTGRES_PASSWORD=dev_password POSTGRES_DB=dev_db

DB_SERVICE=db

PGADMIN_EMAIL=admin@example.com PGADMIN_PASSWORD=admin

DB_URL=jdbc:postgresql://db:5432/dev_db

JDBC_OPTIONS=prepareThreshold=0

REDIS_HOST=redis REDIS_PORT=6379

JWT_SECRET=H1kLSgTMIqyPhPVDDE42Rhtex0teK6lsst0JnzTX4+b0VB6d8VJsjeA3qqX+GojZdOlNTVjgvcG8XL+EiImyqQ== JWT_EXPIRATION=86400000


To start the backend of our project run the following command in your terminal, ensuring you are still in the infrastructure directory. This will create the containers for all microservices.


docker-compose up --build


EDIT
We dockerized the frontend on the 24th and pushed it to main, so the frontend container will be started with the rest when docker-compose up --build is run and will be accessible through the same link as below.

PREVIOUS METHOD TO RUN FRONTEND
To run our frontend go to frontend folder and run the following commands in a new terminal.


Run each command in that order ONE by ONE:

cd frontend

npm i

npm run dev

open link that displays in terminal or head over to http://localhost:5173


We added an gateway which acts as a communicator to use one base url with the same port which directs to api-gateway which then determins which micro service you are calling


eg: GET localhost:8080/users/**

** means doesnt matter whats added after users/

our gateway will look for endpoint with /users, which will then redirect it to a new endpoint. In our case it will redirect to user-service running on port 8081.


Our frontend development made sure all buttons and links work with each other (this has not been pushed to main, but is available on the branch "katie"). Our login and register service works as expected so when you open our website you can register a user and login. We did not get enough time to add an email service to confirm the users identity. This would have been a nice feature to have.

Most of our frontend is using mocked data. This would have been replaced with live data from our database but our integration did not go as expected due to backend development delays and underestimation in difficulty.

If you navigate to admin page you first will need to create another user by calling the /user/add endpoint which is listed below, next call the /user/{id}/report to report the user. When you navigate to admin page the reported content is a mock so if you try remove or dismiss you will face an error saying could not perform task as the content does not exist.

Navigate to reported users and all functionality should work as expected.

Below, we have listed our api endpoints to prove our backend is fully developed and if integrated with frontend that the functionality will work.

API Endpoints
All endpoints are accessed through the API Gateway at: http://localhost:8080

User Service Endpoints (/users) Note: was created for testing

Create a New User
POST http://localhost:8080/users/add
Request Body (JSON):
{
"email": "example@example.com",
"firstName": "John",
"lastName": "Doe"
}

Get User by ID
GET http://localhost:8080/users/{id}

Report a User
POST http://localhost:8080/users/{id}/report
Request Body (JSON):
{
"reason": "reason for report"
}

Admin Service Endpoints (/admin)

Ban a User
POST http://localhost:8080/admin/banUserById/{id}

Unban a User
POST http://localhost:8080/admin/unbanUserById/{id}

Get All Reported Users
GET http://localhost:8080/admin/getReportedUser

Dismiss a Reported User (no action taken)
POST http://localhost:8080/admin/dismissReportedUsersById/{id}

Message Moderation Endpoints (/message)

Get All Reported Messages
GET http://localhost:8080/admin/getReportedMessage

Dismiss a Reported Message (mark as reviewed)
POST http://localhost:8080/admin/dismissReportById/{id}Listing

Message Service Endpoints (/message)

Send a Message
POST http://localhost:8080/message/sendMessage
Request Body (JSON):
{
"conversationId": 1,
"senderId": 1,
"receiverId": 2,
"content": "Hello, I'm interested in this item."
}

Get Messages Sent by a User
GET http://localhost:8080/message/sender/{senderId}

Get Conversation for a Listing
GET http://localhost:8080/message/item/{itemId}/conversation

Mark a Message as Read
PUT http://localhost:8080/message/{id}/read

Listing Endpoints (/listing)

Retrieve all listings from DB
GET http://localhost:8080/listing/getAll

Retrieve first four listings from DB (was going to be modified to retrieve the most recent four for use on the home page)
GET http://localhost:8080/listing/getFirstFour

Get listing by Listing ID
GET http://localhost:8080/listing/getByListingId/{listingId}

Create a new listing
POST http://localhost:8080/listing/createListing
Request Headers:
X-User-Id: 1
Request Body (JSON):
{
"name":"Beautiful Table",
"description":"Just a gorgeous solid wood table",
"quality":"Like New",
"image":"https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%2Fid%2FOIP.gDShese-cwD7Cdva07AuwQHaFj%3Fpid%3DApi&f=1&ipt=f37fab588f640e5b3e94fb8f9dc1fc830e0afe2a6e77f9209daa79389c8a683a&ipo=images",
"price":"500",
"categoryId":2
}

Get listings posted by a user from their User ID
GET http://localhost:8080/listing/getByUserId/{userId}

Update an existing listing
PATCH http://localhost:8080/listing/update/{listingId} Request Headers:
X-User-Id: 1
Request Body (JSON):
{
"name":"More Beautiful Table",
"description":"So Beautiful",
"quality":"Test2",
"image":"https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%2Fid%2FOIP.gDShese-cwD7Cdva07AuwQHaFj%3Fpid%3DApi&f=1&ipt=f37fab588f640e5b3e94fb8f9dc1fc830e0afe2a6e77f9209daa79389c8a683a&ipo=images",
"price":"501",
"categoryId":2
}

Delete a listing
DELETE http://localhost:8080/listing/delete/{listingId} Request Headers:
X-User-Id: 1

Mark listing as sold
PATCH http://localhost:8080/listing/sold/{listingId}
Request Headers:
X-User-Id: 1

Search listings by keyword
GET http://localhost:8080/listing/search/{keyword}

Search listings by category
GET http://localhost:8080/listing/category/{categoryId}

Category creation placeholder for testing
POST http://localhost:8080/listing/add
Request Body (JSON):
{
name: "Furniture"
}

Category Endpoints (/listing/categories)

Get all categories from category table
GET http://localhost:8080/listing/categories/getAll

Get category by category ID
GET http://localhost:8080/listing/categories/{categoryId}

Image Endpoints (/listing/images)

Upload an image
POST http://localhost:8080/listing/images/upload Request Body (JSON): {
"file":(filepath)
}

Retrieve an image
GET http://localhost:8080/listing/images/{filename:.+}

Delete an image
DELETE http://localhost:8080/listing/images/{filename:.+)

Authentication APIs (Login and Registration)

Register a user
POST http://localhost:8080/auth/register Request Body (JSON):
{
"firstName":"Johnny",
"lastName":"Appleseed",
"email":"ja@ul.ie",
"password":"hello"
}

Login as a user
POST http://localhost:8080/auth/login
Request Body (JSON):
{
"email":"ja@ul.ie",
"password":"hello"
}

Update user's details PUT http://localhost:8080/auth/profile Request Header:
Authorization: (token returned from user login)
Request Body (JSON):
{
"firstName": "Jeremy",
"lastName": "Alexander"
}

Update user's password
PUT http://localhost:8080/auth/password Request Header:
Authorization: (token returned from user login)
Request Body (JSON):
{
"currentPassword":"hello",
"newPassword":"goodbye"
}