515 lines
11 KiB
JSON
515 lines
11 KiB
JSON
{
|
|
"schema_version": 1,
|
|
"diagram_type": "erd",
|
|
"meta": {
|
|
"title": "Personas y membresías",
|
|
"locale": "es",
|
|
"output": ".archify/erd-personas-membresias-20261103-120000/personas-membresias.html",
|
|
"quality_profile": "standard",
|
|
"repository": {
|
|
"url": "https://git.2pidev.com/jselesan/gruperly.git",
|
|
"link_mode": "local-only",
|
|
"revision": "d21e1c37302d8d3f2ff8b0af05f4df21284bffe3"
|
|
},
|
|
"views": [
|
|
{
|
|
"id": "membership",
|
|
"label": "Persona y membresía",
|
|
"focus": [
|
|
"people",
|
|
"attendees",
|
|
"groups"
|
|
],
|
|
"note": "Una persona del profe, una fila de attendees por cada grupo en el que está."
|
|
},
|
|
{
|
|
"id": "owner",
|
|
"label": "Todo cuelga del profe",
|
|
"focus": [
|
|
"users",
|
|
"groups",
|
|
"people",
|
|
"student_accounts"
|
|
],
|
|
"note": "Grupos, personas y cuentas de alumno tienen created_by_id al profe."
|
|
},
|
|
{
|
|
"id": "student_app",
|
|
"label": "Una cuenta por persona",
|
|
"focus": [
|
|
"student_accounts",
|
|
"student_account_people",
|
|
"people"
|
|
],
|
|
"note": "La cuenta se vincula a la persona, así ve todos sus grupos."
|
|
}
|
|
]
|
|
},
|
|
"layout": {
|
|
"mode": "grid",
|
|
"gapX": 72,
|
|
"gapY": 40
|
|
},
|
|
"entities": [
|
|
{
|
|
"id": "groups",
|
|
"label": "groups",
|
|
"tag": "grupos",
|
|
"row": 0,
|
|
"col": 0,
|
|
"width": 256,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/domain.prisma",
|
|
"line": 3,
|
|
"end_line": 32
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"type": "text",
|
|
"key": "pk"
|
|
},
|
|
{
|
|
"name": "name",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "description",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "days",
|
|
"type": "WeekDay[]"
|
|
},
|
|
{
|
|
"name": "time",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "capacity",
|
|
"type": "int?"
|
|
},
|
|
{
|
|
"name": "price",
|
|
"type": "numeric(10,2)?"
|
|
},
|
|
{
|
|
"name": "billing_type",
|
|
"type": "BillingType?"
|
|
},
|
|
{
|
|
"name": "due_day",
|
|
"type": "int?"
|
|
},
|
|
{
|
|
"name": "auto_payment_reminders",
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"name": "auto_reengagement",
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"name": "invite_token",
|
|
"type": "text?",
|
|
"key": "uk"
|
|
},
|
|
{
|
|
"name": "created_by_id",
|
|
"type": "text",
|
|
"key": "fk",
|
|
"references": "users.id"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "attendees",
|
|
"label": "attendees",
|
|
"sublabel": "membresía",
|
|
"tag": "membresías",
|
|
"row": 0,
|
|
"col": 1,
|
|
"width": 250,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/domain.prisma",
|
|
"line": 100,
|
|
"end_line": 125
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"type": "text",
|
|
"key": "pk"
|
|
},
|
|
{
|
|
"name": "group_id",
|
|
"type": "text",
|
|
"key": [
|
|
"fk",
|
|
"uk"
|
|
],
|
|
"references": "groups.id"
|
|
},
|
|
{
|
|
"name": "person_id",
|
|
"type": "text",
|
|
"key": [
|
|
"fk",
|
|
"uk"
|
|
],
|
|
"references": "people.id"
|
|
},
|
|
{
|
|
"name": "notify_token",
|
|
"type": "text?",
|
|
"key": "uk"
|
|
},
|
|
{
|
|
"name": "status",
|
|
"type": "AttendeeStatus"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "people",
|
|
"label": "people",
|
|
"sublabel": "persona del profe",
|
|
"tag": "personas",
|
|
"row": 0,
|
|
"col": 2,
|
|
"width": 250,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/domain.prisma",
|
|
"line": 75,
|
|
"end_line": 98
|
|
},
|
|
{
|
|
"path": "apps/backend/prisma/migrations/20261102180000_add_people/migration.sql",
|
|
"line": 155,
|
|
"label": "índice parcial"
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"type": "text",
|
|
"key": "pk"
|
|
},
|
|
{
|
|
"name": "created_by_id",
|
|
"type": "text",
|
|
"key": [
|
|
"fk",
|
|
"uk"
|
|
],
|
|
"references": "users.id"
|
|
},
|
|
{
|
|
"name": "full_name",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "email",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "phone",
|
|
"type": "text?",
|
|
"key": "uk"
|
|
},
|
|
{
|
|
"name": "guardian_name",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "guardian_phone",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "notes",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "users",
|
|
"label": "users",
|
|
"sublabel": "profesor",
|
|
"tag": "profesor",
|
|
"row": 1,
|
|
"col": 2,
|
|
"width": 250,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/auth.prisma",
|
|
"line": 3,
|
|
"end_line": 34
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"type": "text",
|
|
"key": "pk"
|
|
},
|
|
{
|
|
"name": "name",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "email",
|
|
"type": "text",
|
|
"key": "uk"
|
|
},
|
|
{
|
|
"name": "email_verified",
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"name": "image",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "onboarding_completed",
|
|
"type": "boolean"
|
|
},
|
|
{
|
|
"name": "country_code",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "plan_selected_at",
|
|
"type": "timestamp?"
|
|
},
|
|
{
|
|
"name": "transfer_alias",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "transfer_holder",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "student_account_people",
|
|
"label": "student_account_people",
|
|
"tag": "app de alumnos",
|
|
"row": 0,
|
|
"col": 3,
|
|
"width": 300,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/student-access.prisma",
|
|
"line": 40,
|
|
"end_line": 54
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "account_id",
|
|
"type": "text",
|
|
"key": [
|
|
"pk",
|
|
"fk"
|
|
],
|
|
"references": "student_accounts.id"
|
|
},
|
|
{
|
|
"name": "person_id",
|
|
"type": "text",
|
|
"key": [
|
|
"pk",
|
|
"fk"
|
|
],
|
|
"references": "people.id"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "student_accounts",
|
|
"label": "student_accounts",
|
|
"tag": "app de alumnos",
|
|
"row": 1,
|
|
"col": 3,
|
|
"width": 300,
|
|
"sources": [
|
|
{
|
|
"path": "apps/backend/prisma/models/student-access.prisma",
|
|
"line": 10,
|
|
"end_line": 38
|
|
}
|
|
],
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"type": "text",
|
|
"key": "pk"
|
|
},
|
|
{
|
|
"name": "name",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "recovery_email",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "recovery_email_verified_at",
|
|
"type": "timestamp?"
|
|
},
|
|
{
|
|
"name": "pending_recovery_email",
|
|
"type": "text?"
|
|
},
|
|
{
|
|
"name": "welcomed_at",
|
|
"type": "timestamp?"
|
|
},
|
|
{
|
|
"name": "created_by_id",
|
|
"type": "text",
|
|
"key": "fk",
|
|
"references": "users.id"
|
|
},
|
|
{
|
|
"name": "created_at",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "updated_at",
|
|
"type": "timestamp"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"relationships": [
|
|
{
|
|
"id": "attendee_group",
|
|
"from": "attendees",
|
|
"to": "groups",
|
|
"label": "en el grupo",
|
|
"fromCardinality": "many",
|
|
"fromOptional": true,
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "attendee_person",
|
|
"from": "attendees",
|
|
"to": "people",
|
|
"label": "membresía de",
|
|
"fromCardinality": "many",
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "person_owner",
|
|
"from": "people",
|
|
"to": "users",
|
|
"label": "del profe",
|
|
"fromCardinality": "many",
|
|
"fromOptional": true,
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "group_owner",
|
|
"from": "groups",
|
|
"to": "users",
|
|
"label": "dueño",
|
|
"fromCardinality": "many",
|
|
"fromOptional": true,
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "link_person",
|
|
"from": "student_account_people",
|
|
"to": "people",
|
|
"fromCardinality": "many",
|
|
"fromOptional": true,
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "link_account",
|
|
"from": "student_account_people",
|
|
"to": "student_accounts",
|
|
"fromCardinality": "many",
|
|
"toCardinality": "one"
|
|
},
|
|
{
|
|
"id": "account_owner",
|
|
"from": "student_accounts",
|
|
"to": "users",
|
|
"label": "creada por",
|
|
"fromCardinality": "many",
|
|
"fromOptional": true,
|
|
"toCardinality": "one"
|
|
}
|
|
],
|
|
"cards": [
|
|
{
|
|
"dot": "cyan",
|
|
"title": "Unicidad",
|
|
"items": [
|
|
"attendees: @@unique(group_id, person_id), una persona está una sola vez en cada grupo.",
|
|
"people_owner_phone_key: (created_by_id, phone) WHERE phone IS NOT NULL, índice parcial escrito a mano (Prisma no lo modela; el choque llega como P2002)."
|
|
]
|
|
},
|
|
{
|
|
"dot": "amber",
|
|
"title": "Qué es de quién",
|
|
"items": [
|
|
"people: contacto y notas; editarlos cambia en todos los grupos.",
|
|
"attendees: status y notify_token por grupo; asistencia, cuotas, alertas y mensajes cuelgan de esta fila (no dibujados).",
|
|
"El límite del plan cuenta personas con al menos una membresía ACTIVE."
|
|
]
|
|
},
|
|
{
|
|
"dot": "emerald",
|
|
"title": "Borrados",
|
|
"items": [
|
|
"Todas las FK son ON DELETE CASCADE.",
|
|
"Quitar la última membresía borra también la persona, y con ella el vínculo a la cuenta de alumno."
|
|
]
|
|
}
|
|
]
|
|
} |