@@ -21,10 +21,15 @@ async function main() {
2121 await prisma . plano . deleteMany ( ) ;
2222 await prisma . funcionario . deleteMany ( ) ;
2323
24+ // IDs para consistência relacional
25+ const instrutorId = crypto . randomUUID ( ) ;
26+ const planoIds = [ crypto . randomUUID ( ) , crypto . randomUUID ( ) , crypto . randomUUID ( ) , crypto . randomUUID ( ) ] ;
27+ const alunoIds = [ crypto . randomUUID ( ) , crypto . randomUUID ( ) , crypto . randomUUID ( ) ] ;
28+
2429 // 2. Funcionários (Instrutores)
25- const func1 = await prisma . funcionario . create ( {
30+ await prisma . funcionario . create ( {
2631 data : {
27- id : "func1" ,
32+ id : instrutorId ,
2833 nomeCompleto : "João Instrutor" ,
2934 email : "joao.instrutor@academia.com" ,
3035 role : "INSTRUTOR" ,
@@ -33,10 +38,10 @@ async function main() {
3338
3439 // 3. Planos
3540 const planos = [
36- { id : "1" , nome : "Plano Mensal" , preco : 120 , duracaoDias : 30 } ,
37- { id : "2" , nome : "Plano Trimestral" , preco : 330 , duracaoDias : 90 } ,
38- { id : "3" , nome : "Plano Semestral" , preco : 600 , duracaoDias : 180 } ,
39- { id : "4" , nome : "Plano Anual" , preco : 1080 , duracaoDias : 365 } ,
41+ { id : planoIds [ 0 ] , nome : "Plano Mensal" , preco : 120 , duracaoDias : 30 } ,
42+ { id : planoIds [ 1 ] , nome : "Plano Trimestral" , preco : 330 , duracaoDias : 90 } ,
43+ { id : planoIds [ 2 ] , nome : "Plano Semestral" , preco : 600 , duracaoDias : 180 } ,
44+ { id : planoIds [ 3 ] , nome : "Plano Anual" , preco : 1080 , duracaoDias : 365 } ,
4045 ] ;
4146
4247 for ( const plano of planos ) {
@@ -46,7 +51,7 @@ async function main() {
4651 // 4. Alunos
4752 const alunos = [
4853 {
49- id : "1" ,
54+ id : alunoIds [ 0 ] ,
5055 nomeCompleto : "Ana Silva" ,
5156 cpf : "111.222.333-44" ,
5257 email : "ana.silva@example.com" ,
@@ -57,7 +62,7 @@ async function main() {
5762 statusMatricula : "ATIVA" as const ,
5863 } ,
5964 {
60- id : "2" ,
65+ id : alunoIds [ 1 ] ,
6166 nomeCompleto : "Bruno Costa" ,
6267 cpf : "222.333.444-55" ,
6368 email : "bruno.costa@example.com" ,
@@ -68,7 +73,7 @@ async function main() {
6873 statusMatricula : "INADIMPLENTE" as const ,
6974 } ,
7075 {
71- id : "3" ,
76+ id : alunoIds [ 2 ] ,
7277 nomeCompleto : "Carla Dias" ,
7378 cpf : "333.444.555-66" ,
7479 email : "carla.dias@example.com" ,
@@ -87,24 +92,24 @@ async function main() {
8792 // 5. Treinos
8893 await prisma . treino . create ( {
8994 data : {
90- id : "t1" ,
91- alunoId : "1" ,
92- instrutorId : "func1" ,
95+ id : crypto . randomUUID ( ) ,
96+ alunoId : alunoIds [ 0 ] ,
97+ instrutorId : instrutorId ,
9398 objetivo : "Treino A - Superiores (Ênfase Peito/Ombro)" ,
9499 diaSemana : 1 ,
95100 dataCriacao : new Date ( "2024-01-15" ) ,
96101 Exercicios : {
97102 create : [
98103 {
99- id : "ex1" ,
104+ id : crypto . randomUUID ( ) ,
100105 nomeExercicio : "Supino Reto com Barra" ,
101106 series : 4 ,
102107 repeticoes : "8-10" ,
103108 observacoes : "Controlar a descida." ,
104109 descricao : "Deite-se em um banco reto..." ,
105110 } ,
106111 {
107- id : "ex2" ,
112+ id : crypto . randomUUID ( ) ,
108113 nomeExercicio : "Desenvolvimento Militar com Barra" ,
109114 series : 3 ,
110115 repeticoes : "10-12" ,
0 commit comments