backend changes
This commit is contained in:
parent
0d3663f62d
commit
c88b3989fc
@ -40,349 +40,6 @@ services:
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
# mongodb:
|
||||
# image: mongo:7
|
||||
# container_name: pipeline_mongodb
|
||||
# environment:
|
||||
# MONGO_INITDB_ROOT_USERNAME: pipeline_user
|
||||
# MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
|
||||
# volumes:
|
||||
# - mongodb_data:/data/db
|
||||
# ports:
|
||||
# - "27017:27017"
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
|
||||
# rabbitmq:
|
||||
# build:
|
||||
# context: ./infrastructure/rabbitmq
|
||||
# dockerfile: Dockerfile
|
||||
# image: automated-dev-pipeline-rabbitmq
|
||||
# container_name: pipeline_rabbitmq
|
||||
# environment:
|
||||
# RABBITMQ_DEFAULT_USER: pipeline_admin
|
||||
# RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
|
||||
# volumes:
|
||||
# - rabbitmq_data:/var/lib/rabbitmq
|
||||
# - rabbitmq_logs:/var/log/rabbitmq
|
||||
# ports:
|
||||
# - "5672:5672"
|
||||
# - "15672:15672"
|
||||
# - "15692:15692"
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# healthcheck:
|
||||
# test: ["CMD", "rabbitmq-diagnostics", "ping"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
# start_period: 60s
|
||||
|
||||
# # =====================================
|
||||
# # Application Services
|
||||
# # =====================================
|
||||
|
||||
# api-gateway:
|
||||
# build: ./services/api-gateway
|
||||
# container_name: pipeline_api_gateway
|
||||
# ports:
|
||||
# - "8000:8000"
|
||||
# environment:
|
||||
# - NODE_ENV=development
|
||||
# - PORT=8000
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# - REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - RABBITMQ_HOST=rabbitmq
|
||||
# - RABBITMQ_PORT=5672
|
||||
# - RABBITMQ_USER=pipeline_admin
|
||||
# - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
# rabbitmq:
|
||||
# condition: service_healthy
|
||||
|
||||
# requirement-processor:
|
||||
# build: ./services/requirement-processor
|
||||
# container_name: pipeline_requirement_processor
|
||||
# ports:
|
||||
# - "8001:8001"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# - REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
# - MONGODB_HOST=mongodb
|
||||
# - MONGODB_PORT=27017
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
# mongodb:
|
||||
# condition: service_started
|
||||
|
||||
# tech-stack-selector:
|
||||
# build: ./services/tech-stack-selector
|
||||
# container_name: pipeline_tech_stack_selector
|
||||
# ports:
|
||||
# - "8002:8002"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# - REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
|
||||
# architecture-designer:
|
||||
# build: ./services/architecture-designer
|
||||
# container_name: pipeline_architecture_designer
|
||||
# ports:
|
||||
# - "8003:8003"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - HOST=0.0.0.0
|
||||
# - CLAUDE_API_KEY=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
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - MONGODB_HOST=mongodb
|
||||
# - MONGODB_PORT=27017
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# mongodb:
|
||||
# condition: service_started
|
||||
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "http://localhost:8003/health"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 3
|
||||
|
||||
# code-generator:
|
||||
# build: ./services/code-generator
|
||||
# container_name: pipeline_code_generator
|
||||
# ports:
|
||||
# - "8004:8004"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - MONGODB_HOST=mongodb
|
||||
# - MONGODB_PORT=27017
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# - REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
# - CLAUDE_API_KEY=${CLAUDE_API_KEY}
|
||||
# - OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||
# - NEO4J_URI=bolt://neo4j:7687
|
||||
# - NEO4J_USER=neo4j
|
||||
# - NEO4J_PASSWORD=password
|
||||
# - CHROMA_HOST=chromadb
|
||||
# - CHROMA_PORT=8000
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
# mongodb:
|
||||
# condition: service_started
|
||||
# neo4j:
|
||||
# chromadb:
|
||||
|
||||
# test-generator:
|
||||
# build: ./services/test-generator
|
||||
# container_name: pipeline_test_generator
|
||||
# ports:
|
||||
# - "8005:8005"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - REDIS_HOST=redis
|
||||
# - REDIS_PORT=6379
|
||||
# - REDIS_PASSWORD=${REDIS_PASSWORD}
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
|
||||
# deployment-manager:
|
||||
# build: ./services/deployment-manager
|
||||
# container_name: pipeline_deployment_manager
|
||||
# ports:
|
||||
# - "8006:8006"
|
||||
# environment:
|
||||
# - POSTGRES_HOST=postgres
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_DB=dev_pipeline
|
||||
# - POSTGRES_USER=pipeline_admin
|
||||
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# - MONGODB_HOST=mongodb
|
||||
# - MONGODB_PORT=27017
|
||||
# - RABBITMQ_HOST=rabbitmq
|
||||
# - RABBITMQ_PORT=5672
|
||||
# - RABBITMQ_USER=pipeline_admin
|
||||
# - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# rabbitmq:
|
||||
# condition: service_healthy
|
||||
# mongodb:
|
||||
# condition: service_started
|
||||
|
||||
# # =====================================
|
||||
|
||||
# # =====================================
|
||||
# # Workflow Orchestration
|
||||
# # =====================================
|
||||
|
||||
# n8n:
|
||||
# image: n8nio/n8n:latest
|
||||
# container_name: pipeline_n8n
|
||||
# ports:
|
||||
# - "5678:5678"
|
||||
# environment:
|
||||
# - N8N_BASIC_AUTH_ACTIVE=true
|
||||
# - N8N_BASIC_AUTH_USER=pipeline_admin
|
||||
# - N8N_BASIC_AUTH_PASSWORD=pipeline_n8n_2024
|
||||
# - N8N_HOST=localhost
|
||||
# - N8N_PORT=5678
|
||||
# - N8N_PROTOCOL=http
|
||||
# - WEBHOOK_URL=http://localhost:5678
|
||||
# - GENERIC_TIMEZONE=UTC
|
||||
# - DB_TYPE=postgresdb
|
||||
# - DB_POSTGRESDB_HOST=postgres
|
||||
# - DB_POSTGRESDB_PORT=5432
|
||||
# - DB_POSTGRESDB_DATABASE=n8n
|
||||
# - DB_POSTGRESDB_USER=pipeline_admin
|
||||
# - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
|
||||
# volumes:
|
||||
# - n8n_data:/home/node/.n8n
|
||||
# - ./orchestration/n8n/workflows:/home/node/.n8n/workflows
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
# depends_on:
|
||||
# postgres:
|
||||
# condition: service_healthy
|
||||
# redis:
|
||||
# condition: service_healthy
|
||||
# rabbitmq:
|
||||
# condition: service_healthy
|
||||
# healthcheck:
|
||||
# test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5678/healthz"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 5
|
||||
# start_period: 60s
|
||||
# # Volumes
|
||||
# # =====================================
|
||||
# volumes:
|
||||
# postgres_data:
|
||||
# driver: local
|
||||
# redis_data:
|
||||
# driver: local
|
||||
# mongodb_data:
|
||||
# driver: local
|
||||
# rabbitmq_data:
|
||||
# driver: local
|
||||
# rabbitmq_logs:
|
||||
# driver: local
|
||||
# n8n_data:
|
||||
# driver: local
|
||||
# neo4j_data:
|
||||
# driver: local
|
||||
# chromadb_data:
|
||||
# driver: local
|
||||
|
||||
# # =====================================
|
||||
# # Networks
|
||||
# # =====================================
|
||||
# networks:
|
||||
# pipeline_network:
|
||||
# driver: bridge
|
||||
|
||||
# neo4j:
|
||||
# image: neo4j:5.15
|
||||
# environment:
|
||||
# - NEO4J_AUTH=neo4j/password
|
||||
# ports:
|
||||
# - "7474:7474"
|
||||
# - "7687:7687"
|
||||
# volumes:
|
||||
# - neo4j_data:/data
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
|
||||
|
||||
# chromadb:
|
||||
# image: chromadb/chroma:latest
|
||||
# ports:
|
||||
# - "8000:8000"
|
||||
# volumes:
|
||||
# - chromadb_data:/chroma/chroma
|
||||
# networks:
|
||||
# - pipeline_network
|
||||
|
||||
# redis:
|
||||
# image: redis:7-alpine
|
||||
# container_name: pipeline_redis
|
||||
# environment:
|
||||
# REDIS_PASSWORD: redis123
|
||||
# REDIS_USER: redisuser
|
||||
# ports:
|
||||
# - "6380:6379"
|
||||
# volumes:
|
||||
# - redis_data:/data
|
||||
# command: redis-server --requirepass redis123
|
||||
# healthcheck:
|
||||
# test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
||||
# interval: 30s
|
||||
# timeout: 10s
|
||||
# retries: 3
|
||||
# start_period: 40s
|
||||
|
||||
mongodb:
|
||||
image: mongo:7
|
||||
|
||||
@ -106,6 +106,9 @@ class Feature {
|
||||
// Create new feature
|
||||
static async create(featureData) {
|
||||
const id = uuidv4();
|
||||
// Use the generated id as feature_id if not provided
|
||||
const featureId = featureData.id || id
|
||||
|
||||
const query = `
|
||||
INSERT INTO template_features (
|
||||
id, template_id, feature_id, name, description,
|
||||
@ -117,7 +120,7 @@ class Feature {
|
||||
const values = [
|
||||
id,
|
||||
featureData.template_id,
|
||||
featureData.feature_id,
|
||||
featureId,
|
||||
featureData.name,
|
||||
featureData.description,
|
||||
featureData.feature_type,
|
||||
@ -144,12 +147,14 @@ class Feature {
|
||||
business_rules: featureData.business_rules,
|
||||
rawRules,
|
||||
template_id: created.template_id,
|
||||
feature_id: created.feature_id
|
||||
feature_id: created.id,
|
||||
generated_id: created.id
|
||||
});
|
||||
|
||||
if (rawRules.length > 0) {
|
||||
await FeatureBusinessRules.upsert(created.template_id, created.feature_id, rawRules);
|
||||
console.log('✅ Feature.create - Business rules stored successfully');
|
||||
// Use the generated id (primary key) as feature_id for business rules
|
||||
await FeatureBusinessRules.upsert(created.template_id, created.id, rawRules);
|
||||
console.log('✅ Feature.create - Business rules stored successfully with id as feature_id:', created.id);
|
||||
} else {
|
||||
console.log('⚠️ Feature.create - No business rules to store');
|
||||
}
|
||||
|
||||
@ -285,28 +285,20 @@ router.post('/:id/features', async (req, res) => {
|
||||
});
|
||||
}
|
||||
|
||||
// Create the feature in template_features table
|
||||
const insertQuery = `
|
||||
INSERT INTO template_features (
|
||||
template_id, name, description, feature_type, complexity,
|
||||
display_order, is_default, created_by_user, created_at, updated_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, NOW(), NOW())
|
||||
RETURNING *
|
||||
`;
|
||||
|
||||
// Use Feature.create() method to ensure business rules are stored
|
||||
const displayOrder = template.features ? template.features.length + 1 : 1;
|
||||
const result = await database.query(insertQuery, [
|
||||
id,
|
||||
featureData.name,
|
||||
featureData.description || '',
|
||||
featureData.feature_type || 'custom',
|
||||
featureData.complexity || 'medium',
|
||||
displayOrder,
|
||||
featureData.is_default || false,
|
||||
featureData.created_by_user || true
|
||||
]);
|
||||
|
||||
const feature = result.rows[0];
|
||||
const feature = await Feature.create({
|
||||
template_id: id,
|
||||
name: featureData.name,
|
||||
description: featureData.description || '',
|
||||
feature_type: featureData.feature_type || 'custom',
|
||||
complexity: featureData.complexity || 'medium',
|
||||
display_order: displayOrder,
|
||||
is_default: featureData.is_default || false,
|
||||
created_by_user: featureData.created_by_user || true,
|
||||
logic_rules: featureData.logic_rules,
|
||||
business_rules: featureData.business_rules
|
||||
});
|
||||
|
||||
console.log('✅ [ADMIN-TEMPLATES] Feature created:', feature.id);
|
||||
|
||||
@ -472,26 +464,21 @@ router.post('/:id/features/bulk', async (req, res) => {
|
||||
|
||||
for (const featureData of features) {
|
||||
try {
|
||||
const insertQuery = `
|
||||
INSERT INTO template_features (
|
||||
template_id, name, description, feature_type, complexity,
|
||||
display_order, is_default, created_by_user, created_at, updated_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, NOW(), NOW())
|
||||
RETURNING *
|
||||
`;
|
||||
// Use Feature.create() method to ensure business rules are stored
|
||||
const feature = await Feature.create({
|
||||
template_id: id,
|
||||
name: featureData.name,
|
||||
description: featureData.description || '',
|
||||
feature_type: featureData.feature_type || 'custom',
|
||||
complexity: featureData.complexity || 'medium',
|
||||
display_order: displayOrder++,
|
||||
is_default: featureData.is_default || false,
|
||||
created_by_user: featureData.created_by_user || true,
|
||||
logic_rules: featureData.logic_rules,
|
||||
business_rules: featureData.business_rules
|
||||
});
|
||||
|
||||
const result = await database.query(insertQuery, [
|
||||
id,
|
||||
featureData.name,
|
||||
featureData.description || '',
|
||||
featureData.feature_type || 'custom',
|
||||
featureData.complexity || 'medium',
|
||||
displayOrder++,
|
||||
featureData.is_default || false,
|
||||
featureData.created_by_user || true
|
||||
]);
|
||||
|
||||
createdFeatures.push(result.rows[0]);
|
||||
createdFeatures.push(feature);
|
||||
} catch (featureError) {
|
||||
console.error('⚠️ [ADMIN-TEMPLATES] Error creating feature:', featureData.name, featureError.message);
|
||||
// Continue with other features instead of failing completely
|
||||
|
||||
Loading…
Reference in New Issue
Block a user