Skip to content

Auctions.ba - done for university courses of Human-Computer Interaction and Software Engineering

Notifications You must be signed in to change notification settings

AjdiNNN/auctions-ba

Repository files navigation

CEN 308 - Software Enginerring: Configuration Management, Deployment and Versioning

This is a demo project made for the purposes of demonstrating deployment, CI/CD and versioning for the CEN 308 course.

In this release, the following features are available:

VPS deploy of WEBSITE

REST API routes also available on OPENAPI documentation page
	1. GET /users
	2. GET /users/{id}
	3. POST /users
	4. PUT /users/{id}
	5. DELETE /users/{id}
	6. GET /items
	7. GET /items/{id}
	8. POST /items
	9. PUT /items/{id}
	10. DELETE /items/{id}
	11. GET /bids/{id}
	12. POST /bids
	13. PUT /bids/{id}
	14. DELETE /bids/{id}
	15. POST /login
	16. POST /register
	17. GET /user
Authorization done by JWT token authorization

PHPUnit tests

testRegisterUserEmail: This test verifies the registration process by attempting to register a user with an already registered email address. It expects a response with a status code of 500 and the message "Email already registered."

testRegisterUserUserName: This test checks the registration process by attempting to register a user with an already taken username. It expects a response with a status code of 500 and the message "Username already registered."

testLoginUser: This test validates the login functionality by attempting to log in with an email address that does not exist in the system. It expects a response with a status code of 404 and the message "User doesn't exist."

testLoginWrongPasswordUser: This test ensures that the login process rejects incorrect passwords by attempting to log in with a valid email address but an incorrect password. It expects a response with a status code of 404 and the message "Wrong password."

testLoginTrueUser: This test verifies the successful login process by attempting to log in with a valid email address and password. It expects a response with a status code of 200 and a token in the response data.

Coding Standards

  • JavaScript Style Guide
  • PSR-12

Design patterns used

  1. Singleton Pattern: The Config class in index.php is implemented as a Singleton pattern. It ensures that only one instance of the Config class is created and provides a global point of access to the configuration settings throughout the project.

  2. Factory Method Pattern: The Flight class in index.php acts as a Factory Method pattern. It creates instances of various classes such as UserService, ItemService, BidService, and UserDao, which are used throughout the application.

  3. Dependency Injection: The Flight class in index.php demonstrates the use of Dependency Injection by creating instances of services and injecting them into routes. For example, UserService, ItemService, and BidService instances are injected into various routes to handle user-related, item-related, and bid-related functionality, respectively.

  4. Data Access Object (DAO) Pattern: The UserDao class in dao.php represents the Data Access Object pattern. It provides methods for interacting with the underlying database and encapsulates the database operations related to the users table.

  5. Service Layer Pattern: The UserService, ItemService, and BidService classes in services.php act as service classes, implementing the Service Layer pattern. They provide higher-level, domain-specific functionality and encapsulate the business logic for user-related, item-related, and bid-related operations, respectively.

  6. Builder Pattern: The Flight::json() method used in various routes, such as POST /register, POST /login, POST /item, DELETE /item/{id}, etc., can be considered as an implementation of the Builder pattern. It constructs and returns JSON responses using a fluent interface, allowing flexibility in building the response object.

  7. Front Controller Pattern: The index.php file serves as the entry point and acts as a Front Controller for the application. It receives all requests, initializes the necessary components, handles routing, and dispatches requests to appropriate routes.

Architectural patterns used

Model-View-Controller (MVC): The project follows the MVC pattern, where the routes defined in index.php act as the controllers, handling the requests and invoking appropriate services and DAOs. The services and DAOs represent the model layer, responsible for business logic and data access, respectively. The responses from the controllers are sent to the client as views.

Dependency Injection (DI): The project utilizes DI to inject dependencies into various components. For example, the Flight framework is used for routing, and dependencies like the user DAO and JWT configuration are injected into the controllers and services. This promotes loose coupling and improves testability and maintainability.

Data Access Object (DAO): The DAO pattern is employed to separate the data access logic from the rest of the application. The UserDao class provides methods to interact with the underlying database for user-related operations.

Repository: Although not explicitly defined in the provided code, the DAO classes can be considered as a form of repository pattern. They encapsulate the data access logic, providing a clean interface to interact with the data source.

RESTful API: The project follows the principles of REST (Representational State Transfer) to design the API endpoints. It uses HTTP methods (POST, GET) to perform CRUD (Create, Read, Update, Delete) operations on user data. The endpoints are structured in a resource-oriented manner, providing a stateless interface to access and manipulate user-related information.


Ajdin Hukić, Amina Kodžaga

Course Software Engineering

2023 © International Burch University