mirror of
https://github.com/lucasrcsantana/story-generator.git
synced 2025-12-17 22:07:52 +00:00
fix: corrige tipos e testes
Some checks are pending
Docker Build and Push / build (push) Waiting to run
Some checks are pending
Docker Build and Push / build (push) Waiting to run
- Refatora interfaces do banco de dados com BaseEntity - Corrige conflitos de tipos em email, status e cover - Padroniza tipos de campos em todas as interfaces - Corrige erro no teste do WordHighlighter - Atualiza CHANGELOG.md
This commit is contained in:
parent
9b023e7ef9
commit
1ea1b3e841
13
CHANGELOG.md
13
CHANGELOG.md
@ -5,6 +5,19 @@ Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.
|
|||||||
O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
|
O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
|
||||||
e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).
|
e este projeto adere ao [Semantic Versioning](https://semver.org/lang/pt-BR/).
|
||||||
|
|
||||||
|
## [1.1.1] - 2024-01-17
|
||||||
|
|
||||||
|
### Técnico
|
||||||
|
- Refatoração das interfaces do banco de dados:
|
||||||
|
- Criada interface base `BaseEntity` para reduzir duplicação
|
||||||
|
- Corrigidos conflitos de tipos em `email`, `status` e `cover`
|
||||||
|
- Padronizados os tipos de campos em todas as interfaces
|
||||||
|
- Corrigidas as interfaces `ClassWithStudents` e `ClassWithStudentsAndStories`
|
||||||
|
- Melhorada a organização do código com herança de interfaces
|
||||||
|
- Corrigido erro no teste do `WordHighlighter`:
|
||||||
|
- Adicionada importação do `beforeEach` do Vitest
|
||||||
|
- Mantida a estrutura dos testes existentes
|
||||||
|
|
||||||
## [1.1.0] - 2024-01-17
|
## [1.1.0] - 2024-01-17
|
||||||
|
|
||||||
### Adicionado
|
### Adicionado
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { render, screen, fireEvent } from '@testing-library/react'
|
import { render, screen, fireEvent } from '@testing-library/react'
|
||||||
import { WordHighlighter } from './WordHighlighter'
|
import { WordHighlighter } from './WordHighlighter'
|
||||||
import { describe, it, expect, vi } from 'vitest'
|
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||||
import '@testing-library/jest-dom/vitest'
|
import '@testing-library/jest-dom/vitest'
|
||||||
|
|
||||||
describe('WordHighlighter', () => {
|
describe('WordHighlighter', () => {
|
||||||
|
|||||||
@ -1,37 +1,41 @@
|
|||||||
export interface School {
|
// Interfaces Base
|
||||||
|
export interface BaseEntity {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
|
||||||
address?: string;
|
|
||||||
phone?: string;
|
|
||||||
email?: string;
|
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Teacher {
|
export interface School extends BaseEntity {
|
||||||
id: string;
|
name: string;
|
||||||
|
email: string;
|
||||||
|
phone?: string;
|
||||||
|
address?: string;
|
||||||
|
city?: string;
|
||||||
|
state?: string;
|
||||||
|
zip_code?: string;
|
||||||
|
director_name?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Teacher extends BaseEntity {
|
||||||
school_id: string;
|
school_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
subject?: string;
|
subject?: string;
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Class {
|
export interface Class extends BaseEntity {
|
||||||
id: string;
|
|
||||||
school_id: string;
|
school_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
grade: string;
|
grade: string;
|
||||||
year: number;
|
year: number;
|
||||||
period?: string;
|
period?: string;
|
||||||
created_at: string;
|
students?: {
|
||||||
updated_at: string;
|
count: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Student {
|
export interface Student extends BaseEntity {
|
||||||
id: string;
|
|
||||||
class_id: string;
|
class_id: string;
|
||||||
school_id: string;
|
school_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -40,11 +44,8 @@ export interface Student {
|
|||||||
guardian_name?: string;
|
guardian_name?: string;
|
||||||
guardian_phone?: string;
|
guardian_phone?: string;
|
||||||
guardian_email?: string;
|
guardian_email?: string;
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
status?: string;
|
|
||||||
avatar_url?: string;
|
avatar_url?: string;
|
||||||
// Relacionamentos
|
status: 'active' | 'inactive';
|
||||||
class?: {
|
class?: {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@ -54,13 +55,60 @@ export interface Student {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
interests?: Interest[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TeacherClass {
|
export interface TeacherClass extends BaseEntity {
|
||||||
id: string;
|
|
||||||
teacher_id: string;
|
teacher_id: string;
|
||||||
class_id: string;
|
class_id: string;
|
||||||
created_at: string;
|
}
|
||||||
|
|
||||||
|
export interface StoryPage {
|
||||||
|
text: string;
|
||||||
|
image?: string;
|
||||||
|
audio?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Story extends BaseEntity {
|
||||||
|
student_id: string;
|
||||||
|
class_id: string;
|
||||||
|
school_id: string;
|
||||||
|
title: string;
|
||||||
|
theme: string;
|
||||||
|
content: {
|
||||||
|
pages: StoryPage[];
|
||||||
|
currentPage?: number;
|
||||||
|
lastModified?: string;
|
||||||
|
};
|
||||||
|
status: 'draft' | 'published' | 'archived';
|
||||||
|
cover: {
|
||||||
|
id: string;
|
||||||
|
image_url: string;
|
||||||
|
};
|
||||||
|
students?: {
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StoryRecording extends BaseEntity {
|
||||||
|
fluency_score: number;
|
||||||
|
pronunciation_score: number;
|
||||||
|
accuracy_score: number;
|
||||||
|
comprehension_score: number;
|
||||||
|
words_per_minute: number;
|
||||||
|
pause_count: number;
|
||||||
|
error_count: number;
|
||||||
|
self_corrections: number;
|
||||||
|
strengths: string[];
|
||||||
|
improvements: string[];
|
||||||
|
suggestions: string;
|
||||||
|
processed_at: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Interest extends BaseEntity {
|
||||||
|
student_id: string;
|
||||||
|
category: string;
|
||||||
|
items: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tipos para relacionamentos
|
// Tipos para relacionamentos
|
||||||
@ -77,7 +125,15 @@ export interface TeacherWithClassesAndStories extends Teacher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ClassWithStudents extends Class {
|
export interface ClassWithStudents extends Class {
|
||||||
students: Student[];
|
students: Student[] & { count: number };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StudentWithStories extends Student {
|
||||||
|
stories: Story[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ClassWithStudentsAndStories extends Class {
|
||||||
|
students: StudentWithStories[] & { count: number };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface base para School com relações
|
// Interface base para School com relações
|
||||||
@ -85,144 +141,16 @@ interface BaseSchoolWithRelations extends School {
|
|||||||
teachers: Teacher[];
|
teachers: Teacher[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface específica para School com Classes e Students
|
|
||||||
export interface SchoolWithClasses extends BaseSchoolWithRelations {
|
export interface SchoolWithClasses extends BaseSchoolWithRelations {
|
||||||
classes: ClassWithStudents[];
|
classes: ClassWithStudents[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface específica para School com Classes, Students e Stories
|
|
||||||
export interface SchoolWithClassesAndStories extends BaseSchoolWithRelations {
|
export interface SchoolWithClassesAndStories extends BaseSchoolWithRelations {
|
||||||
classes: ClassWithStudentsAndStories[];
|
classes: ClassWithStudentsAndStories[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removendo a interface duplicada e usando as novas interfaces específicas
|
|
||||||
export type SchoolWithRelations = SchoolWithClasses | SchoolWithClassesAndStories;
|
export type SchoolWithRelations = SchoolWithClasses | SchoolWithClassesAndStories;
|
||||||
|
|
||||||
export interface StoryPage {
|
|
||||||
text: string;
|
|
||||||
image?: string;
|
|
||||||
audio?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Story {
|
|
||||||
cover: any;
|
|
||||||
id: string;
|
|
||||||
student_id: string;
|
|
||||||
class_id: string;
|
|
||||||
school_id: string;
|
|
||||||
title: string;
|
|
||||||
theme: string;
|
|
||||||
content: {
|
|
||||||
pages: StoryPage[];
|
|
||||||
currentPage?: number;
|
|
||||||
lastModified?: string;
|
|
||||||
};
|
|
||||||
status: 'draft' | 'published' | 'archived';
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Atualizando a interface Student para incluir histórias
|
|
||||||
export interface StudentWithStories extends Student {
|
|
||||||
stories: Story[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Atualizando ClassWithStudents para incluir histórias dos alunos
|
|
||||||
export interface ClassWithStudentsAndStories extends Class {
|
|
||||||
students: StudentWithStories[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface StoryRecording {
|
|
||||||
id: string;
|
|
||||||
fluency_score: number;
|
|
||||||
pronunciation_score: number;
|
|
||||||
accuracy_score: number;
|
|
||||||
comprehension_score: number;
|
|
||||||
words_per_minute: number;
|
|
||||||
pause_count: number;
|
|
||||||
error_count: number;
|
|
||||||
self_corrections: number;
|
|
||||||
strengths: string[];
|
|
||||||
improvements: string[];
|
|
||||||
suggestions: string;
|
|
||||||
created_at: string;
|
|
||||||
processed_at: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Interest {
|
|
||||||
id: string;
|
|
||||||
student_id: string;
|
|
||||||
category: string;
|
|
||||||
items: string[];
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Student {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
avatar_url?: string;
|
|
||||||
class_id: string;
|
|
||||||
school_id: string;
|
|
||||||
status: 'active' | 'inactive';
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
interests?: Interest[];
|
|
||||||
class?: {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
grade: string;
|
|
||||||
};
|
|
||||||
school?: {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Story {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
content: string;
|
|
||||||
student_id: string;
|
|
||||||
status: 'draft' | 'published';
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
cover?: {
|
|
||||||
id: string;
|
|
||||||
image_url: string;
|
|
||||||
};
|
|
||||||
students?: {
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Class {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
grade: string;
|
|
||||||
school_id: string;
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
students?: {
|
|
||||||
count: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface School {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
phone?: string;
|
|
||||||
address?: string;
|
|
||||||
city?: string;
|
|
||||||
state?: string;
|
|
||||||
zip_code?: string;
|
|
||||||
director_name?: string;
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SchoolSettings {
|
export interface SchoolSettings {
|
||||||
name: string;
|
name: string;
|
||||||
email: string;
|
email: string;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user