Last deployment:

Turfi Platform Documentation

Official Turfi documentation portal for users, admins, and developers.

Back to support

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

columntypenullabledefaultnotes
age_groupstring \nullyesnullBase table field.
age_group_idstring \nullyesnullRelationship-bearing column.
club_idstring \nullyesnullRelationship-bearing column.
created_atstringnodatabase default or generatedBase table field.
genderstring \nullyesnullBase table field.
gender_idstring \nullyesnullRelationship-bearing column.
idstringnogenerated UUID defaultBase table field.
keystringnononeBase table field.
namestringnononeBase table field.
normalized_namestring \nullyesnullBase table field.
organization_idstringnononeRelationship-bearing column.
slugstring \nullyesnullBase table field.
statusstringnodatabase default or generatedLifecycle field when present.
updated_atstring \nullyesnullBase table field.

Foreign Keys

columnreferencestableon delete
age_group_ididage_groupsNO ACTION
club_ididclubsNO ACTION
gender_ididgendersNO ACTION
organization_ididorganizationsNO 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)

namepurpose
v_teamsCurated admin registry read model for teams.

3. Import Contract

Accepted Columns

  • key
  • name
  • slug
  • organization_key
  • organization
  • organization_id
  • club_key
  • club
  • club_id
  • age_group_key
  • age_group
  • age_group_id
  • gender_key
  • gender
  • gender_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

  • key
  • slug
  • organization_key
  • organization
  • organization_id
  • club_key
  • club
  • club_id
  • age_group_key
  • age_group
  • age_group_id
  • gender_key
  • gender
  • gender_id

Failure Rules

  • Missing name fails 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

labelfieldsource
Namenamev_teams.name / teams.name
Age Groupage_group_keyage_groups
Gendergender_keygenders
Statusstatusv_teams.status / teams.status
Clubclub_nameclubs.name
Organizationassociation_nameorganizations.name

Filters

filterfieldtype
Searchnametext substring
Organizationorganization_idselect
Clubclub_iddependent select
Age Groupage_group_idlookup select
Gendergender_idlookup select
Statusstatusselect

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.