Skip to content

This project is a back-end system designed for a pharmacy to streamline its business processes, including authentication, medication inventory management, and customer record management. The system enforces user roles and permissions for different actions to ensure security and efficiency.

Notifications You must be signed in to change notification settings

dmunasingha/pharmacy-project

Repository files navigation

Pharmacy Project

This project is a back-end system designed for a pharmacy to streamline its business processes, including authentication, medication inventory management, and customer record management. The system enforces user roles and permissions for different actions to ensure security and efficiency.

Libraries Used

Laravel Sanctum

  • Official Laravel package for API token authentication.
  • Documentation

Spatie Laravel Permission

  • Package for managing user permissions and roles in Laravel applications.
  • Documentation

Run Locally

Prerequisites

  • PHP ^8.1
  • Laravel 10
  • SQLite (3.39.2)
  • Postman (for testing)

Clone the project

  git clone https://github.com/dmunasingha/pharmacy-project

Go to the project directory

  cd pharmacy-project

Install PHP dependencies

  composer install

Copy the Enviroment File

  copy .env.example .env

Generate Application Key

  php artisan key:generate

Run Database Migrations (without dummy data)

  php artisan migrate

or

Run Database Migrations (with dummy data)

  php artisan migrate --seed

Start the development server

  php artisan serve

Includes

  • Project
  • ER Diagram (er.svg & er.mwb)
  • Postman Collection (Pharmacy Application. postman_collection.json)
  • Database Export (database/export.sql)

API Reference

Authentication

To access the API endpoints, you need to authenticate your requests using a bearer token. Follow these steps to obtain a bearer token:

Using Postman

When login a token will be received copy it and go to the authorization tab select the type as Bearer Token and paste the copied token in it (Individualy on each HTTP Requests or for the Collection)

Login

  POST /api/login
Parameter Type Description
email string Required.
password string Required.

Register User

  POST /api/register
Parameter Type Description
name string Required.
email string Required.
password string Required.
password_confirmation string Required.
role string Required.

Logout

  POST /api/logout

Get all roles

  GET /api/roles

Create Role

  POST /api/roles
Parameter Type Description
name string Required.

Get Role Details

  GET /api/roles/{id}

Update Role

  POST /api/roles/{id}
Parameter Type Description
name string Required.

Delete Role

  DELETE /api/roles/{id}

Assign Permission to Role

  POST /api/roles/permissions
Parameter Type Description
role string Required. Role Name
permission string Required. Permission Name

Get all medications

  GET /api/medications

Create medication

  POST /api/medications
Parameter Type Description
name string Required.
description string Required.
quantity string Required.

Get medication details

  GET /api/medications/{id}

Update medication

  POST /api/medications/{id}
Parameter Type Description
name string Required.
description string Required.
quantity string Required.

Soft Delete medication

  DELETE /api/medications/delete/{id}

Force Delete medication

  DELETE /api/medications/{id}

Get all customers

  GET /api/customers

Create customer

  POST /api/customers
Parameter Type Description
name string Required.
contact string Required.
email string Optional.
address string Required.

Get customer details

  GET /api/customers/{id}

Update customer

  POST /api/customers/{id}
Parameter Type Description
name string Required.
contact string Required.
email string Optional.
address string Required.

Soft Delete customer

  DELETE /api/customers/delete/{id}

Force Delete customer

  DELETE /api/customers/{id}

Get all users

  GET /api/users

Get user details

  GET /api/users/{id}

Delete user

  DELETE /api/users/delete/{id}

About

This project is a back-end system designed for a pharmacy to streamline its business processes, including authentication, medication inventory management, and customer record management. The system enforces user roles and permissions for different actions to ensure security and efficiency.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published