backend changes
This commit is contained in:
parent
f829c771ca
commit
53af324e06
@ -355,11 +355,10 @@ app.use('/api/self-improving',
|
|||||||
console.log('🔧 Registering /api/features proxy route...');
|
console.log('🔧 Registering /api/features proxy route...');
|
||||||
app.use('/api/features',
|
app.use('/api/features',
|
||||||
createServiceLimiter(300),
|
createServiceLimiter(300),
|
||||||
|
// Public proxy: features endpoints do not require auth
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
if (req.method === 'GET') {
|
console.log(`🟢 [FEATURES PROXY] Public access → ${req.method} ${req.originalUrl}`);
|
||||||
return next();
|
return next();
|
||||||
}
|
|
||||||
return authMiddleware.verifyToken(req, res, () => authMiddleware.forwardUserContext(req, res, next));
|
|
||||||
},
|
},
|
||||||
(req, res, next) => {
|
(req, res, next) => {
|
||||||
const templateServiceUrl = serviceTargets.TEMPLATE_MANAGER_URL;
|
const templateServiceUrl = serviceTargets.TEMPLATE_MANAGER_URL;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ class CustomFeature {
|
|||||||
constructor(data = {}) {
|
constructor(data = {}) {
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.template_id = data.template_id;
|
this.template_id = data.template_id;
|
||||||
|
this.template_type = data.template_type || 'default';
|
||||||
this.name = data.name;
|
this.name = data.name;
|
||||||
this.description = data.description;
|
this.description = data.description;
|
||||||
this.complexity = data.complexity;
|
this.complexity = data.complexity;
|
||||||
@ -43,7 +44,7 @@ class CustomFeature {
|
|||||||
const id = uuidv4();
|
const id = uuidv4();
|
||||||
const query = `
|
const query = `
|
||||||
INSERT INTO custom_features (
|
INSERT INTO custom_features (
|
||||||
id, template_id, name, description, complexity,
|
id, template_id, template_type, name, description, complexity,
|
||||||
business_rules, technical_requirements, approved, usage_count, created_by_user_session,
|
business_rules, technical_requirements, approved, usage_count, created_by_user_session,
|
||||||
status, admin_notes, admin_reviewed_at, admin_reviewed_by, canonical_feature_id, similarity_score
|
status, admin_notes, admin_reviewed_at, admin_reviewed_by, canonical_feature_id, similarity_score
|
||||||
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)
|
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)
|
||||||
@ -52,6 +53,7 @@ class CustomFeature {
|
|||||||
const values = [
|
const values = [
|
||||||
id,
|
id,
|
||||||
data.template_id,
|
data.template_id,
|
||||||
|
data.template_type || 'default',
|
||||||
data.name,
|
data.name,
|
||||||
data.description || null,
|
data.description || null,
|
||||||
data.complexity,
|
data.complexity,
|
||||||
|
|||||||
@ -487,6 +487,7 @@ router.post('/custom', async (req, res) => {
|
|||||||
|
|
||||||
const created = await CustomFeature.create({
|
const created = await CustomFeature.create({
|
||||||
template_id: data.template_id,
|
template_id: data.template_id,
|
||||||
|
template_type: templateCheck.rows[0]?.template_type === 'custom' ? 'custom' : 'default',
|
||||||
name: data.name,
|
name: data.name,
|
||||||
description: data.description,
|
description: data.description,
|
||||||
complexity: data.complexity,
|
complexity: data.complexity,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user