feat: upgrade AI prompts to v2 specification with grounding and injection shield

This commit is contained in:
mstfyldz
2026-08-14 00:52:41 +03:00
parent f1457b02ca
commit fab80e05a0
8 changed files with 257 additions and 45 deletions
+25 -3
View File
@@ -22,12 +22,33 @@ export const requireAuth = async (req: AuthenticatedRequest, res: Response, next
// P0-2: Lisans Kontrolü
const { data: profile } = await supabase
.from('profiles')
.select('license_status')
.select('license_status, trial_end_date')
.eq('id', user.id)
.single();
if (!profile || (profile.license_status !== 'active' && profile.license_status !== 'trial')) {
return res.status(403).json({ error: 'Forbidden: License is not active or in trial' });
if (!profile) {
return res.status(403).json({ error: 'Forbidden: User profile not found' });
}
// Deneme süresi dolmuş mu anlık kontrol et
if (profile.license_status === 'trial' && profile.trial_end_date) {
const trialEnd = new Date(profile.trial_end_date);
if (trialEnd < new Date()) {
// DB'yi güncelle — bir sonraki istek için de geçerli olsun
await supabase
.from('profiles')
.update({ license_status: 'expired' })
.eq('id', user.id);
return res.status(403).json({
error: 'Trial süresi dolmuştur. Lisansınızı aktive etmek için aktivasyon kodunuzu girin.',
code: 'TRIAL_EXPIRED',
});
}
}
if (profile.license_status !== 'active' && profile.license_status !== 'trial') {
return res.status(403).json({ error: 'Forbidden: License is not active or in trial', code: 'LICENSE_INACTIVE' });
}
req.user = user;
@@ -55,3 +76,4 @@ export const requireAuth = async (req: AuthenticatedRequest, res: Response, next
res.status(500).json({ error: 'Internal server error during authentication' });
}
};