mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 10:21:10 +02:00
feat(chat): integrate chat project into monorepo with full app structure
- Restructure chat as apps/mobile, apps/web, apps/landing, backend - Add NestJS backend for secure Azure OpenAI API calls - Remove exposed API key from mobile app (security fix) - Add shared chat-types package - Create SvelteKit web app scaffold - Create Astro landing page scaffold - Update pnpm workspace configuration - Add project-level CLAUDE.md documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
fcf3a344b1
commit
c638a7ffee
155 changed files with 22622 additions and 348 deletions
31
chat/apps/mobile/scripts/create_delete_document_function.sql
Normal file
31
chat/apps/mobile/scripts/create_delete_document_function.sql
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-- Diese SQL-Funktion zum Löschen eines Dokuments erstellt eine sichere Methode
|
||||
-- zum Löschen über RPC, was besser gegen Datenbank-Caching und Race-Conditions ist
|
||||
|
||||
-- Führen Sie dieses SQL im Supabase SQL-Editor aus
|
||||
|
||||
CREATE OR REPLACE FUNCTION delete_document_by_id(document_id uuid)
|
||||
RETURNS boolean AS $$
|
||||
DECLARE
|
||||
success boolean;
|
||||
affected_rows int;
|
||||
BEGIN
|
||||
-- Führe die eigentliche Löschung durch
|
||||
DELETE FROM documents
|
||||
WHERE id = document_id
|
||||
AND conversation_id IN (
|
||||
SELECT id FROM conversations WHERE user_id = auth.uid()
|
||||
);
|
||||
|
||||
-- Speichere die Anzahl der betroffenen Zeilen
|
||||
GET DIAGNOSTICS affected_rows = ROW_COUNT;
|
||||
|
||||
-- Setze den Erfolgsstatus basierend auf der Anzahl der gelöschten Zeilen
|
||||
success := affected_rows > 0;
|
||||
|
||||
-- Gib das Ergebnis zurück (true wenn erfolgreich, false wenn nicht)
|
||||
RETURN success;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql SECURITY DEFINER;
|
||||
|
||||
-- Diese Funktion kann dann mit dem folgenden JavaScript aufgerufen werden:
|
||||
-- const { data, error } = await supabase.rpc('delete_document_by_id', { document_id: 'uuid-here' });
|
||||
Loading…
Add table
Add a link
Reference in a new issue