From 52d36fe9f688c5264a8dedc0fc7ab271f151c1ec Mon Sep 17 00:00:00 2001 From: Guillermo Arrieta Medina Date: Mon, 12 Jan 2026 11:58:31 -0600 Subject: [PATCH] tipos de domain sin hardcode (falta revisar PlanDatosSep) --- src/data/types/database.ts | 9 --- src/data/types/domain.ts | 162 ++++--------------------------------- src/types/supabase.ts | Bin 83080 -> 83020 bytes 3 files changed, 15 insertions(+), 156 deletions(-) delete mode 100644 src/data/types/database.ts diff --git a/src/data/types/database.ts b/src/data/types/database.ts deleted file mode 100644 index 4c0c381..0000000 --- a/src/data/types/database.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type Json = - | string - | number - | boolean - | null - | { [key: string]: Json } - | Json[]; - -export type Database = any; // ✅ Reemplaza por tipos generados (supabase gen types typescript) diff --git a/src/data/types/domain.ts b/src/data/types/domain.ts index 879d4d4..0c39eb5 100644 --- a/src/data/types/domain.ts +++ b/src/data/types/domain.ts @@ -1,5 +1,4 @@ import type { Enums, Tables } from "../../types/supabase"; -import type { Json } from "src/types/supabase"; export type UUID = string; @@ -11,18 +10,13 @@ export type TipoOrigen = Enums<"tipo_origen">; export type TipoAsignatura = Enums<"tipo_asignatura">; -export type TipoBibliografia = "BASICA" | "COMPLEMENTARIA"; -export type TipoFuenteBibliografia = "MANUAL" | "BIBLIOTECA"; +export type TipoBibliografia = Enums<"tipo_bibliografia">; +export type TipoFuenteBibliografia = Enums<"tipo_fuente_bibliografia">; -export type EstadoTareaRevision = "PENDIENTE" | "COMPLETADA" | "OMITIDA"; -export type TipoNotificacion = - | "PLAN_ASIGNADO" - | "ESTADO_CAMBIADO" - | "TAREA_ASIGNADA" - | "COMENTARIO" - | "OTRA"; +export type EstadoTareaRevision = Enums<"estado_tarea_revision">; +export type TipoNotificacion = Enums<"tipo_notificacion">; -export type TipoInteraccionIA = "GENERAR" | "MEJORAR_SECCION" | "CHAT" | "OTRA"; +export type TipoInteraccionIA = Enums<"tipo_interaccion_ia">; export type ModalidadEducativa = "Escolar" | "No escolarizada" | "Mixta"; export type DisenoCurricular = "Rígido" | "Flexible"; @@ -64,12 +58,7 @@ export type CarreraRow = Tables<"carreras">; export type EstructuraPlanRow = Tables<"estructuras_plan">; -export type EstructuraAsignatura = { - id: UUID; - nombre: string; - version: string | null; - definicion: Json; -}; +export type EstructuraAsignatura = Tables<"estructuras_asignatura">; export type EstadoPlanRow = Tables<"estados_plan">; export type PlanEstudioRow = Tables<"planes_estudio">; @@ -80,141 +69,20 @@ export type PlanEstudio = PlanEstudioRow & { estados_plan: EstadoPlanRow | null; }; -export type LineaPlan = { - id: UUID; - plan_estudio_id: UUID; - nombre: string; - orden: number; - area: string | null; - creado_en: string; - actualizado_en: string; -}; +export type LineaPlan = Tables<"lineas_plan">; -export type Asignatura = { - id: UUID; - plan_estudio_id: UUID; - estructura_id: UUID | null; +export type Asignatura = Tables<"asignaturas">; - facultad_propietaria_id: UUID | null; +export type BibliografiaAsignatura = Tables<"bibliografia_asignatura">; - codigo: string | null; - nombre: string; +export type CambioPlan = Tables<"cambios_plan">; - tipo: TipoAsignatura; - creditos: number; - horas_semana: number | null; +export type CambioAsignatura = Tables<"cambios_asignatura">; - numero_ciclo: number | null; - linea_plan_id: UUID | null; - orden_celda: number | null; +export type InteraccionIA = Tables<"interacciones_ia">; - datos: Json; - contenido_tematico: Json; +export type TareaRevision = Tables<"tareas_revision">; - tipo_origen: TipoOrigen | null; - meta_origen: Json; +export type Notificacion = Tables<"notificaciones">; - creado_por: UUID | null; - actualizado_por: UUID | null; - - creado_en: string; - actualizado_en: string; - - planes_estudio?: PlanEstudio | null; - estructuras_asignatura?: EstructuraAsignatura | null; -}; - -export type BibliografiaAsignatura = { - id: UUID; - asignatura_id: UUID; - tipo: TipoBibliografia; - cita: string; - tipo_fuente: TipoFuenteBibliografia; - biblioteca_item_id: string | null; - - creado_por: UUID | null; - creado_en: string; - actualizado_en: string; -}; - -export type CambioPlan = { - id: UUID; - plan_estudio_id: UUID; - cambiado_por: UUID | null; - cambiado_en: string; - tipo: "ACTUALIZACION_CAMPO" | "ACTUALIZACION_MAPA" | "OTRO"; - campo: string | null; - valor_anterior: Json | null; - valor_nuevo: Json | null; - interaccion_ia_id: UUID | null; -}; - -export type CambioAsignatura = { - id: UUID; - asignatura_id: UUID; - cambiado_por: UUID | null; - cambiado_en: string; - tipo: "ACTUALIZACION_CAMPO" | "ACTUALIZACION_MAPA" | "OTRO"; - campo: string | null; - valor_anterior: Json | null; - valor_nuevo: Json | null; - fuente: "HUMANO" | "IA" | null; - interaccion_ia_id: UUID | null; -}; - -export type InteraccionIA = { - id: UUID; - usuario_id: UUID | null; - plan_estudio_id: UUID | null; - asignatura_id: UUID | null; - - tipo: TipoInteraccionIA; - modelo: string | null; - temperatura: number | null; - - prompt: Json; - respuesta: Json; - - aceptada: boolean; - - conversacion_id: string | null; - ids_archivos: Json; - ids_vector_store: Json; - - creado_en: string; -}; - -export type TareaRevision = { - id: UUID; - plan_estudio_id: UUID; - asignado_a: UUID; - rol_id: UUID | null; - estado_id: UUID | null; - estatus: EstadoTareaRevision; - fecha_limite: string | null; - creado_en: string; - completado_en: string | null; -}; - -export type Notificacion = { - id: UUID; - usuario_id: UUID; - tipo: TipoNotificacion; - payload: Json; - leida: boolean; - creado_en: string; - leida_en: string | null; -}; - -export type Archivo = { - id: UUID; - ruta_storage: string; - nombre: string; - mime_type: string | null; - bytes: number | null; - subido_por: UUID | null; - subido_en: string; - temporal: boolean; - openai_file_id: string | null; - notas: string | null; -}; +export type Archivo = Tables<"archivos">; diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 8a4722874db4e20839da9040457a879eed367923..2d571a11e1e5eb3f4b46f16c86d24546b2cb67ab 100644 GIT binary patch delta 193 zcmeC^WIfZtx?xJz<_TFH+o#XdW@MZGL4uKInj)jY^aEOqDbpQf81<&_l45)?UBi&k zXS#tDqsR6F6~-7AA{9>uDh`PwHRMd-W4P; z-A#>AV*4Ex#wX0!Rc;5We8_^3n+`N3e)