@danielcok17/prisma-db 1.20.18 → 1.20.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielcok17/prisma-db",
3
- "version": "1.20.18",
3
+ "version": "1.20.20",
4
4
  "description": "Shared Prisma schema for Legal AI applications",
5
5
  "repository": {
6
6
  "type": "git",
package/prisma/app.prisma CHANGED
@@ -89,6 +89,9 @@ model User {
89
89
  phone String? // Mobilný telefón
90
90
  phoneVerified DateTime? // Kedy bol telefón overený cez OTP
91
91
  occupation String? // Povolanie (Právnik, Účtovník, etc.)
92
+ isicVerified Boolean @default(false) // Overený ISIC/ITIC/EURO<26 preukaz
93
+ isicJscp String? // JSČP číslo overeného preukazu
94
+ isicVerifiedAt DateTime? // Kedy bol preukaz overený
92
95
  preferredLanguage String? @default("sk") // Jazyk odpovedi (sk, cs, en)
93
96
  // Email Lifecycle — 360° user view
94
97
  lastActiveAt DateTime?
@@ -860,6 +863,7 @@ enum CustomerType {
860
863
  // Stripe: Tier predplatného
861
864
  enum SubscriptionTier {
862
865
  FREE // Free tier (4 messages/month)
866
+ STUDENT // Student tier (ISIC/ITIC/EURO<26, €9/month)
863
867
  LAWYER // Lawyer tier (1000 messages/month, €29/month, 1 user)
864
868
  LAWYER_PRO // Lawyer Pro tier (3000 messages/month, €49/month, 1 user) - RECOMMENDED
865
869
  LAW_FIRM // Law Firm tier (10000 messages/month, €129/month, up to 5 users)
@@ -22,13 +22,18 @@ CREATE INDEX "legal_opinion_case_number_decision_date_idx" ON "legal_opinion" ("
22
22
  CREATE INDEX "legal_opinion_source_idx" ON "legal_opinion" ("source");
23
23
 
24
24
  -- Backfill from existing legal_precedents rows that have a právna veta
25
- INSERT INTO "legal_opinion" ("case_number", "decision_date", "ecli", "source", "text", "reasoning")
26
- SELECT
27
- lp.case_number,
28
- lp.decision_date,
29
- lp.ecli,
30
- 'legal_precedents',
31
- lp.legal_opinion,
32
- lp.opinion_reasoning
33
- FROM legal_precedents lp
34
- WHERE lp.legal_opinion IS NOT NULL AND lp.legal_opinion != '';
25
+ DO $$
26
+ BEGIN
27
+ IF EXISTS (SELECT FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'legal_precedents') THEN
28
+ INSERT INTO "legal_opinion" ("case_number", "decision_date", "ecli", "source", "text", "reasoning")
29
+ SELECT
30
+ lp.case_number,
31
+ lp.decision_date,
32
+ lp.ecli,
33
+ 'legal_precedents',
34
+ lp.legal_opinion,
35
+ lp.opinion_reasoning
36
+ FROM legal_precedents lp
37
+ WHERE lp.legal_opinion IS NOT NULL AND lp.legal_opinion != '';
38
+ END IF;
39
+ END $$;
@@ -0,0 +1,8 @@
1
+ -- AddValueToEnum: STUDENT to SubscriptionTier
2
+ -- Note: ALTER TYPE ADD VALUE cannot run inside a transaction in PostgreSQL
3
+ ALTER TYPE "SubscriptionTier" ADD VALUE IF NOT EXISTS 'STUDENT';
4
+
5
+ -- AlterTable: Add ISIC fields to User
6
+ ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "isicVerified" BOOLEAN NOT NULL DEFAULT false;
7
+ ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "isicJscp" TEXT;
8
+ ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "isicVerifiedAt" TIMESTAMP(3);