mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 15:59:40 +02:00
Phase 3.A des feedback-rewards-and-identity-Plans. Direkter Reziprozitäts- Loop: User kriegt sofort etwas zurück fürs Mitwirken, Originalwunsch- Eulen werden beim Ship belohnt, Reagierer kriegen einen Anteil. mana-credits: - Neuer Endpoint POST /api/v1/internal/credits/grant + grantCredits() Service-Methode mit Idempotency via metadata.referenceId. - transaction_type-Enum erweitert um 'grant' (eigener Typ statt Mismatch mit 'refund'). - Migration 0001_grant_transaction_type.sql + partial-Index auf metadata->>'referenceId' für O(log n) Idempotency-Lookup. mana-analytics: - FeedbackService stempelt sofort +5 Credits beim createFeedback (top- level only, Replies bekommen nichts), wenn Mindest-20-Zeichen erfüllt und Rate-Limit (10/User/24h via feedback_grant_log) nicht überschritten. - adminUpdate triggert beim FRISCHEN Übergang nach 'completed': +500 Credits an Original-Wisher + +25 an alle, die mit 👍 oder 🚀 reagiert haben. Doppel-Pay strukturell unmöglich via referenceId (`<id>_shipped`, `<id>_reaction_<userId>`). - Founder-Whitelist via FEEDBACK_FOUNDER_USER_IDS env (verhindert Self-Reward). - Drop voteCount-Spalte (durch reactions/score seit 0002 ersetzt). - Migration 0003_grant_log_drop_vote_count.sql idempotent, lokal + prod eingespielt. Plan: docs/plans/feedback-rewards-and-identity.md (Phase 3.A-3.F). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
export interface Config {
|
|
port: number;
|
|
databaseUrl: string;
|
|
manaAuthUrl: string;
|
|
manaLlmUrl: string;
|
|
manaCreditsUrl: string;
|
|
serviceKey: string;
|
|
/**
|
|
* Secret seeded into the per-user display-hash for the public-community
|
|
* pseudonym ("Wachsame Eule #4528"). Rotating this re-keys all future
|
|
* pseudonyms — existing rows keep the old hash/name.
|
|
*/
|
|
pseudonymSecret: string;
|
|
/**
|
|
* UserIds that bypass the +5 / +500 community credit grants — they would
|
|
* otherwise self-reward when posting/shipping their own wishes. Comma-
|
|
* separated env, empty in dev.
|
|
*/
|
|
founderUserIds: Set<string>;
|
|
cors: { origins: string[] };
|
|
}
|
|
|
|
export function loadConfig(): Config {
|
|
const env = (key: string, fallback?: string) => process.env[key] || fallback || '';
|
|
return {
|
|
port: parseInt(env('PORT', '3064'), 10),
|
|
databaseUrl: env('DATABASE_URL', 'postgresql://mana:devpassword@localhost:5432/mana_platform'),
|
|
manaAuthUrl: env('MANA_AUTH_URL', 'http://localhost:3001'),
|
|
manaLlmUrl: env('MANA_LLM_URL', 'http://localhost:3025'),
|
|
manaCreditsUrl: env('MANA_CREDITS_URL', 'http://localhost:3061'),
|
|
serviceKey: env('MANA_SERVICE_KEY', 'dev-service-key'),
|
|
pseudonymSecret: env('FEEDBACK_PSEUDONYM_SECRET', 'dev-pseudonym-secret'),
|
|
founderUserIds: new Set(
|
|
env('FEEDBACK_FOUNDER_USER_IDS', '')
|
|
.split(',')
|
|
.map((s) => s.trim())
|
|
.filter(Boolean)
|
|
),
|
|
cors: { origins: env('CORS_ORIGINS', 'http://localhost:5173').split(',') },
|
|
};
|
|
}
|