mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-20 04:21:25 +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
115
chat/apps/mobile/scripts/setup_rls_policies.sql
Normal file
115
chat/apps/mobile/scripts/setup_rls_policies.sql
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
-- RLS-Richtlinien für die Conversations-Tabelle
|
||||
|
||||
-- Aktiviere RLS für die Conversations-Tabelle
|
||||
ALTER TABLE conversations ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Erstelle eine Richtlinie für das Einfügen von Konversationen
|
||||
-- Benutzer dürfen nur Konversationen für sich selbst erstellen
|
||||
CREATE POLICY conversations_insert_policy
|
||||
ON conversations
|
||||
FOR INSERT
|
||||
TO authenticated
|
||||
WITH CHECK (auth.uid() = user_id);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Lesen von Konversationen
|
||||
-- Benutzer dürfen nur ihre eigenen Konversationen sehen
|
||||
CREATE POLICY conversations_select_policy
|
||||
ON conversations
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Aktualisieren von Konversationen
|
||||
-- Benutzer dürfen nur ihre eigenen Konversationen aktualisieren
|
||||
CREATE POLICY conversations_update_policy
|
||||
ON conversations
|
||||
FOR UPDATE
|
||||
TO authenticated
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Löschen von Konversationen
|
||||
-- Benutzer dürfen nur ihre eigenen Konversationen löschen
|
||||
CREATE POLICY conversations_delete_policy
|
||||
ON conversations
|
||||
FOR DELETE
|
||||
TO authenticated
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
-- RLS-Richtlinien für die Messages-Tabelle
|
||||
|
||||
-- Aktiviere RLS für die Messages-Tabelle
|
||||
ALTER TABLE messages ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Erstelle eine Richtlinie für das Einfügen von Nachrichten
|
||||
-- Benutzer dürfen nur Nachrichten zu ihren eigenen Konversationen hinzufügen
|
||||
CREATE POLICY messages_insert_policy
|
||||
ON messages
|
||||
FOR INSERT
|
||||
TO authenticated
|
||||
WITH CHECK (
|
||||
conversation_id IN (
|
||||
SELECT id FROM conversations WHERE user_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Lesen von Nachrichten
|
||||
-- Benutzer dürfen nur Nachrichten aus ihren eigenen Konversationen sehen
|
||||
CREATE POLICY messages_select_policy
|
||||
ON messages
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (
|
||||
conversation_id IN (
|
||||
SELECT id FROM conversations WHERE user_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Aktualisieren von Nachrichten
|
||||
-- Benutzer dürfen nur Nachrichten aus ihren eigenen Konversationen aktualisieren
|
||||
CREATE POLICY messages_update_policy
|
||||
ON messages
|
||||
FOR UPDATE
|
||||
TO authenticated
|
||||
USING (
|
||||
conversation_id IN (
|
||||
SELECT id FROM conversations WHERE user_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
-- Erstelle eine Richtlinie für das Löschen von Nachrichten
|
||||
-- Benutzer dürfen nur Nachrichten aus ihren eigenen Konversationen löschen
|
||||
CREATE POLICY messages_delete_policy
|
||||
ON messages
|
||||
FOR DELETE
|
||||
TO authenticated
|
||||
USING (
|
||||
conversation_id IN (
|
||||
SELECT id FROM conversations WHERE user_id = auth.uid()
|
||||
)
|
||||
);
|
||||
|
||||
-- RLS-Richtlinien für die Models-Tabelle
|
||||
|
||||
-- Aktiviere RLS für die Models-Tabelle
|
||||
ALTER TABLE models ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Erstelle eine Richtlinie für das Lesen von Modellen
|
||||
-- Alle authentifizierten Benutzer dürfen Modelle sehen
|
||||
CREATE POLICY models_select_policy
|
||||
ON models
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
|
||||
-- RLS-Richtlinien für die Templates-Tabelle
|
||||
|
||||
-- Aktiviere RLS für die Templates-Tabelle
|
||||
ALTER TABLE templates ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Erstelle eine Richtlinie für das Lesen von Templates
|
||||
-- Alle authentifizierten Benutzer dürfen Templates sehen
|
||||
CREATE POLICY templates_select_policy
|
||||
ON templates
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
Loading…
Add table
Add a link
Reference in a new issue