Automated Action 4dc182713c Implement Small Business Inventory Management System
- Created project structure with FastAPI framework
- Set up SQLite database with SQLAlchemy ORM
- Implemented models: User, Item, Supplier, Transaction
- Created CRUD operations for all models
- Added API endpoints for all resources
- Implemented JWT authentication and authorization
- Added Alembic migration scripts
- Created health endpoint
- Updated documentation

generated with BackendIM... (backend.im)
2025-05-13 09:48:37 +00:00

98 lines
3.4 KiB
Markdown

# Small Business Inventory Management System
A FastAPI application for managing inventory for small businesses.
## Features
- **User Authentication**: Secure user authentication with JWT tokens
- **Inventory Management**: Track inventory items with details like SKU, quantity, price, and location
- **Supplier Management**: Manage supplier information and relationships with inventory items
- **Transaction Tracking**: Record and monitor inventory transactions (purchases, sales, adjustments, returns)
- **API Documentation**: Interactive API documentation using FastAPI's built-in Swagger UI
## Tech Stack
- **Backend**: Python 3.7+ with FastAPI
- **Database**: SQLite with SQLAlchemy ORM
- **Authentication**: JWT token-based authentication
- **Migration**: Alembic for database migrations
## Project Structure
```
.
├── alembic/ # Database migration scripts
├── app/ # Main application code
│ ├── api/ # API endpoints
│ ├── core/ # Core functionality (config, security)
│ ├── crud/ # CRUD operations
│ ├── db/ # Database session and connection
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas/models
├── storage/ # Data storage
│ └── db/ # SQLite database files
├── main.py # Application entry point
├── alembic.ini # Alembic configuration
└── requirements.txt # Project dependencies
```
## Installation and Setup
1. Clone the repository
2. Install dependencies:
```
pip install -r requirements.txt
```
3. Apply migrations:
```
alembic upgrade head
```
4. Run the application:
```
uvicorn main:app --reload
```
## API Documentation
Once the application is running, you can access:
- Swagger UI documentation: http://localhost:8000/docs
- ReDoc documentation: http://localhost:8000/redoc
## API Endpoints
### Authentication
- `POST /api/v1/login/access-token` - Get JWT access token
- `POST /api/v1/login/test-token` - Test token validity
### Users
- `GET /api/v1/users/` - List users (admin only)
- `POST /api/v1/users/` - Create new user (admin only)
- `GET /api/v1/users/me` - Get current user info
- `PUT /api/v1/users/me` - Update current user info
- `GET /api/v1/users/{user_id}` - Get user by ID
- `PUT /api/v1/users/{user_id}` - Update user (admin only)
### Items
- `GET /api/v1/items/` - List inventory items (with optional filtering)
- `POST /api/v1/items/` - Add new inventory item
- `GET /api/v1/items/{id}` - Get item by ID
- `PUT /api/v1/items/{id}` - Update item
- `DELETE /api/v1/items/{id}` - Delete item (admin only)
### Suppliers
- `GET /api/v1/suppliers/` - List suppliers
- `POST /api/v1/suppliers/` - Add new supplier
- `GET /api/v1/suppliers/{id}` - Get supplier by ID
- `PUT /api/v1/suppliers/{id}` - Update supplier
- `DELETE /api/v1/suppliers/{id}` - Delete supplier (admin only)
### Transactions
- `GET /api/v1/transactions/` - List transactions (with optional filtering)
- `POST /api/v1/transactions/` - Record new transaction
- `GET /api/v1/transactions/{id}` - Get transaction by ID
- `PUT /api/v1/transactions/{id}` - Update transaction (admin only)
- `DELETE /api/v1/transactions/{id}` - Delete transaction (admin only)
## Health Check
- `GET /health` - Application health check endpoint