Skip to content

Latest commit

Β 

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

POS System

This project is a web sale point for managing sales and products.

This project is a RESTful API built with Spring Boot, providing a robust backend for.

Table of Contents

Features

  • Authentication and Authorization

    • Secure token-based system for user authentication and authorization
  • Sale Point Management

    • Create and manage sale points
    • Add and remove sale point members
    • Open, close, and manage sessions for each sale point
  • Product Management

    • Maintain a shared catalog of products across all sale points
    • Full CRUD (Create, Read, Update, Delete) operations for products
    • Set discounts and offers on products
    • Implement soft deletion for all objects, including products
  • Sales and Invoicing

    • Record sales with relation to specific sale points and sessions
    • Generate invoices for completed sales
    • Export invoices as PDF files for printing or digital distribution
  • Data Integrity

    • Maintain relationships between sales, sale points, and sessions
    • Ensure data consistency across all operations

Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.9.6 or higher
  • Postegresql

Installation

  1. Clone the repository
git clone
https://github.com/IsmailKattan/chashier_system.git
  1. Navigate to the project directory
cd chashier_system 
  1. Build the project
mvn clean install
```cmd

4. Run the application
```cmd
mvn spring-boot:run

The application will start running at http://localhost:8080.

Main User Credential

{
    "username" : "admin",
    "password" : "32-bit"
}

Project Structure

.
β”œβ”€β”€ .mvn/
β”‚   └── wrapper/
β”‚       β”œβ”€β”€ maven-wrapper.jar
β”‚       └── maven-wrapper.properties
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   └── com._32bit.porject.cashier_system/
β”‚   β”‚   β”‚       β”œβ”€β”€ DAO/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ InvoiceRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ OfferRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ PaymentRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ ProductRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ RoleRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleItemRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SalePointRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleRepository
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SessionRepository
β”‚   β”‚   β”‚       β”‚   └── TeamMemberRepository
β”‚   β”‚   β”‚       β”œβ”€β”€ domains/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ enums/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ Category
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ ERole
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ PaymentMethod
β”‚   β”‚   β”‚       β”‚   β”‚   └── Unit
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Invoice
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Offer
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Payment
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Product
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Role
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Sale
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleItem
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SalePoint
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ Session
β”‚   β”‚   β”‚       β”‚   └── TeamMember
β”‚   β”‚   β”‚       β”œβ”€β”€ DTO/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ invoice/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ InvoceEmailRequest
β”‚   β”‚   β”‚       β”‚   β”‚   └── InvoceInfoDto
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ offer/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ CreateOfferRequest
β”‚   β”‚   β”‚       β”‚   β”‚   └── OfferInfoResponse
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ payment/
β”‚   β”‚   β”‚       β”‚   β”‚   └── PaymentOfSaleDto
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ product/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ CreateProductRequest
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ ProductInfoResponse
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ UpdatePriceRequest
β”‚   β”‚   β”‚       β”‚   β”‚   └── UpdateQuantityrequest
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ sale/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ CreateSaleRequest
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SaleInfoResponse
β”‚   β”‚   β”‚       β”‚   β”‚   └── SaleSpecification
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ saleItem/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ ItemOfSaleDto
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SaleItemInfoResponseDto
β”‚   β”‚   β”‚       β”‚   β”‚   └── SaleItemInforesponseSerializer
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ salePoint/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ CreateSalePointRequest
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SalePointInfoResponse
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SessionOfSalePoint
β”‚   β”‚   β”‚       β”‚   β”‚   └── TeamMemberOfSalePoint
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ session/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SaleOfSession
β”‚   β”‚   β”‚       β”‚   β”‚   └── SessionInforesponse
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ teamMember/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ request/
β”‚   β”‚   β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ CreateTeamMemberDto
β”‚   β”‚   β”‚       β”‚   β”‚   β”‚   β”œβ”€β”€ LoginInfoDto
β”‚   β”‚   β”‚       β”‚   β”‚   β”‚   └── UpdatePasswordDto
β”‚   β”‚   β”‚       β”‚   β”‚   └── response/
β”‚   β”‚   β”‚       β”‚   β”‚       β”œβ”€β”€ JwtResponseDto
β”‚   β”‚   β”‚       β”‚   β”‚       └── TeamMemberInfoDto
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ MessageResponse
β”‚   β”‚   β”‚       β”‚   └── ObjectWithMessageResponse
β”‚   β”‚   β”‚       β”œβ”€β”€ mapper/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ InvoiceMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ OfferMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ PaymentMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ ProductMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleItemMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SalePointMapper
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SessionMapper
β”‚   β”‚   β”‚       β”‚   └── TeamMemberMapper
β”‚   β”‚   β”‚       β”œβ”€β”€ pdf/
β”‚   β”‚   β”‚       β”‚   └── PDFGenerator
β”‚   β”‚   β”‚       β”œβ”€β”€ resource/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ AuthenticationResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ HelloWorldResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ InvoiceResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ OfferResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ ProductResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SalePointResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleResource
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SessionResource
β”‚   β”‚   β”‚       β”‚   └── TeamMemberResource
β”‚   β”‚   β”‚       β”œβ”€β”€ security/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ jwt/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ AuthEntryPointJwt
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ AuthTokenFilter
β”‚   β”‚   β”‚       β”‚   β”‚   └── JwtUtils
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ UserDetailsImpl
β”‚   β”‚   β”‚       β”‚   β”‚   └── UserDetailsServiceImpl
β”‚   β”‚   β”‚       β”‚   └── SecurityConfig
β”‚   β”‚   β”‚       β”œβ”€β”€ service/
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ impl/
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ AuthServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ InvoiceServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ OfferServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ PaymentServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ ProductServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SaleItemServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SalePointServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SaleServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   β”œβ”€β”€ SessionServiceImpl
β”‚   β”‚   β”‚       β”‚   β”‚   └── TeamMemberServiceImpl
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ AuthService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ InvoiceService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ OfferService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ PaymentService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ ProductService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleItemService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SalePointService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SaleService
β”‚   β”‚   β”‚       β”‚   β”œβ”€β”€ SessionService
β”‚   β”‚   β”‚       β”‚   └── TeamMemberService
β”‚   β”‚   β”‚       └── CashierSystemApplication
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ application.properties
β”‚   β”‚       └── log4j2.xml
β”‚   └── test/
β”‚       β”œβ”€β”€ java/
β”‚       β”‚   └── com/
β”‚       β”‚       └── _32bit.project.cashier_system/
β”‚       β”‚           β”œβ”€β”€ tests/
β”‚       β”‚           β”‚   β”œβ”€β”€ sale
β”‚       β”‚           β”‚   β”œβ”€β”€ OfferServiceTest
β”‚       β”‚           β”‚   β”œβ”€β”€ ProductServiceTest
β”‚       β”‚           β”‚   β”œβ”€β”€ SalePointServiceTest
β”‚       β”‚           β”‚   └── SessionServiceTest
β”‚       β”‚           └── CashierSystemApplicationTests
β”‚       └── resources/
β”‚           └── application-test.properties
β”œβ”€β”€ .gitignore
β”œβ”€β”€ compose.yaml
β”œβ”€β”€ mvnw
β”œβ”€β”€ mvnw.cmd
β”œβ”€β”€ pom.xml
└── README.md

Endpoints

Test Security Endpoints

Method Endpoint Description Request Body
GET /api/admin only admin allowed endpoint (for testing security) -
GET /api/manager only manager allowed endpoint (for testing security) -
GET /api/cashier only cashier allowed endpoint (for testing security) -
GET /api/erisebilir permit all endpoint (for testing security) -
GET /api/erisilmez for authenticated users (for testing security) -

Login Endpoint

Method Endpoint Description Request Body
POST /login Endpoint for loging in Login Body

Sale Point Endpoints

Method Endpoint Description Request Body
POST /api/sale-point/create-point Endpoint for creating sale point Create sale point request body
GET /api/sale-point/point/{id} Get sale point by id -
PUT /api/sale-point/update-point Endpoint for updating sale point Create sale point request body
DELETE /api/sale-point/delete-point/{id} Delete sale point -
PATCH /api/sale-point/restore-point/{id} Restore sale point -
GET /api/sale-point/all-points Get all sale points -
GET /api/sale-point/all-deleted-points Get all deleted sale points -
GET /api/sale-point/deleted-point/{id} Get deleted sale point by id -
GET /api/sale-point/point-by-address/{address} Get sale point by address -
GET /api/sale-point/point-by-name/{name} Get sale point by name -
GET /api/sale-point/poin-sessins/{id} Get sale point sessions -
GET /api/sale-point/point-team-members/{id} Get sale point members -

Team Member Endpoints

Method Endpoint Description Request Body
POST /api/team-member/register Register a new team member Create Team Member request body
GET /api/team-member/id/{id} Get a team member by ID -
GET /api/team-member/username/{username} Get a team member by username -
GET /api/team-member/deleted/id/{id} Get a deleted team member by ID -
GET /api/team-member/deleted/username/{username} Get a deleted team member by username -
GET /api/team-member/all Get all non-deleted team members -
GET /api/team-member/all-deleted Get all deleted team members -
PUT /api/team-member/update/{id} Update a team member Create Team Member request body
DELETE /api/team-member/delete/{id} Delete a team member -
PUT /api/team-member/restore/{id} Restore a deleted team member -
PUT /api/team-member/update-authority/{id} Update a team member's authority List of strings
PUT /api/team-member/update-password/{id} Update a team member's password Update Password request body
PUT /api/team-member/update-sale-point/{id}/{salePointId} Update a team member's sale point -

Session Endpoints

Method Endpoint Description Request Body
GET /api/session/sessions Get all sessions -
GET /api/session/deleted-sessions Get all deleted sessions -
GET /api/session/sale-point-sessions/{id} Get sessions for a specific sale point -
POST /api/session/open-session/{salePointId} Open a new session for a sale point -
POST /api/session/close-session/{salePointId} Close the current session for a sale point -
GET /api/session/{sessionId} Get information about a specific session -
GET /api/session/delete-session/{sessionId} Delete a specific session -
GET /api/session/restore-session/{sessionId} Restore a deleted session -
GET /api/session/sale-point-open-session/{id} Get the open session for a specific sale point -

Offer Endpoints

Method Endpoint Description Request Body
GET /api/offer/all Get all non-deleted offers -
GET /api/offer/all-deleted Get all deleted offers -
GET /api/offer/by-name/{name} Get non-deleted offers by name -
GET /api/offer/deleted-by-name/{name} Get deleted offers by name -
GET /api/offer/by-description/{description} Get non-deleted offers by description -
GET /api/offer/deleted-by-description/{description} Get deleted offers by description -
POST /api/offer/by-start-date Get non-deleted offers by date range Query params: startDate, endDate
POST /api/offer/deleted-by-start-date Get deleted offers by date range Query params: startDate, endDate
POST /api/offer/create-offer Create a new offer Create Offer request body
PUT /api/offer/update-offer/{id} Update an existing offer Create Offer request body
DELETE /api/offer/delete-offer/{id} Delete an offer -
PATCH /api/offer/restore-offer/{id} Restore a deleted offer -
GET /api/offer/by-id/{id} Get a non-deleted offer by ID -
GET /api/offer/deleted-by-id/{id} Get a deleted offer by ID -

Product Endpoints

Method Endpoint Description Request Body
GET /api/product/all Get all non-deleted products -
GET /api/product/all-deleted Get all deleted products -
GET /api/product/by-name/{name} Get non-deleted products by name -
GET /api/product/by-brand/{brand} Get non-deleted products by brand -
GET /api/product/by-category/{category} Get non-deleted products by category -
GET /api/product/deleted-by-name/{name} Get deleted products by name -
GET /api/product/deleted-by-brand/{brand} Get deleted products by brand -
GET /api/product/deleted-by-category/{category} Get deleted products by category -
GET /api/product/by-id/{id} Get a non-deleted product by ID -
GET /api/product/deleted-by-id/{id} Get a deleted product by ID -
POST /api/product/create Create a new product Create Product request body
PUT /api/product/update/{id} Update an existing product Create Product request body
DELETE /api/product/delete/{id} Delete a product -
POST /api/product/restore/{id} Restore a deleted product -
POST /api/product/set-discount/{id}/{discountRate} Set a discount for a product -
DELETE /api/product/remove-discount/{id} Remove a discount from a product -
POST /api/product/set-offer/{productId}/{offerId} Set an offer for a product -
DELETE /api/product/remove-offer/{productId} Remove an offer from a product -
POST /api/product/update-quantities Update quantities for multiple products List of Update Quantity requests
POST /api/product/update-add-quantities Add quantities for multiple products List of Update Quantity requests
POST /api/product/create-products Create multiple products List of Create Products request
POST /api/product/update-prices Update prices for multiple products List of Update Prices request
GET /api/product/price/{id} Get the price of a product by ID -

Sale Endpoints

Method Endpoint Description Request Body
GET /api/sale/sales Get all non-deleted sales -
GET /api/sale/deleted-sales Get all deleted sales -
GET /api/sale/sale/{id} Get a non-deleted sale by ID -
GET /api/sale/deleted-sale/{id} Get a deleted sale by ID -
GET /api/sale/sale-point-sales/{id} Get sales for a specific sale point -
GET /api/sale/session-sales/{id} Get sales for a specific session -
POST /api/sale/create-sale Create a new sale Create Sale request body
POST /api/sale/payment/{saleId} Process payment for a sale List of Payment of Sale DTOs
POST /api/sale/invoice/{saleId} Generate invoice for a sale -
PUT /api/sale/update-sale/{id} Update an existing sale Create Sale request body
DELETE /api/sale/delete-sale/{id} Delete a sale -
PUT /api/sale/restore-sale/{id} Restore a deleted sale -
GET /api/sale/paged-sales Get paginated sales with filters Query parameters
GET /api/sale/paged-session-sales/{sessionId} Get paginated sales for a session with filters Query parameters
GET /api/sale/paged-sale-point-sales/{salePointId} Get paginated sales for a sale point with filters Query parameters

Invoice Endpoints

Method Endpoint Description Request Body
GET /api/invoice/invoices Get all invoices -
GET /api/invoice/invoice/{id} Get an invoice by ID -
GET /api/invoice/sale-invoice/{saleId} Get an invoice by sale ID -
GET /api/invoice/sale-point-invoices/{salePointId} Get invoices for a specific sale point -
GET /api/invoice/team-member-invoices/{teamMemberId} Get invoices for a specific team member -
GET /api/invoice/generate-invoice/{invoiceId} Generate an invoice PDF -

Request Bodies

Login Body

{
    "username" : "admin",
    "password" : "32-bit"
}

Create Sale Point Reques Body

{
    "name" : "istanbul",
    "address" : "fatih"
}

Create Team Member Request Body

{
    "firstname" : "ismail",
    "lastname" : "kattan",
    "username" : "smlkttn_cashier",
    "email" : "smlkttn855@gmail.com",
    "phoneNumber" : "05314326135",
    "password" : "32-bit",
    "roles" : ["cashier"],
    "salePointId" : 2
}

Update Password Request Body

{
    "password" : "32-bit"
}

Create Offer Request Body

{
    "name" : "3 al 2 ode",
    "description" : "2 alana 1 bedava",
    "startDate" : "01-01-2025",
    "endDate" : "01-01-2026",
    "getCount" : 3,
    "payFor" : 2
}

Create Product Request Body

{
    "name" : "telefon",
    "brand"  : "samsung",
    "category" : "ELeCTRONIC",
    "quantity" : "100",
    "unit" : "adet",
    "price" : 4000
}

Create Products Request Body

[
    {
        "name" : "telefon",
        "brand"  : "samsung",
        "category" : "ELeCTRONIC",
        "quantity" : "100",
        "unit" : "adet",
        "price" : 4000
    },
    {
        "name" : "kulaklik",
        "brand"  : "polo-smart",
        "category" : "ELECTRONIC",
        "quantity" : "1000",
        "unit" : "adet",
        "price" : 25.0
    }
]

Update Quantity Request Body

[
    {
        "id" : 1,
        "quantity" : 15
    },
    {
        "id" : 2,
        "quantity" : 15
    }
]

Update Prices Request Body

[
    {
        "id" : 1,
        "price" : 15
    },
    {
        "id" : 2,
        "price" : 15
    }
]

Create Sale Request Body

{
    "salePointId" : 1,
    "items" : [
        {
            "productId" : 1,
            "quantity" : 5
        },
        {
            "productId" : 2,
            "quantity" : 5
        }
    ]
}

Author

Ismail KATTAN

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages