@campus-labs/prisma-client 0.12.10 → 0.14.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/.claude/settings.local.json +11 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +51 -2
- package/prisma/seed-tags.ts +64 -0
- package/tsconfig.json +5 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(ls -la /Users/nunomatos/Desktop/SerMais/prisma/.env*)",
|
|
5
|
+
"Bash(git check-ignore -v /Users/nunomatos/Desktop/SerMais/prisma/.env.staging)",
|
|
6
|
+
"Bash(git check-ignore -v .env.staging)",
|
|
7
|
+
"Bash(ls -la /Users/nunomatos/Desktop/SerMais/prisma/*.ts /Users/nunomatos/Desktop/SerMais/prisma/*.js)",
|
|
8
|
+
"Bash(grep -r \"\\\\.password\" /Users/nunomatos/Desktop/SerMais --include=\"*.ts\" --include=\"*.js\" ! -path \"*/node_modules/*\" ! -path \"*/.next/*\" ! -path \"*/dist/*\")"
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -147,6 +147,7 @@ model initiatives {
|
|
|
147
147
|
user_initiative_openings user_initiative_openings[]
|
|
148
148
|
roleUserInitiativeUpdates role_user_initiative_update[]
|
|
149
149
|
feedbackInitiatives feedback_initiative[]
|
|
150
|
+
initiatives_tags initiatives_tags[]
|
|
150
151
|
|
|
151
152
|
@@index([start_date, end_date], map: "idx_initiatives_active")
|
|
152
153
|
@@index([area_id], map: "idx_initiatives_area_active")
|
|
@@ -624,17 +625,19 @@ model projects {
|
|
|
624
625
|
is_pending Boolean @default(false)
|
|
625
626
|
is_published Boolean @default(false)
|
|
626
627
|
author_id String @db.VarChar(50)
|
|
627
|
-
gamification_designer_id String
|
|
628
|
+
gamification_designer_id String @db.VarChar(50)
|
|
628
629
|
created_at DateTime @default(now()) @db.Timestamp(6)
|
|
629
630
|
updated_at DateTime @default(now()) @db.Timestamp(6)
|
|
630
631
|
deleted_at DateTime? @db.Timestamp(6)
|
|
632
|
+
version Int @default(1)
|
|
633
|
+
current_state Json
|
|
631
634
|
snapshots snapshots[]
|
|
632
635
|
initiatives initiatives[]
|
|
636
|
+
patches patches[]
|
|
633
637
|
|
|
634
638
|
users users @relation("ProjectAuthor", fields: [author_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
635
639
|
gamification_designer users @relation("ProjectGamificationDesigner", fields: [gamification_designer_id], references: [id], onDelete: SetNull, onUpdate: Cascade)
|
|
636
640
|
|
|
637
|
-
|
|
638
641
|
@@index([author_id], map: "idx_projects_author")
|
|
639
642
|
@@index([gamification_designer_id], map: "idx_projects_designer")
|
|
640
643
|
}
|
|
@@ -644,11 +647,57 @@ model snapshots {
|
|
|
644
647
|
project_id Int
|
|
645
648
|
data Json
|
|
646
649
|
accepted Boolean @default(false)
|
|
650
|
+
version Int @default(1)
|
|
647
651
|
created_at DateTime @default(now()) @db.Timestamp(6)
|
|
648
652
|
updated_at DateTime @default(now()) @db.Timestamp(6)
|
|
649
653
|
deleted_at DateTime? @db.Timestamp(6)
|
|
654
|
+
state Json
|
|
650
655
|
|
|
651
656
|
projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
652
657
|
|
|
653
658
|
@@index([project_id], map: "idx_snapshots_project")
|
|
654
659
|
}
|
|
660
|
+
|
|
661
|
+
model tags {
|
|
662
|
+
id Int @id @default(autoincrement())
|
|
663
|
+
tag String @unique @db.VarChar(50)
|
|
664
|
+
created_at DateTime @default(now()) @db.Timestamp(6)
|
|
665
|
+
updated_at DateTime @default(now()) @db.Timestamp(6)
|
|
666
|
+
deleted_at DateTime? @db.Timestamp(6)
|
|
667
|
+
|
|
668
|
+
initiatives_tags initiatives_tags[]
|
|
669
|
+
|
|
670
|
+
@@index([tag], map: "idx_tags_tag")
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
model initiatives_tags {
|
|
674
|
+
initiative_id Int
|
|
675
|
+
tag_id Int
|
|
676
|
+
created_at DateTime @default(now()) @db.Timestamp(6)
|
|
677
|
+
updated_at DateTime @default(now()) @db.Timestamp(6)
|
|
678
|
+
deleted_at DateTime? @db.Timestamp(6)
|
|
679
|
+
|
|
680
|
+
initiatives initiatives @relation(fields: [initiative_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
681
|
+
tags tags @relation(fields: [tag_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
682
|
+
|
|
683
|
+
@@id([initiative_id, tag_id])
|
|
684
|
+
@@index([initiative_id], map: "idx_initiatives_tags_initiative")
|
|
685
|
+
@@index([tag_id], map: "idx_initiatives_tags_tag")
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
model patches {
|
|
689
|
+
id Int @id @default(autoincrement())
|
|
690
|
+
project_id Int
|
|
691
|
+
operations Int[]
|
|
692
|
+
is_ai_generated Boolean
|
|
693
|
+
is_adopted String @default("PENDING") @db.VarChar(20)
|
|
694
|
+
version Int @default(1)
|
|
695
|
+
type String @db.VarChar(20)
|
|
696
|
+
created_at DateTime @default(now()) @db.Timestamp(6)
|
|
697
|
+
updated_at DateTime @default(now()) @db.Timestamp(6)
|
|
698
|
+
deleted_at DateTime? @db.Timestamp(6)
|
|
699
|
+
|
|
700
|
+
projects projects @relation(fields: [project_id], references: [id], onDelete: Cascade, onUpdate: Cascade)
|
|
701
|
+
|
|
702
|
+
@@index([project_id], map: "idx_patches_project")
|
|
703
|
+
}
|
|
@@ -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": "
|
|
3
|
+
"module": "Node16",
|
|
4
4
|
"target": "ES2019",
|
|
5
|
-
"moduleResolution": "
|
|
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
|
}
|