Backend
Models
Data Models

Data Models

The application uses GORM for ORM and defines domain models in internal/models/. Models represent database tables and business entities.

Core Models

User (user.go)

Represents a user in the system.

Key Fields:

  • ID - Primary key
  • TelegramID - Unique Telegram ID
  • Username, FirstName, LastName - User identification
  • Email, EmailVerified - Email information
  • TwitterUsername, LinkedinUsername, GithubUsername - Social media
  • JobTitle, Organization - Professional information
  • Roles, Ecosystems, Topics - Arrays of strings
  • OnboardingCompleted, NotificationsEnabled - User preferences

Related Models:

  • ListUser - Simplified user for lists
  • ConnectedUser - User with connection info
  • UserProfileResponse - Full profile response with enrichment

Event (event.go)

Represents an event.

Key Fields:

  • ID - Primary key
  • Title, Slug - Event identification
  • ConferenceID, ConferenceSlug - Conference association
  • Date, StartTime, EndTime, Timezone - Timing
  • Status - Event status (upcoming, ongoing, past, cancelled)
  • ApprovalStatus - Approval status (pending, approved, rejected)
  • Format - Event format (in-person, online, hybrid)
  • LocationName, LocationAddress, LocationLat, LocationLng - Location
  • Capacity, CurrentAttendees, WaitlistCount - Capacity management
  • Sponsors - JSON array of sponsors
  • SocialSharing - Social sharing configuration

Related Models:

  • EventResponse - API response format
  • EventListResponse - List view format
  • EventCreateRequest - Create request
  • EventUpdateRequest - Update request

Conference (conference.go)

Represents a conference.

Key Fields:

  • ID - Primary key
  • Name, Slug - Conference identification
  • Description - Conference description
  • StartDate, EndDate - Conference dates
  • Location - Conference location
  • Image, Logo - Visual assets

Speaker (speaker.go)

Represents a speaker.

Key Fields:

  • ID - Primary key
  • Name, Slug - Speaker identification
  • Bio, Title - Speaker information
  • PhotoURL - Speaker photo
  • TwitterUsername, LinkedinUsername - Social media
  • ConferenceID - Conference association

Quest (quest.go)

Represents a quest in the gamification system.

Key Fields:

  • ID - Primary key (string)
  • Title, Subtitle, Description - Quest information
  • ConferenceID, ConferenceSlug - Conference association
  • Reward, RewardDescription, RewardImage - Reward information
  • Points, PointsDisabled - Points configuration
  • Deadline - Quest deadline
  • Featured - Featured flag
  • IsActive - Active status
  • RegistrationApprovalRequired - Approval requirement
  • KgenQuest - KGen quest flag

Related Models:

  • QuestWithProgress - Quest with user progress
  • QuestTask - Quest task definition
  • UserQuestTask - User's task completion
  • QuestRegistrationRequest - Registration request

Quest Task (quest.go)

Represents a task within a quest.

Key Fields:

  • ID - Primary key
  • QuestID - Parent quest
  • Type - Task type
  • Description, DetailDescription - Task description
  • Points - Points awarded
  • ActionType, ActionURL - Action configuration
  • VerificationType - Verification method
  • Repeatable, RepeatFrequency - Repeat configuration
  • StartDate, EndDate - Task availability
  • IsMandatory - Mandatory flag
  • ProofRequired - Proof requirement
  • Metadata - JSON metadata (quiz, poll, etc.)

Task Types:

  • twitter_follow - Follow on Twitter
  • twitter_like - Like a tweet
  • twitter_retweet - Retweet
  • twitter_comment - Comment on tweet
  • linkedin_follow - Follow on LinkedIn
  • poll - Poll task
  • quiz - Quiz task
  • custom - Custom task

Connection (connection.go)

Represents a connection between users.

Key Fields:

  • ID - Primary key
  • RequesterID - User who sent request
  • RecipientID - User who received request
  • Status - Connection status (pending, accepted, rejected)
  • Message - Connection message
  • CreatedAt, UpdatedAt - Timestamps

Notification (notification.go)

Represents a user notification.

Key Fields:

  • ID - Primary key
  • UserID - Target user
  • Title, Message - Notification content
  • Type - Notification type
  • Data - JSON payload
  • Clicked, Dismissed - Status flags
  • CreatedAt - Timestamp

Conference Attendee (conference_attendee.go)

Represents conference attendance.

Key Fields:

  • ID - Primary key
  • ConferenceID - Conference
  • UserID - User
  • Email - Attendee email
  • Status - Attendance status
  • RegisteredAt - Registration timestamp

Conference Agenda (conference_agenda.go)

Represents an agenda item.

Key Fields:

  • ID - Primary key
  • ConferenceID - Conference
  • Title, Description - Agenda item info
  • StartTime, EndTime - Time slot
  • SpeakerIDs - Associated speakers
  • Location - Location
  • Type - Agenda item type

Enrichment Models

Twitter Enrichment (twitter_enrichment.go)

Stores Twitter enrichment data.

Key Fields:

  • UserID - User
  • TopicExpertise - JSON field
  • ProjectAffiliations - JSON field
  • CryptoRole - Role in crypto
  • KeyStances - JSON field
  • CommunitySignals - JSON field
  • ActivityProfile - JSON field
  • Tags - JSON field

Crypto Enrichment (crypto_enrichment.go)

Stores crypto enrichment data.

Key Fields:

  • UserID - User
  • PrimaryChains - JSON field
  • ExpertiseAreas - JSON field
  • NetworkingPitch - Networking pitch
  • CollabInterests - JSON field
  • ProfileType - Profile type

LinkedIn Meta (linkedin_meta.go)

Stores LinkedIn metadata.

Key Fields:

  • UserID - User
  • Headline - LinkedIn headline
  • ProfilePic - Profile picture URL
  • Experiences - JSON array of experiences

Twitter Meta (twitter_meta.go)

Stores Twitter metadata.

Key Fields:

  • UserID - User
  • Username - Twitter username
  • Name - Display name
  • ProfilePic - Profile picture URL
  • Bio - Bio text
  • FollowersCount - Follower count

Model Relationships

User Relationships

  • Has many Connection (as requester or recipient)
  • Has many EventAttendee
  • Has many UserQuestTask
  • Has one TwitterEnrichment
  • Has one CryptoEnrichment

Event Relationships

  • Belongs to Conference (optional)
  • Has many EventAttendee
  • Has many Speaker (via SpeakerIDs array)

Quest Relationships

  • Belongs to Conference (optional)
  • Has many QuestTask
  • Has many UserQuestTask
  • Has many QuestRegistrationRequest

Conference Relationships

  • Has many Event
  • Has many ConferenceAttendee
  • Has many ConferenceAgenda
  • Has many Speaker

GORM Features Used

  1. Auto Timestamps: CreatedAt, UpdatedAt automatically managed
  2. JSON Fields: Complex data stored as JSONB
  3. Array Fields: PostgreSQL arrays for tags, roles, etc.
  4. Foreign Keys: Relationships via foreign keys
  5. Hooks: BeforeUpdate, BeforeCreate hooks
  6. Table Names: Custom table names via TableName() method

Model Validation

Models use struct tags for validation:

  • validate:"required" - Required field
  • validate:"email" - Email format
  • validate:"min=1,max=100" - Length constraints
  • validate:"oneof=value1 value2" - Enum values