Students
The gym’s student registry — mirrors apps/web’s Students page exactly.
health_declaration is LGPD-sensitive personal data (Lei 13.709/2018 art.
5º II); health_declaration_accepted records consent.
list_students
Section titled “list_students”List students for the caller’s org.
| Argument | Type | Required | Notes |
|---|---|---|---|
limit | number | no | default 50, max 200 |
offset | number | no | default 0 |
status | active | inactive | cancelled | no | filter |
Ordered by full_name ascending.
Each item keeps the existing student fields and adds four operational fields:
| Field | Type | Meaning |
|---|---|---|
whatsapp_number_configured | boolean | true when students.phone contains a non-empty value. |
whatsapp_number | string | null | The stored value, or null when it is not configured. |
payment_due_day_configured | boolean | true when an active contract contains due_day. |
payment_due_day | number | null | The configured day, or null when it is not configured. |
The payment day comes from contracts.due_day, not an invoice date. Cancelled
and expired contracts do not define the current payment day. If multiple active
contracts contain a day, the newest start_date wins. The newest created_at
wins the next tie. The ascending contract id wins the final tie.
A successful response makes false plus null mean not configured. If the
related data is unavailable, the tool returns an error. It does not report an
unknown value as not configured. The query uses the caller’s JWT and existing
RLS scope.
get_student
Section titled “get_student”| Argument | Type | Required |
|---|---|---|
id | uuid | yes |
create_student
Section titled “create_student”| Argument | Type | Required | Notes |
|---|---|---|---|
full_name | string | yes | |
phone | string | no | |
cpf | string | no | |
birth_date | string | no | YYYY-MM-DD |
status | active | inactive | cancelled | no | defaults to active |
emergency_contact_name | string | no | |
emergency_contact_phone | string | no | |
health_declaration | string | no | free text |
health_declaration_accepted | boolean | no | true stamps health_declaration_accepted_at now |
update_student
Section titled “update_student”Same fields as create_student, all optional (partial update), plus id
(required). Nullable fields accept null to clear. health_declaration_accepted: false clears the consent timestamp; omit to leave it unchanged.
delete_student
Section titled “delete_student”| Argument | Type | Required |
|---|---|---|
id | uuid | yes |
Fails if the student still has class_enrollments, check_ins, or
contracts rows (no cascading deletes).