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 keyTelegramID- Unique Telegram IDUsername,FirstName,LastName- User identificationEmail,EmailVerified- Email informationTwitterUsername,LinkedinUsername,GithubUsername- Social mediaJobTitle,Organization- Professional informationRoles,Ecosystems,Topics- Arrays of stringsOnboardingCompleted,NotificationsEnabled- User preferences
Related Models:
ListUser- Simplified user for listsConnectedUser- User with connection infoUserProfileResponse- Full profile response with enrichment
Event (event.go)
Represents an event.
Key Fields:
ID- Primary keyTitle,Slug- Event identificationConferenceID,ConferenceSlug- Conference associationDate,StartTime,EndTime,Timezone- TimingStatus- Event status (upcoming, ongoing, past, cancelled)ApprovalStatus- Approval status (pending, approved, rejected)Format- Event format (in-person, online, hybrid)LocationName,LocationAddress,LocationLat,LocationLng- LocationCapacity,CurrentAttendees,WaitlistCount- Capacity managementSponsors- JSON array of sponsorsSocialSharing- Social sharing configuration
Related Models:
EventResponse- API response formatEventListResponse- List view formatEventCreateRequest- Create requestEventUpdateRequest- Update request
Conference (conference.go)
Represents a conference.
Key Fields:
ID- Primary keyName,Slug- Conference identificationDescription- Conference descriptionStartDate,EndDate- Conference datesLocation- Conference locationImage,Logo- Visual assets
Speaker (speaker.go)
Represents a speaker.
Key Fields:
ID- Primary keyName,Slug- Speaker identificationBio,Title- Speaker informationPhotoURL- Speaker photoTwitterUsername,LinkedinUsername- Social mediaConferenceID- Conference association
Quest (quest.go)
Represents a quest in the gamification system.
Key Fields:
ID- Primary key (string)Title,Subtitle,Description- Quest informationConferenceID,ConferenceSlug- Conference associationReward,RewardDescription,RewardImage- Reward informationPoints,PointsDisabled- Points configurationDeadline- Quest deadlineFeatured- Featured flagIsActive- Active statusRegistrationApprovalRequired- Approval requirementKgenQuest- KGen quest flag
Related Models:
QuestWithProgress- Quest with user progressQuestTask- Quest task definitionUserQuestTask- User's task completionQuestRegistrationRequest- Registration request
Quest Task (quest.go)
Represents a task within a quest.
Key Fields:
ID- Primary keyQuestID- Parent questType- Task typeDescription,DetailDescription- Task descriptionPoints- Points awardedActionType,ActionURL- Action configurationVerificationType- Verification methodRepeatable,RepeatFrequency- Repeat configurationStartDate,EndDate- Task availabilityIsMandatory- Mandatory flagProofRequired- Proof requirementMetadata- JSON metadata (quiz, poll, etc.)
Task Types:
twitter_follow- Follow on Twittertwitter_like- Like a tweettwitter_retweet- Retweettwitter_comment- Comment on tweetlinkedin_follow- Follow on LinkedInpoll- Poll taskquiz- Quiz taskcustom- Custom task
Connection (connection.go)
Represents a connection between users.
Key Fields:
ID- Primary keyRequesterID- User who sent requestRecipientID- User who received requestStatus- Connection status (pending, accepted, rejected)Message- Connection messageCreatedAt,UpdatedAt- Timestamps
Notification (notification.go)
Represents a user notification.
Key Fields:
ID- Primary keyUserID- Target userTitle,Message- Notification contentType- Notification typeData- JSON payloadClicked,Dismissed- Status flagsCreatedAt- Timestamp
Conference Attendee (conference_attendee.go)
Represents conference attendance.
Key Fields:
ID- Primary keyConferenceID- ConferenceUserID- UserEmail- Attendee emailStatus- Attendance statusRegisteredAt- Registration timestamp
Conference Agenda (conference_agenda.go)
Represents an agenda item.
Key Fields:
ID- Primary keyConferenceID- ConferenceTitle,Description- Agenda item infoStartTime,EndTime- Time slotSpeakerIDs- Associated speakersLocation- LocationType- Agenda item type
Enrichment Models
Twitter Enrichment (twitter_enrichment.go)
Stores Twitter enrichment data.
Key Fields:
UserID- UserTopicExpertise- JSON fieldProjectAffiliations- JSON fieldCryptoRole- Role in cryptoKeyStances- JSON fieldCommunitySignals- JSON fieldActivityProfile- JSON fieldTags- JSON field
Crypto Enrichment (crypto_enrichment.go)
Stores crypto enrichment data.
Key Fields:
UserID- UserPrimaryChains- JSON fieldExpertiseAreas- JSON fieldNetworkingPitch- Networking pitchCollabInterests- JSON fieldProfileType- Profile type
LinkedIn Meta (linkedin_meta.go)
Stores LinkedIn metadata.
Key Fields:
UserID- UserHeadline- LinkedIn headlineProfilePic- Profile picture URLExperiences- JSON array of experiences
Twitter Meta (twitter_meta.go)
Stores Twitter metadata.
Key Fields:
UserID- UserUsername- Twitter usernameName- Display nameProfilePic- Profile picture URLBio- Bio textFollowersCount- 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
- Auto Timestamps:
CreatedAt,UpdatedAtautomatically managed - JSON Fields: Complex data stored as JSONB
- Array Fields: PostgreSQL arrays for tags, roles, etc.
- Foreign Keys: Relationships via foreign keys
- Hooks:
BeforeUpdate,BeforeCreatehooks - Table Names: Custom table names via
TableName()method
Model Validation
Models use struct tags for validation:
validate:"required"- Required fieldvalidate:"email"- Email formatvalidate:"min=1,max=100"- Length constraintsvalidate:"oneof=value1 value2"- Enum values