TC purchase orders (CRUD APP)

Welcome to the purchase orders CRUD application! This project is built from scratch with a focus on clean code and efficient functionality. This README will guide you through the project structure, key components, and setup instructions.

Note: This project is a proof of concept, created with the primary purpose of providing a deep dive into the code base. It aims to illustrate how components are connected to each other in a basic and simple project. Please note that this project may not be ready for production use and is intended for POC purposes.

Table of Contents

  1. Introduction
  2. Key Components
  3. Tests
  4. Setup Instructions

Introduction

This application serves purchase orders, allowing users to show/create/update and delete purchase orders. The project emphasizes a clean and well-organized codebase to ensure maintainability and extensibility.

MySQL: The application uses MySQL as the database and using LARAVEL ORM to storing and managing data.

Key Components

Models

  • PurchaseOrder
  • PurchaseOrderItem
  • Category

Controllers

The PurchaseOrderController is the primary controller responsible for handling the purchase orders requests. This controller ensures that the CRUD process is streamlined and encapsulates the business logic.

File: ShortUrlController.php

Factories

I have utilized Laravel's factory feature to streamline the process of generating dummy data for testing purposes, enhancing the efficiency of our development workflow.

Request Classes

I have employed Laravel's Request class to validate both create and update requests, ensuring data integrity and consistency.

Resources

I have utilized Laravel resources to define the structure of the response body that the API consumer will receive.

Tests

The application includes tests to maintain code quality and ensure the reliability of the URL shortening functionality.

Unit Tests

Unit tests focus on individual components of services to validate their behavior in isolation. You can run unit tests using the following command:

php artisan test

Setup Instructions

To set up the application on your local environment, follow these instructions:

Clone the repository:

git clone https://github.com/abanoubsamaan/tc-back.git

Navigate to the project directory:

cd tc-back

Install dependencies using Composer:

composer install

Copy the .env.example file to .env and configure your MongoDB connection details:

cp .env.example .env

Generate an application key:

php artisan key:generate

Generate an application key:

php artisan key:generate

Run the migrations:

php artisan migrate

Run the database seeders:

php artisan db:seed

Start the Laravel development server:

php artisan serve

Visit http://localhost:8000 in your browser to access the Laravel URL Shortener.