Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/andrespaul123/micole-flutter/llms.txt

Use this file to discover all available pages before exploring further.

In Mi Cole, courses (Curso) represent grade levels or year groups—for example Primero de Bachillerato or Séptimo de Básica. Each course is associated with an academic period and can be divided into one or more sections (Paralelo), such as Paralelo A, Paralelo B, or Vespertino. This two-level hierarchy lets a school manage multiple classrooms within the same grade, each with its own teacher assignments and timetable.

Curso Model

class Curso {
  final int?    id;
  final String? nombre;
  final String? nivel;
  final String? descripcion;
  final bool?   estado;
  final int?    tenantId;

  Curso({
    this.id,
    this.nombre,
    this.nivel,
    this.descripcion,
    this.estado,
    this.tenantId,
  });

  factory Curso.fromJson(Map<String, dynamic> json) {
    return Curso(
      id:          json['id'],
      nombre:      json['nombre'],
      nivel:       json['nivel'],
      descripcion: json['descripcion'],
      estado:      json['estado'] == 1 || json['estado'] == true,
      tenantId:    json['tenant_id'],
    );
  }
}
id
int
required
Unique identifier for the course.
nombre
String
required
Display name, e.g. "Primero de Bachillerato".
nivel
String
required
Education level tag, e.g. "Bachillerato" or "Básica".
descripcion
String
Optional free-text description of the course.
estado
bool
Whether the course is currently active. Parsed from integer 1/0 or boolean.
tenantId
int
Tenant-scoping identifier, populated server-side.

CursoRepository

Courses are scoped to an academic period. All endpoints include the periodoId in the path.
class CursoRepository {
  final Dio _dio;
  CursoRepository(this._dio);

  // List all courses for a period
  Future<List<Curso>> getCursos(int periodoId) async {
    final response = await _dio.get('/periodos/$periodoId/cursos');
    return (response.data as List)
        .map((e) => Curso.fromJson(e))
        .toList();
  }

  // Create a new course within a period
  Future<Curso> createCurso({
    required int    periodoId,
    required String nombre,
    required String nivel,
    String?         descripcion,
  }) async {
    final response = await _dio.post(
      '/periodos/$periodoId/cursos',
      data: {
        'nombre':      nombre,
        'nivel':       nivel,
        'descripcion': descripcion,
      },
    );
    return Curso.fromJson(response.data);
  }

  // Delete a course
  Future<void> deleteCurso(int periodoId, int id) async {
    await _dio.delete('/periodos/$periodoId/cursos/$id');
  }
}
MethodEndpointDescription
getCursos(periodoId)GET /api/periodos/:id/cursosList courses for an academic period
createCurso(...)POST /api/periodos/:id/cursosCreate a course within an academic period
deleteCurso(periodoId, id)DELETE /api/periodos/:id/cursos/:cursoIdDelete a course

Paralelo Model

A Paralelo (section) belongs to a Curso and optionally embeds the full Curso object when returned from the API.
class Paralelo {
  final int?    id;
  final int?    cursoId;
  final String? nombre;
  final String? turno;
  final int?    capacidad;
  final int?    tenantId;
  final Curso?  curso;       // populated when included in API response

  Paralelo({
    this.id,
    this.cursoId,
    this.nombre,
    this.turno,
    this.capacidad,
    this.tenantId,
    this.curso,
  });

  factory Paralelo.fromJson(Map<String, dynamic> json) {
    return Paralelo(
      id:        json['id'],
      cursoId:   json['curso_id'],
      nombre:    json['nombre'],
      turno:     json['turno'],
      capacidad: json['capacidad'],
      tenantId:  json['tenant_id'],
      curso:     json['curso'] != null ? Curso.fromJson(json['curso']) : null,
    );
  }
}
id
int
required
Unique identifier for the section.
cursoId
int
required
Foreign key referencing the parent Curso.
nombre
String
required
Section label, e.g. "A", "B", or "Matutino".
turno
String
Shift descriptor such as "Matutino" or "Vespertino".
capacidad
int
Maximum number of students the section can hold.
tenantId
int
Tenant-scoping identifier, populated server-side.
curso
Curso
Embedded Curso object when the section is returned with course details included.

ParaleloRepository

Retrieves every section across all courses for the tenant.
Future<List<Paralelo>> getParalelos() async {
  final response = await _dio.get('/paralelos');
  return (response.data as List)
      .map((e) => Paralelo.fromJson(e))
      .toList();
}
Endpoint: GET /api/paralelos

Schedule Assignment

Each section (Paralelo) can be assigned a timetable. Directors navigate to the section’s schedule screen to view and manage the weekly time blocks. Endpoint: GET /api/asignacion-horario (for a paralelo) The HorarioCursoScreen is reached from the section list. It receives both cursoId and paraleloId as route parameters:
GoRoute(
  path: ':paraleloId/horario',
  builder: (_, state) {
    final cursoId    = int.parse(state.pathParameters['cursoId']!);
    final paraleloId = int.parse(state.pathParameters['paraleloId']!);
    return HorarioCursoScreen(cursoId: cursoId, paraleloId: paraleloId);
  },
),

App Routes

/cursos

List all courses for the active period (CursoListScreen).

/cursos/create

Create a new course (CursoCreateScreen).

/cursos/:cursoId/paralelos

List sections for a specific course (ParaleloListScreen).

/cursos/:cursoId/paralelos/create

Create a new section within a course (ParaleloCreateScreen).

/cursos/:cursoId/paralelos/:paraleloId/horario

View and assign the timetable for a section (HorarioCursoScreen).

Build docs developers (and LLMs) love