Skip to content

MapleGraph/qb-crm-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QB CRM Service

Customer Relationship Management (CRM) service for QueueBuster. This service manages customer data including customer groups, customer information, and customer addresses.

Features

  • Customer Groups: Organize customers into logical groups with custom names and codes
  • Customer Management: Full CRUD operations for customer data with flexible attributes
  • Customer Addresses: Support for multiple billing and shipping addresses per customer
  • RESTful API: Clean REST API design with Swagger documentation

Prerequisites

  • Go 1.25.1 or later
  • PostgreSQL 15+
  • Redis (optional, for caching)

Quick Start

1. Clone and Setup

cd /path/to/qb-crm
cp .env.example .env
# Edit .env with your configuration

2. Install Dependencies

go mod tidy

3. Setup Database

# Create database
createdb qb_crm

# Run schema
psql -h localhost -U postgres -d qb_crm -f schema/schema.sql

4. Run the Service

# Development mode
make run

# Or with Docker
make docker-up

5. Access Swagger Documentation

Open http://localhost:8086/api/public/crm/swagger/index.html

Project Structure

qb-crm/
├── cmd/
│   └── main.go              # Application entry point
├── internal/
│   ├── config/              # Configuration management
│   ├── dto/                 # Data Transfer Objects
│   ├── helpers/             # Utility functions
│   ├── models/              # Database models
│   ├── repository/          # Data access layer
│   │   ├── postgres/        # PostgreSQL implementations
│   │   └── remote/          # Remote service clients
│   ├── services/            # Business logic
│   ├── transport/
│   │   └── http/
│   │       ├── handlers/    # HTTP handlers
│   │       └── routes/      # Route definitions
│   └── utils/               # Common utilities
├── docs/                    # Swagger documentation
├── schema/                  # Database schemas
├── deployment/              # Docker files
├── scripts/                 # Build scripts
├── go.mod
├── go.sum
├── Makefile
└── README.md

API Endpoints

Customer Groups

  • POST /api/public/crm/v1/customer-groups - Create a customer group
  • GET /api/public/crm/v1/customer-groups/:id - Get a customer group
  • GET /api/public/crm/v1/customer-groups/organization/:organization_id - List customer groups
  • PUT /api/public/crm/v1/customer-groups/:id - Update a customer group
  • DELETE /api/public/crm/v1/customer-groups/:id - Delete a customer group

Customers

  • POST /api/public/crm/v1/customers - Create a customer
  • GET /api/public/crm/v1/customers/:id - Get a customer
  • GET /api/public/crm/v1/customers/organization/:organization_id - List customers
  • PUT /api/public/crm/v1/customers/:id - Update a customer
  • DELETE /api/public/crm/v1/customers/:id - Delete a customer

Customer Addresses

  • POST /api/public/crm/v1/customers/:customer_id/addresses - Create an address
  • GET /api/public/crm/v1/customers/:customer_id/addresses - List customer addresses
  • GET /api/public/crm/v1/customers/:customer_id/addresses/:address_id - Get an address
  • PUT /api/public/crm/v1/customers/:customer_id/addresses/:address_id - Update an address
  • DELETE /api/public/crm/v1/customers/:customer_id/addresses/:address_id - Delete an address

Configuration

Configuration is managed via environment variables. See .env.example for available options.

Key configurations:

  • SERVER_PORT - HTTP server port (default: 8086)
  • DB_* - PostgreSQL connection settings
  • REDIS_* - Redis connection settings

Development

Generate Swagger Docs

make swagger

Run Tests

make test

Build for Production

make build-prod

License

Apache 2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors