diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index 015a1e1..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: CD Pipeline - -on: - push: - branches: [main] - tags: ["v*"] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - deploy-staging: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - environment: staging - - steps: - - uses: actions/checkout@v4 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=sha,prefix={{branch}}- - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Deploy to staging - run: | - echo "Deploying to staging environment..." - # Add your staging deployment commands here - # Example: kubectl apply -f k8s/staging/ or docker-compose up -d - - deploy-production: - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - environment: production - needs: [] - - steps: - - uses: actions/checkout@v4 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=tag - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Deploy to production - run: | - echo "Deploying to production environment..." - # Add your production deployment commands here - # Example: kubectl apply -f k8s/production/ or docker-compose up -d - - security-scan: - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - uses: actions/checkout@v4 - - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@0.24.0 - with: - image-ref: "fastapi-shop-app:latest" - format: "sarif" - output: "trivy-results.sarif" - - - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v3 - if: always() - with: - sarif_file: "trivy-results.sarif" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f9524c8..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: CI Pipeline - -on: - push: - branches: [main, develop] - pull_request: - branches: [main, develop] - -env: - PYTHON_VERSION: "3.12" - POETRY_VERSION: "1.6.1" - -jobs: - test: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:13-alpine - env: - POSTGRES_USER: testuser - POSTGRES_PASSWORD: testpassword - POSTGRES_DB: testdb - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - redis: - image: redis:6-alpine - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 6379:6379 - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Cache pip dependencies - uses: actions/cache@v4 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r backend/requirements.txt - pip install pytest pytest-asyncio pytest-cov httpx - - - name: Set environment variables - run: | - echo "DATABASE_URL=postgresql://testuser:testpassword@localhost:5432/testdb" >> $GITHUB_ENV - echo "JWT_SECRET_KEY=test-jwt-secret-key-for-ci" >> $GITHUB_ENV - echo "REDIS_HOST=localhost" >> $GITHUB_ENV - echo "REDIS_PORT=6379" >> $GITHUB_ENV - echo "REDIS_PASSWORD=" >> $GITHUB_ENV - echo "DEBUG=1" >> $GITHUB_ENV - echo "ENVIRONMENT=testing" >> $GITHUB_ENV - echo "LOG_LEVEL=INFO" >> $GITHUB_ENV - - - name: Run database migrations - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - run: | - cd ${{ github.workspace }} - python -m alembic upgrade head - - - name: Run linting with flake8 - run: | - pip install flake8 - flake8 backend/app --count --select=E9,F63,F7,F82 --show-source --statistics - flake8 backend/app --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - # - name: Run type checking with mypy - # run: | - # pip install mypy types-redis - # mypy backend/app --ignore-missing-imports --allow-untyped-defs --allow-untyped-calls --allow-incomplete-defs --allow-untyped-globals - - - name: Run tests with pytest - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - pytest tests/ -v --cov=backend/app --cov-report=xml --cov-report=html - - - name: Upload coverage reports - uses: codecov/codecov-action@v4 - with: - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - token: ${{ secrets.CODECOV_TOKEN }} - - - name: Security scan with bandit - run: | - pip install bandit - bandit -r backend/app -f json -o bandit-report.json || true - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-results - path: | - coverage.xml - htmlcov/ - bandit-report.json - - build: - runs-on: ubuntu-latest - needs: test - - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build Docker image - run: | - docker build -t fastapi-shop-app:${{ github.sha }} . - - - name: Test Docker image - run: | - docker run --rm fastapi-shop-app:${{ github.sha }} python -c "import backend.app.main; print('Docker build successful')" - - - name: Save Docker image - if: github.ref == 'refs/heads/main' - run: | - docker save fastapi-shop-app:${{ github.sha }} | gzip > fastapi-shop-app.tar.gz - - - name: Upload Docker image artifact - if: github.ref == 'refs/heads/main' - uses: actions/upload-artifact@v4 - with: - name: docker-image - path: fastapi-shop-app.tar.gz - retention-days: 1 diff --git a/.github/workflows/example-ci-cd.yml b/.github/workflows/example-ci-cd.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 6a13ba1..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,209 +0,0 @@ -name: Test Suite - -on: - pull_request: - branches: [main, develop] - -jobs: - test: - runs-on: ubuntu-latest - strategy: - name: Set up Python - uses: actions/setu - name: Run API tests - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - pytest tests/ -v with: - python-version: "3.13" matrix: - python-version: ["3.11", "3.12"] - - services: - postgres: - image: postgres:13-alpine - env: - POSTGRES_USER: testuser - POSTGRES_PASSWORD: testpassword - POSTGRES_DB: testdb - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - redis: - image: redis:6-alpine - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 6379:6379 - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r backend/requirements.txt - pip install pytest pytest-asyncio pytest-cov httpx - - - name: Set environment variables - run: | - echo "DATABASE_URL=postgresql://testuser:testpassword@localhost:5432/testdb" >> $GITHUB_ENV - echo "JWT_SECRET_KEY=test-jwt-secret-key-for-ci" >> $GITHUB_ENV - echo "REDIS_HOST=localhost" >> $GITHUB_ENV - echo "REDIS_PORT=6379" >> $GITHUB_ENV - echo "REDIS_PASSWORD=" >> $GITHUB_ENV - echo "DEBUG=1" >> $GITHUB_ENV - echo "ENVIRONMENT=testing" >> $GITHUB_ENV - echo "LOG_LEVEL=INFO" >> $GITHUB_ENV - - - name: Run database migrations - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - run: | - python -m alembic upgrade head - - - name: Run unit tests - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - pytest tests/ -v --cov=backend/app --cov-report=term-missing - - - name: Run integration tests - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - pytest tests/ -v --cov=backend/app --cov-report=term-missing - - api-tests: - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:13-alpine - env: - POSTGRES_USER: testuser - POSTGRES_PASSWORD: testpassword - POSTGRES_DB: testdb - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - redis: - image: redis:6-alpine - ports: - - 6379:6379 - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r backend/requirements.txt - pip install httpx pytest - - - name: Set environment variables - run: | - echo "DATABASE_URL=postgresql://testuser:testpassword@localhost:5432/testdb" >> $GITHUB_ENV - echo "JWT_SECRET_KEY=test-jwt-secret-key-for-ci" >> $GITHUB_ENV - echo "REDIS_HOST=localhost" >> $GITHUB_ENV - echo "REDIS_PORT=6379" >> $GITHUB_ENV - echo "REDIS_PASSWORD=" >> $GITHUB_ENV - echo "DEBUG=1" >> $GITHUB_ENV - echo "ENVIRONMENT=testing" >> $GITHUB_ENV - echo "LOG_LEVEL=INFO" >> $GITHUB_ENV - - - name: Run database migrations - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - run: python -m alembic upgrade head - - - name: Start FastAPI server - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - cd ${{ github.workspace }} - python -m uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 & - echo $! > server.pid - # Wait for server to be ready - for i in {1..30}; do - if curl -f http://localhost:8000/health 2>/dev/null; then - echo "Server is ready!" - break - fi - echo "Waiting for server... ($i/30)" - sleep 2 - done - - - name: Run API tests - env: - DATABASE_URL: postgresql://testuser:testpassword@localhost:5432/testdb - JWT_SECRET_KEY: test-jwt-secret-key-for-ci - REDIS_HOST: localhost - REDIS_PORT: 6379 - REDIS_PASSWORD: "" - DEBUG: 1 - ENVIRONMENT: testing - LOG_LEVEL: INFO - run: | - export PYTHONPATH="${{ github.workspace }}" - pytest tests/ -v - - - name: Stop FastAPI server - if: always() - run: | - if [ -f server.pid ]; then - kill $(cat server.pid) || true - rm server.pid - fi diff --git a/README.md b/README.md index ab1832f..91bce8a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ๐Ÿช N-Market - FastAPI Inventory Management System -[![FastAPI](https://img.shields.io/badge/FastAPI-0.109.0-009688.svg?style=flat&logo=FastAPI&logoColor=white)](https://fastapi.tiangolo.com) -[![Python](https://img.shields.io/badge/Python-3.13+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://python.org) +[![FastAPI](https://img.shields.io/badge/FastAPI-0.115.6-009688.svg?style=flat&logo=FastAPI&logoColor=white)](https://fastapi.tiangolo.com) +[![Python](https://img.shields.io/badge/Python-3.12+-3776AB.svg?style=flat&logo=python&logoColor=white)](https://python.org) [![PostgreSQL](https://img.shields.io/badge/PostgreSQL-13+-336791.svg?style=flat&logo=postgresql&logoColor=white)](https://postgresql.org) [![Redis](https://img.shields.io/badge/Redis-7.0+-DC382D.svg?style=flat&logo=redis&logoColor=white)](https://redis.io) [![Docker](https://img.shields.io/badge/Docker-Enabled-2496ED.svg?style=flat&logo=docker&logoColor=white)](https://docker.com) @@ -19,7 +19,7 @@ ## ๐Ÿš€ Features Overview -### ๐ŸŽจ **Professional Branding System** โญ๏ธ _NEW_ +### ๐ŸŽจ **Professional Branding System** - **Context-Aware Logo Layouts** - Different layouts for different use cases - ๐Ÿ“ง **Email Headers**: Centered 120px square logo with professional typography @@ -466,38 +466,6 @@ az containerapp create \ - API versioning strategy - Audit logging for sensitive operations -## ๐Ÿ“ˆ N-Market Roadmap - -### **Completed Features** โœ… - -- [x] **Professional Branding System** - Context-aware logo layouts -- [x] **Comprehensive Inventory Management** - Products, suppliers, orders -- [x] **Business Intelligence Dashboard** - Real-time analytics and insights -- [x] **Production-Ready Deployment** - Docker, CI/CD, monitoring -- [x] **Professional Documentation** - Complete API docs and guides - -### **Upcoming Features** ๐Ÿš€ - -- [ ] **Enhanced Mobile Experience** - Native mobile app with barcode scanning -- [ ] **Advanced Analytics** - Machine learning insights and demand forecasting -- [ ] **Multi-location Support** - Warehouse management with location tracking -- [ ] **Integration APIs** - Connect with accounting software (QuickBooks, Xero) -- [ ] **Automated Reordering** - Smart inventory replenishment -- [ ] **Customer Portal** - Self-service ordering and account management -- [ ] **Multi-tenant SaaS** - Support multiple businesses on one platform -- [ ] **Advanced Reporting** - Custom report builder with export options - -### **Brand Enhancement Roadmap** ๐ŸŽจ - -- [ ] **Dynamic Theming** - Customizable color schemes and branding -- [ ] **Logo Animation** - Animated logos for web and mobile -- [ ] **Print Templates** - Business cards, letterheads, marketing materials -- [ ] **Brand Guidelines** - Automated brand consistency checking - -## ๐Ÿค Contributing - -We welcome contributions to N-Market! Please see our [Contributing Guide](CONTRIBUTING.md) for details. - ### **Development Process** 1. Fork the repository @@ -506,33 +474,11 @@ We welcome contributions to N-Market! Please see our [Contributing Guide](CONTRI 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request -### **Contribution Areas** - -- ๐Ÿ› Bug fixes and improvements -- โœจ New features and enhancements (especially branding and UI/UX) -- ๐Ÿ“š Documentation improvements -- ๐Ÿงช Test coverage expansion -- ๐Ÿ”ง DevOps and deployment optimization -- ๐ŸŽจ Logo and branding enhancements - ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -## ๐Ÿ™ Acknowledgments - -- **FastAPI** team for the amazing framework -- **SQLAlchemy** team for the robust ORM -- **Pydantic** team for data validation -- **N-Market Community** for continuous feedback and support -- Open source community for continuous inspiration - --- - -**โญ Star this repository if N-Market helped you!** - -For questions, issues, or feature requests, please [open an issue](https://github.com/yourusername/n-market-inventory-system/issues). - ๐Ÿ“ง **Contact:** [modavari005@gmail.com](mailto:modavari005@gmail.com) ๐ŸŒ **Website:** [https://n-market.ir](https://n-market.ir) ๐Ÿ“ฑ **Logo Showcase:** [http://localhost:8000/logo-showcase](http://localhost:8000/logo-showcase) diff --git a/backend/requirements.txt b/backend/requirements.txt index cf8725a..2666bb5 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -9,8 +9,8 @@ passlib[bcrypt]==1.7.4 python-multipart==0.0.19 python-dotenv==1.0.1 redis==5.2.1 -reportlab==4.0.9 -pydantic[email]==2.11.0 +reportlab==4.2.2 +pydantic==2.11.0 aiofiles==24.1.0 jinja2==3.1.4 @@ -25,12 +25,12 @@ slowapi==0.1.9 prometheus-client==0.20.0 # Development Dependencies -pytest==8.0.0 +pytest==8.4.1 pytest-asyncio==0.23.5 -pytest-cov==4.1.0 +pytest-cov==5.0.0 pytest-mock==3.12.0 -httpx==0.26.0 -factory-boy==3.3.0 +httpx==0.28.1 +factory-boy==3.3.1 # Code Quality black==24.1.1 diff --git a/pyproject.toml b/pyproject.toml index c711758..3d4f79f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 120 -target-version = ['py311'] +target-version = ['py312'] include = '\.pyi?$' extend-exclude = ''' /( diff --git a/static/logo-implementation-showcase.html b/static/logo-implementation-showcase.html index 34fd50c..40b7726 100644 --- a/static/logo-implementation-showcase.html +++ b/static/logo-implementation-showcase.html @@ -344,168 +344,5 @@

N-Market

- - -
-
-
โœ… Implementation Summary
-
What has been updated in your system
-
-
-
-
-

- ๐Ÿ“ง Email Templates -

-

- Updated to use 120px centered square logo with improved - typography -

-
-
-

- ๐ŸŒ Website Headers -

-

- Created horizontal layout component for modern navigation -

-
-
-

- ๐Ÿ“ฑ Compact Layouts -

-

- Added small icon + text layout for mobile and compact spaces -

-
-
-

- ๐Ÿงพ Invoice Headers -

-

- Professional document header template with company information -

-
-
- -
-

- ๐ŸŽฏ Your Wide Logo Problem: SOLVED! -

-

- Instead of using a stretched wide logo, your system now uses - professional layout patterns that maintain brand quality. -

- -
-
- โœ… Better Quality
- No stretched or distorted logos -
-
- โœ… Professional Look
- Follows design best practices -
-
- โœ… Consistent Branding
- Same logo across all platforms -
-
- โœ… Responsive Design
- Works on all screen sizes -
-
-
-
-
-