Files
base/internal/dto/overview.go
2026-04-10 18:25:21 +03:30

158 lines
6.5 KiB
Go

package dto
import "time"
// OverviewResponse is the dashboard response for authenticated users with a profile
type OverviewResponse struct {
Message string `json:"message"`
Data OverviewDataDTO `json:"data"`
}
type OverviewDataDTO struct {
Analytics AnalyticsDTO `json:"analytics"`
RecentlyJoined []FlatProfileDTO `json:"recently_joined"`
Assets []AssetResponse `json:"assets"`
CompletionPercent int `json:"completionPercent"`
Tasks TasksDTO `json:"tasks"`
}
// OverviewFetchedResponse matches "Overview fetched successfully" format (assets with content, cover_image, etc.)
type OverviewFetchedResponse struct {
Message string `json:"message"`
Data OverviewFetchedDataDTO `json:"data"`
}
type OverviewFetchedDataDTO struct {
Assets []OverviewAssetDTO `json:"assets"`
RecentlyJoined []FlatProfileDTO `json:"recently_joined"`
Analytics AnalyticsDTO `json:"analytics"`
}
// SpecialistOverviewFetchedDataDTO extends OverviewFetchedDataDTO with specialist's Profile, Skills, completionPercent, and tasks
type SpecialistOverviewFetchedDataDTO struct {
Assets []OverviewAssetDTO `json:"assets"`
RecentlyJoined []FlatProfileDTO `json:"recently_joined"`
Analytics AnalyticsDTO `json:"analytics"`
Profile *ProfileResponse `json:"profile,omitempty"`
Skills []SkillDTO `json:"skills,omitempty"`
CompletionPercent int `json:"completionPercent"`
Tasks TasksDTO `json:"tasks"`
}
// SpecialistOverviewFetchedResponse is the specialist overview response (includes Profile + Skills)
type SpecialistOverviewFetchedResponse struct {
Message string `json:"message"`
Data SpecialistOverviewFetchedDataDTO `json:"data"`
}
// OverviewAssetDTO is the full asset format for overview (content, cover_image, price, etc.)
type OverviewAssetDTO struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Content string `json:"content"`
AssetCategoryID string `json:"asset_category_id"`
AssetCategory *CategoryDTO `json:"asset_category"`
CoverImage string `json:"cover_image"`
Link string `json:"link"`
OwnerID string `json:"owner_id"`
ProfileID string `json:"profile_id"`
Profile interface{} `json:"profile"`
Price int `json:"price"`
Currency string `json:"currency"`
Status string `json:"status"`
Rating int `json:"rating"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type AnalyticsDTO struct {
TotalAssets int `json:"total_assets"`
TotalProfiles int `json:"total_profiles"`
}
// CategoryAssetsDTO groups assets under a category for discovery.
type CategoryAssetsDTO struct {
Category CategoryDTO `json:"category"`
Assets []OverviewAssetDTO `json:"assets"`
}
// CategoryAssetsPaginatedDTO groups paginated assets under a category.
type CategoryAssetsPaginatedDTO struct {
Category CategoryDTO `json:"category"`
Assets []OverviewAssetDTO `json:"assets"`
Total int `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
TotalPages int `json:"total_pages"`
}
// ListAssetsByCategoryResponse is the paginated API response for assets by category.
type ListAssetsByCategoryResponse struct {
Data ListAssetsByCategoryResponseData `json:"data"`
}
// ListAssetsByCategoryResponseData holds the categories with paginated assets.
type ListAssetsByCategoryResponseData struct {
Categories []CategoryAssetsPaginatedDTO `json:"categories"`
}
// AssetsByCategoryResponse is the API response for assets grouped by category (at least 6 per category).
type AssetsByCategoryResponse struct {
Message string `json:"message"`
Data AssetsByCategoryResponseData `json:"data"`
}
type AssetsByCategoryResponseData struct {
Categories map[string]CategoryAssetsDTO `json:"categories"`
}
type TasksDTO struct {
ProfileAction bool `json:"profile_action"`
AboutAction bool `json:"about_action"`
PublishAction bool `json:"publish_action"`
WorksAction bool `json:"works_action"`
SkillsAction bool `json:"skills_action"`
SocialAction bool `json:"social_action"`
}
// FlatProfileDTO is the flat profile format for recently_joined and similar lists
type FlatProfileDTO struct {
ID string `json:"id"`
ProfileHandle string `json:"profile_handle"`
Status string `json:"status"`
BackgroundImage string `json:"background_image"`
ProfilePicture string `json:"profile_picture"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
DisplayName string `json:"display_name"`
RoleID string `json:"role_id"`
Role RoleDTO `json:"role"`
CurrentCompany string `json:"current_company"`
ShortDescription string `json:"short_description"`
CTAEnabled bool `json:"cta_enabled"`
CTAAction string `json:"cta_action"`
ResumeLink string `json:"resume_link"`
About string `json:"about"`
ContactEmail string `json:"contact_email"`
Achievements map[string]AchievementItemDTO `json:"achievements"`
ContactPhone string `json:"contact_phone"`
Country string `json:"country"`
CustomRoles string `json:"custom_roles"`
RoleLevel string `json:"role_level"`
SocialLinks []SocialLinkDTO `json:"social_links"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HandleUpdatedAt time.Time `json:"handle_updated_at"`
}
type RoleDTO struct {
ID string `json:"ID"`
Name string `json:"Name"`
}
type AchievementItemDTO struct {
Value string `json:"value"`
Enabled bool `json:"enabled"`
}