update worker
This commit is contained in:
No files matched your search
+34
-6
@@ -1,6 +1,7 @@
|
||||
# 📚 GoPrint Service General - Project Documentation
|
||||
|
||||
## 📋 Deskripsi Proyek
|
||||
|
||||
Service-General adalah microservice berbasis Go yang menyediakan REST API dan gRPC untuk manajemen data person/pasien dengan integrasi ke sistem kesehatan Indonesia (BPJS & SatuSehat).
|
||||
|
||||
## 🏗️ Technical Architecture
|
||||
@@ -13,7 +14,9 @@ Project ini mengimplementasikan **Clean Architecture** dengan **Domain-Driven De
|
||||
- **Infrastructure Layer**: Database, Cache, External services
|
||||
|
||||
### Multi-Database Support
|
||||
|
||||
Mendukung 5 jenis database sekaligus dengan connection pooling dan read replicas:
|
||||
|
||||
- PostgreSQL (Primary)
|
||||
- MySQL
|
||||
- SQL Server
|
||||
@@ -21,6 +24,7 @@ Mendukung 5 jenis database sekaligus dengan connection pooling dan read replicas
|
||||
- SQLite
|
||||
|
||||
## 📁 Project Structure
|
||||
|
||||
```text
|
||||
service-general/
|
||||
├── cmd/api/main.go # Entry point aplikasi
|
||||
@@ -50,6 +54,7 @@ service-general/
|
||||
## 📦 Dependencies
|
||||
|
||||
### Core Dependencies
|
||||
|
||||
```
|
||||
github.com/gin-gonic/gin v1.10.1 # REST API Framework
|
||||
github.com/google/uuid v1.6.0 # UUID Generator
|
||||
@@ -59,6 +64,7 @@ gorm.io/driver/postgres v1.5.11 # PostgreSQL Driver
|
||||
```
|
||||
|
||||
### Database Drivers
|
||||
|
||||
```
|
||||
gorm.io/driver/mysql v1.6.0 # MySQL Driver
|
||||
gorm.io/driver/sqlite v1.6.0 # SQLite Driver
|
||||
@@ -68,6 +74,7 @@ github.com/jmoiron/sqlx v1.4.0 # SQL Extensions
|
||||
```
|
||||
|
||||
### Utilities
|
||||
|
||||
```
|
||||
github.com/go-playground/validator/v10 v10.27.0 # Input Validation
|
||||
github.com/golang/protobuf v1.5.4 # Protocol Buffers
|
||||
@@ -79,10 +86,12 @@ google.golang.org/grpc v1.78.0 # gRPC Framework
|
||||
## 🔗 API Endpoints
|
||||
|
||||
### REST API Base
|
||||
|
||||
- **Base URL**: `http://localhost:8080/api/v1`
|
||||
- **Swagger UI**: `http://localhost:8080/swagger/index.html`
|
||||
|
||||
### Person Endpoints
|
||||
|
||||
- `GET /persons` - List persons with pagination
|
||||
- `GET /persons/:id` - Get person detail
|
||||
- `POST /persons` - Create new person
|
||||
@@ -91,6 +100,7 @@ google.golang.org/grpc v1.78.0 # gRPC Framework
|
||||
- `GET /persons/search` - Search with filters
|
||||
|
||||
### gRPC Services
|
||||
|
||||
- **Port**: 50051 (default)
|
||||
- **Reflection**: Enabled untuk development
|
||||
- **Proto Files**: Tersedia di `docs/api/`
|
||||
@@ -98,6 +108,7 @@ google.golang.org/grpc v1.78.0 # gRPC Framework
|
||||
## ⚙️ Environment Configuration
|
||||
|
||||
### Configuration in config.yaml
|
||||
|
||||
```yaml
|
||||
server:
|
||||
port: 8080
|
||||
@@ -122,6 +133,7 @@ databases:
|
||||
## 🗄️ Database Schema Overview
|
||||
|
||||
### Person Entity (Core)
|
||||
|
||||
```go
|
||||
type Person struct {
|
||||
Id int64 // Primary key
|
||||
@@ -138,6 +150,7 @@ type Person struct {
|
||||
```
|
||||
|
||||
### Related Entities
|
||||
|
||||
- **PersonAddress**: Multiple addresses per person
|
||||
- **PersonContact**: Contact information (email, phone)
|
||||
- **PersonInsurance**: Insurance company data
|
||||
@@ -146,6 +159,7 @@ type Person struct {
|
||||
## 📋 Business Rules & Validation
|
||||
|
||||
### Person Validation Rules
|
||||
|
||||
```go
|
||||
Name string `json:"name" binding:"required,min=2"`
|
||||
BirthRegency_Code string `json:"birth_regency_code" validate:"omitempty,len=6"`
|
||||
@@ -155,6 +169,7 @@ Village_Code string `json:"village_code" validate:"required,len=10
|
||||
```
|
||||
|
||||
### Key Validation Rules:
|
||||
|
||||
- **Name**: Required, minimum 2 characters
|
||||
- **NIK**: 16 digits (optional)
|
||||
- **Gender**: L/P only (Laki-laki/Perempuan)
|
||||
@@ -165,6 +180,7 @@ Village_Code string `json:"village_code" validate:"required,len=10
|
||||
## 🔗 Integration Points
|
||||
|
||||
### BPJS Integration
|
||||
|
||||
```yaml
|
||||
bpjs:
|
||||
base_url: https://apijkn.bpjs-kesehatan.go.id
|
||||
@@ -175,6 +191,7 @@ bpjs:
|
||||
```
|
||||
|
||||
### SatuSehat Integration
|
||||
|
||||
```yaml
|
||||
satu_sehat:
|
||||
org_id: your_orgid
|
||||
@@ -188,6 +205,7 @@ satu_sehat:
|
||||
## 🛠️ Development Commands
|
||||
|
||||
### Setup & Run
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
go mod download
|
||||
@@ -199,6 +217,7 @@ go run cmd/api/main.go
|
||||
```
|
||||
|
||||
### Build & Test
|
||||
|
||||
```bash
|
||||
# Build binary
|
||||
make build
|
||||
@@ -218,6 +237,7 @@ go test ./...
|
||||
```
|
||||
|
||||
## 🔐 Security Features
|
||||
|
||||
- JWT Authentication dengan multiple providers
|
||||
- Rate limiting dengan Redis
|
||||
- CORS protection
|
||||
@@ -226,6 +246,7 @@ go test ./...
|
||||
- Audit trail untuk semua perubahan data
|
||||
|
||||
## 📊 Performance Features
|
||||
|
||||
- Connection pooling untuk database
|
||||
- Query optimization dengan index
|
||||
- Caching strategy (Redis)
|
||||
@@ -233,12 +254,14 @@ go test ./...
|
||||
- Soft delete untuk data retention
|
||||
|
||||
## 🧪 Testing Strategy
|
||||
|
||||
- Unit testing untuk business logic
|
||||
- Integration testing untuk API
|
||||
- External service mocking
|
||||
- Load testing capabilities
|
||||
|
||||
## 🚀 Deployment Options
|
||||
|
||||
- Docker support (dev & prod)
|
||||
- Environment-based configuration
|
||||
- Health checks & monitoring
|
||||
@@ -246,6 +269,7 @@ go test ./...
|
||||
- Multi-stage build
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
- Swagger/OpenAPI documentation
|
||||
- gRPC service definitions
|
||||
- Code comments & examples
|
||||
@@ -253,6 +277,7 @@ go test ./...
|
||||
- Architecture diagrams
|
||||
|
||||
## 🔮 Future Enhancements
|
||||
|
||||
- Event sourcing untuk audit trail
|
||||
- CQRS implementation
|
||||
- Multi-tenant support
|
||||
@@ -265,7 +290,8 @@ go test ./...
|
||||
**Version**: 1.0.0
|
||||
**Go Version**: $(go version | cut -d' ' -f3)
|
||||
**Last Updated**: $(date +%Y-%m-%d)
|
||||
```
|
||||
|
||||
````
|
||||
|
||||
Sekarang saya juga akan update script context.sh untuk membuatnya lebih lengkap:
|
||||
|
||||
@@ -332,11 +358,11 @@ generate_dependencies() {
|
||||
echo "## 📦 Dependencies"
|
||||
echo "### Core Dependencies"
|
||||
grep -E '^[[:space:]]*github.com/' "$PROJECT_DIR/go.mod" | head -10
|
||||
|
||||
|
||||
echo ""
|
||||
echo "### Database Drivers"
|
||||
grep -E 'postgres|mysql|mongo|sqlite|sqlserver' "$PROJECT_DIR/go.mod"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "### Security & Validation"
|
||||
grep -E 'validator|crypto|jwt|auth' "$PROJECT_DIR/go.mod"
|
||||
@@ -548,7 +574,7 @@ generate_complete_context() {
|
||||
generate_testing_strategy >> "$OUTPUT_FILE"
|
||||
echo "" >> "$OUTPUT_FILE"
|
||||
generate_deployment_info >> "$OUTPUT_FILE"
|
||||
|
||||
|
||||
# Tambahkan closing section
|
||||
cat >> "$OUTPUT_FILE" << EOF
|
||||
|
||||
@@ -600,7 +626,7 @@ EOF
|
||||
# Main execution
|
||||
main() {
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
|
||||
case "${1:-}" in
|
||||
--help|-h)
|
||||
echo "Usage: $0 [options]"
|
||||
@@ -644,4 +670,6 @@ main() {
|
||||
# Run main function
|
||||
main "$@"
|
||||
echo "✨ Context generation completed!"
|
||||
```
|
||||
````
|
||||
|
||||
docker cp worker-satusehat-prod:app/internal/worker/satusehat/medicationrequest/mapperdata/2026-05/ ~/goprint/worker-satusehat
|
||||
Reference in New Issue
Block a user