Turfi Platform Documentation
Official Turfi documentation portal for users, admins, and developers.
Documentation Search
Search only within Turfi documentation pages.
C
Teams
Team registry contract.
Entity: Teams
1. Overview
- Team registry connecting clubs, organizations, participant classification, and downstream competition registration rules.
- Belongs to a club and organization.
- Uses age group and gender lookups.
- Participates in competitions through
team_competitions. - Visible at
/admin/data/registries/teams.
2. Database Schema
Columns
| column | type | nullable | default | notes | |
|---|---|---|---|---|---|
| age_group | string \ | null | yes | null | Base table field. |
| age_group_id | string \ | null | yes | null | Relationship-bearing column. |
| club_id | string \ | null | yes | null | Relationship-bearing column. |
| created_at | string | no | database default or generated | Base table field. | |
| gender | string \ | null | yes | null | Base table field. |
| gender_id | string \ | null | yes | null | Relationship-bearing column. |
| id | string | no | generated UUID default | Base table field. | |
| key | string | no | none | Base table field. | |
| name | string | no | none | Base table field. | |
| normalized_name | string \ | null | yes | null | Base table field. |
| organization_id | string | no | none | Relationship-bearing column. | |
| slug | string \ | null | yes | null | Base table field. |
| status | string | no | database default or generated | Lifecycle field when present. | |
| updated_at | string \ | null | yes | null | Base table field. |
Foreign Keys
| column | references | table | on delete |
|---|---|---|---|
| age_group_id | id | age_groups | NO ACTION |
| club_id | id | clubs | NO ACTION |
| gender_id | id | genders | NO ACTION |
| organization_id | id | organizations | NO ACTION |
Indexes
No migration-defined indexes were discovered in the checked-in SQL history for this table.
Constraints
- Unique: none discovered in checked-in migrations.
- Check: none discovered in checked-in migrations.
Triggers
No migration-defined triggers were discovered in the checked-in SQL history for this table.
Views (if any)
| name | purpose |
|---|---|
| v_teams | Curated admin registry read model for teams. |
3. Import Contract
Accepted Columns
keynameslugorganization_keyorganizationorganization_idclub_keyclubclub_idage_group_keyage_groupage_group_idgender_keygendergender_id
Resolution Rules
- Organization, club, gender, and age-group relationships support key-first resolution with slug/name fallback for non-suffixed fields.
- UI validation requires club and organization alignment before save.
Required Fields
name
Optional Fields
keyslugorganization_keyorganizationorganization_idclub_keyclubclub_idage_group_keyage_groupage_group_idgender_keygendergender_id
Failure Rules
- Missing
namefails immediately. - Unresolved club or organization values block safe persistence.
- Lookup mismatches for age group or gender go through mismatch handling before DB validation.
4. Frontend Registry Mapping
Grid Columns
| label | field | source |
|---|---|---|
| Name | name | v_teams.name / teams.name |
| Age Group | age_group_key | age_groups |
| Gender | gender_key | genders |
| Status | status | v_teams.status / teams.status |
| Club | club_name | clubs.name |
| Organization | association_name | organizations.name |
Filters
| filter | field | type |
|---|---|---|
| Search | name | text substring |
| Organization | organization_id | select |
| Club | club_id | dependent select |
| Age Group | age_group_id | lookup select |
| Gender | gender_id | lookup select |
| Status | status | select |
Display Logic
- Age group and gender render from lookup labels instead of raw ids.
- Changing organization in the UI clears the club filter to preserve club-organization consistency.
- Team forms validate that selected club and organization remain aligned.
5. Lifecycle Rules
- Teams are governed entities and use the protected delete flow.
- Lifecycle changes should preserve competition registrations and historical participation.
- Team organization is constrained by the selected club relationship in the frontend edit flow.