This repository contains the backend code for a Lost and Found Service, built with Java Spring Boot and MongoDB. The service provides a REST API to manage the creation, updating, searching, and deletion of lost and found items.
- Add Found Items: Users can report found items with similar details.
- Search & Filter: Users can search items based on categories, keywords, and location.
- Search for offices: Users can search for offices based on location.
- Update & Delete: Allows authorized updates and deletion of items or offices for users with admin permissions.
- Ask questions: Users can ask questions and expect staff to answer them.
- Database Persistence: Stores data persistently using MongoDB.
- Java 11 or higher
- Spring Boot (2.x or 3.x)
- Spring Data MongoDB
- Spring Web
- MongoDB
- Maven for dependency management
- Java Development Kit (JDK) 11 or higher
- MongoDB installed and running
- Maven 3.6+ for dependency management
git clone https://github.com/wlabedz/bweng24.git
mvn clean install
Ensure MongoDB is installed and configure the application.properties file as explained below.
Open src/main/resources/application.properties and configure the MongoDB connection details:
# MongoDB settings
spring.data.mongodb.uri=mongodb+srv://<username>:<password>@cluster.2wv7i.mongodb.net/
Start the Spring Boot application:
mvn spring-boot:run
The application will start at http://localhost:8080.
The Lost and Found Service uses JWT for stateless authentication and Spring Security for securing API endpoints.
- AuthController
- CustomUserDetailsService
- JWTAuthenticationFilter
- JWTGenerator
- SecurityConfig
Our project includes unit and integration tests to ensure the reliability and correctness of the application.
- to validate the functionality of individual components, such as services and controllers
- are divided into two directories:
- controllerTests - provide tests regarding controllers, consists of 9 separate test files, each concentrated on different controller
- serviceTests - provide tests regarding services, consists of 10 separate test files, each concentrated on different service
- to test the interaction between components
- are divided into two files:
- FaqControllerIntegrationTest
- UserControllerIntegrationTest