@campus-labs/prisma-client 0.13.0 → 0.15.0

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": "@campus-labs/prisma-client",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -15,7 +15,7 @@
15
15
  "seed:dev": "npx prisma db seed",
16
16
  "deploy:dev": "npx prisma migrate deploy",
17
17
  "generate": "npx prisma@6.9.0 generate",
18
- "deploy:staging": "dotenv -e .env.staging -- npx prisma migrate deploy",
18
+ "deploy:staging": "dotenv -e .env.staging -- npx prisma migrate deploy",
19
19
  "reset:staging": "dotenv -e .env.staging -- npx prisma migrate reset",
20
20
  "seed:staging": "dotenv -e .env.staging -- npx prisma db seed",
21
21
  "deploy:prod": "dotenv -e .env.production -- npx prisma migrate deploy",
@@ -36,4 +36,4 @@
36
36
  "prisma": "6.9.0",
37
37
  "@prisma/client": "6.11.1"
38
38
  }
39
- }
39
+ }
@@ -338,7 +338,7 @@ model users {
338
338
  updated_at DateTime @default(now()) @db.Timestamp(6)
339
339
  deleted_at DateTime? @db.Timestamp(6)
340
340
  notification_tokens String[] @db.VarChar(5000)
341
- linkedin_token Json?
341
+ linkedin_token Json?
342
342
  points Int @default(0)
343
343
  ua_iupi String @unique @db.VarChar(50)
344
344
  last_notification_check DateTime @default(now()) @db.Timestamp(6)
@@ -368,7 +368,7 @@ model users {
368
368
  power_up_instances power_up_instances[]
369
369
  expelled_user_initiatives user_initiative[] @relation("UserInitiativeExpeller")
370
370
  projects projects[] @relation("ProjectAuthor")
371
- designed_projects projects[] @relation("ProjectGamificationDesigner")
371
+ designed_projects projects[] @relation("ProjectEditor")
372
372
 
373
373
  @@index([role_platform_id], map: "idx_users_role")
374
374
  @@index([points(sort: Desc)], map: "idx_users_points")
@@ -618,36 +618,16 @@ model power_up_instances {
618
618
  @@index([user_id, activated_at, expires_at], map: "idx_pui_user_active_window")
619
619
  }
620
620
 
621
- model projects {
622
- id Int @id @default(autoincrement())
623
- title String @db.VarChar(100)
624
- is_draft Boolean @default(true)
625
- is_pending Boolean @default(false)
626
- is_published Boolean @default(false)
627
- author_id String @db.VarChar(50)
628
- gamification_designer_id String @db.VarChar(50)
629
- created_at DateTime @default(now()) @db.Timestamp(6)
630
- updated_at DateTime @default(now()) @db.Timestamp(6)
631
- deleted_at DateTime? @db.Timestamp(6)
632
- snapshots snapshots[]
633
- initiatives initiatives[]
634
-
635
- users users @relation("ProjectAuthor", fields: [author_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
636
- gamification_designer users @relation("ProjectGamificationDesigner", fields: [gamification_designer_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
637
-
638
-
639
- @@index([author_id], map: "idx_projects_author")
640
- @@index([gamification_designer_id], map: "idx_projects_designer")
641
- }
642
-
643
621
  model snapshots {
644
622
  id Int @id @default(autoincrement())
645
623
  project_id Int
646
624
  data Json
647
625
  accepted Boolean @default(false)
626
+ version Int @default(1)
648
627
  created_at DateTime @default(now()) @db.Timestamp(6)
649
628
  updated_at DateTime @default(now()) @db.Timestamp(6)
650
629
  deleted_at DateTime? @db.Timestamp(6)
630
+ state Json
651
631
 
652
632
  projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
653
633
 
@@ -679,4 +659,44 @@ model initiatives_tags {
679
659
  @@id([initiative_id, tag_id])
680
660
  @@index([initiative_id], map: "idx_initiatives_tags_initiative")
681
661
  @@index([tag_id], map: "idx_initiatives_tags_tag")
662
+ }
663
+
664
+ model projects {
665
+ id Int @id @default(autoincrement())
666
+ is_draft Boolean @default(true)
667
+ is_pending Boolean @default(false)
668
+ is_published Boolean @default(false)
669
+ author_id String @db.VarChar(50)
670
+ editor_id String? @db.VarChar(50)
671
+ created_at DateTime @default(now()) @db.Timestamp(6)
672
+ updated_at DateTime @default(now()) @db.Timestamp(6)
673
+ deleted_at DateTime? @db.Timestamp(6)
674
+ version Int @default(1)
675
+ current_state Json
676
+ initiatives initiatives[]
677
+ patches patches[]
678
+
679
+ authors users @relation("ProjectAuthor", fields: [author_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
680
+ editors users? @relation("ProjectEditor", fields: [editor_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
681
+ snapshots snapshots[]
682
+
683
+ @@index([author_id], map: "idx_projects_author")
684
+ @@index([editor_id], map: "idx_projects_designer")
685
+ }
686
+
687
+ model patches {
688
+ id Int @id @default(autoincrement())
689
+ project_id Int
690
+ operations Json[]
691
+ is_ai_generated Boolean @default(false)
692
+ is_adopted String @default("PENDING") @db.VarChar(20)
693
+ version Int @default(1)
694
+ type String @default("NORMAL") @db.VarChar(20)
695
+ created_at DateTime @default(now()) @db.Timestamp(6)
696
+ updated_at DateTime @default(now()) @db.Timestamp(6)
697
+ deleted_at DateTime? @db.Timestamp(6)
698
+
699
+ projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
700
+
701
+ @@index([project_id], map: "idx_patches_project")
682
702
  }
@@ -0,0 +1,64 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ const tags = [
6
+ 'Gaming',
7
+ 'Música',
8
+ 'Cinema',
9
+ 'Fotografia',
10
+ 'Teatro',
11
+ 'Networking',
12
+ 'Artes Visuais',
13
+ 'Literatura',
14
+ 'Património',
15
+ 'História',
16
+ 'Informática',
17
+ 'Eletrónica',
18
+ 'Robótica',
19
+ 'Inteligência Artificial',
20
+ 'Astronomia',
21
+ 'Cultura Maker (DIY)',
22
+ 'Debates',
23
+ 'Conferências',
24
+ 'Desporto',
25
+ 'Atividades Náuticas',
26
+ 'Natureza',
27
+ 'Saúde',
28
+ 'Jogos de Tabuleiro',
29
+ 'Viagens',
30
+ 'Erasmus',
31
+ 'Nutrição',
32
+ 'Sustentabilidade',
33
+ 'Voluntariado',
34
+ 'Política',
35
+ 'Empreendedorismo',
36
+ 'Finanças',
37
+ 'Ciência',
38
+ 'Investigação',
39
+ 'Convívios',
40
+ ];
41
+
42
+ async function main() {
43
+ console.log('🌱 A popular tags...');
44
+
45
+ for (const tag of tags) {
46
+ await prisma.tags.upsert({
47
+ where: { tag },
48
+ update: {},
49
+ create: { tag },
50
+ });
51
+ console.log(` ✅ ${tag}`);
52
+ }
53
+
54
+ console.log(`\n🎉 ${tags.length} tags processadas com sucesso!`);
55
+ }
56
+
57
+ main()
58
+ .catch((e) => {
59
+ console.error('❌ Erro ao popular tags:', e);
60
+ process.exit(1);
61
+ })
62
+ .finally(async () => {
63
+ await prisma.$disconnect();
64
+ });
package/tsconfig.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "CommonJS",
3
+ "module": "Node16",
4
4
  "target": "ES2019",
5
- "moduleResolution": "node",
5
+ "moduleResolution": "node16",
6
+ "rootDir": "./prisma",
6
7
  "esModuleInterop": true,
7
- "outDir": "dist"
8
+ "outDir": "dist",
9
+ "types": ["node"]
8
10
  },
9
11
  "include": ["prisma/**/*"]
10
12
  }