191 lines
5.2 KiB
Go
191 lines
5.2 KiB
Go
package dto
|
|
|
|
import (
|
|
"base/pkg/validation"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type CreateProfileRequest struct {
|
|
Handle string `json:"handle"`
|
|
PageSectionOrder map[string]int `json:"page_section_order"`
|
|
Hero HeroDTO `json:"hero"`
|
|
About AboutDTO `json:"about"`
|
|
Skills []SkillDTO `json:"skills"`
|
|
Contact ContactDTO `json:"contact"`
|
|
PageSetting PageSettingDTO `json:"page_setting"`
|
|
}
|
|
|
|
func (*CreateProfileRequest) Schema() validation.Schema {
|
|
return validation.Schema{
|
|
"handle": validation.Rule{
|
|
Field: "handle",
|
|
Type: validation.ValidationTypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
type HeroDTO struct {
|
|
RoleID *uuid.UUID `json:"role_id"`
|
|
RoleLevel string `json:"role_level"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
Company string `json:"company"`
|
|
ShortDescription string `json:"short_description"`
|
|
ResumeLink string `json:"resume_link"`
|
|
CTAEnabled bool `json:"cta_enabled"`
|
|
Avatar string `json:"avatar"`
|
|
}
|
|
|
|
func (*HeroDTO) Schema() validation.Schema { return validation.Schema{} }
|
|
|
|
type AboutDTO struct {
|
|
ProfilePicture string `json:"profile_picture"`
|
|
About string `json:"about"`
|
|
Achievements []AchievementDTO `json:"achievements"`
|
|
}
|
|
|
|
type AchievementDTO struct {
|
|
Title string `json:"title"`
|
|
Value string `json:"value"`
|
|
Enabled bool `json:"enabled"`
|
|
}
|
|
|
|
type SkillDTO struct {
|
|
SkillName string `json:"skill_name"`
|
|
Level string `json:"level"`
|
|
}
|
|
|
|
type ContactDTO struct {
|
|
Email string `json:"email"`
|
|
Phone string `json:"phone"`
|
|
SocialLinks []SocialLinkDTO `json:"social_links"`
|
|
}
|
|
|
|
func (*ContactDTO) Schema() validation.Schema { return validation.Schema{} }
|
|
|
|
type SocialLinkDTO struct {
|
|
LinkType string `json:"link_type"`
|
|
Link string `json:"link"`
|
|
}
|
|
|
|
type PageSettingDTO struct {
|
|
VisibilityLevel string `json:"visibility_level"`
|
|
}
|
|
|
|
func (*PageSettingDTO) Schema() validation.Schema {
|
|
return validation.Schema{}
|
|
}
|
|
|
|
type UpdateProfileRequest struct {
|
|
ID string `uri:"id"`
|
|
Handle string `json:"handle"`
|
|
PageSectionOrder map[string]int `json:"page_section_order"`
|
|
Hero HeroDTO `json:"hero"`
|
|
About AboutDTO `json:"about"`
|
|
Skills []SkillDTO `json:"skills"`
|
|
Contact ContactDTO `json:"contact"`
|
|
PageSetting PageSettingDTO `json:"page_setting"`
|
|
}
|
|
|
|
func (*UpdateProfileRequest) Schema() validation.Schema {
|
|
return validation.Schema{
|
|
"id": validation.Rule{
|
|
Field: "id",
|
|
Type: validation.ValidationTypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
type GetProfileRequest struct {
|
|
ID string `uri:"id"`
|
|
}
|
|
|
|
func (*GetProfileRequest) Schema() validation.Schema {
|
|
return validation.Schema{
|
|
"id": validation.Rule{
|
|
Field: "id",
|
|
Type: validation.ValidationTypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
type GetProfileByHandleRequest struct {
|
|
Handle string `uri:"handle"`
|
|
}
|
|
|
|
func (*GetProfileByHandleRequest) Schema() validation.Schema {
|
|
return validation.Schema{
|
|
"handle": validation.Rule{
|
|
Field: "handle",
|
|
Type: validation.ValidationTypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
type ListProfilesRequest struct {
|
|
RoleID *uuid.UUID `form:"role_id"`
|
|
FirstName string `form:"first_name"`
|
|
LastName string `form:"last_name"`
|
|
Company string `form:"company"`
|
|
SkillName string `form:"skill_name"`
|
|
Page uint `form:"page"`
|
|
PageSize uint `form:"page_size"`
|
|
SortedBy string `form:"sorted_by"`
|
|
Ascending bool `form:"ascending"`
|
|
}
|
|
|
|
func (*ListProfilesRequest) Schema() validation.Schema {
|
|
return validation.Schema{}
|
|
}
|
|
|
|
type ProfileResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Handle string `json:"handle"`
|
|
PageSectionOrder map[string]int `json:"page_section_order"`
|
|
Hero HeroDTO `json:"hero"`
|
|
About AboutDTO `json:"about"`
|
|
Skills []SkillDTO `json:"skills"`
|
|
Contact ContactDTO `json:"contact"`
|
|
PageSetting PageSettingDTO `json:"page_setting"`
|
|
}
|
|
|
|
type ListProfilesResponse struct {
|
|
Profiles []ProfileResponse `json:"profiles"`
|
|
Total int `json:"total"`
|
|
Page uint `json:"page"`
|
|
PageSize uint `json:"page_size"`
|
|
}
|
|
|
|
type DeleteProfileRequest struct {
|
|
ID string `uri:"id"`
|
|
}
|
|
|
|
func (*DeleteProfileRequest) Schema() validation.Schema {
|
|
return validation.Schema{
|
|
"id": validation.Rule{
|
|
Field: "id",
|
|
Type: validation.ValidationTypeString,
|
|
Required: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
// SkillsUpdateRequest for PUT page-sections/skills
|
|
type SkillsUpdateRequest struct {
|
|
Skills []SkillDTO `json:"skills"`
|
|
}
|
|
|
|
func (*SkillsUpdateRequest) Schema() validation.Schema { return validation.Schema{} }
|
|
|
|
// PageSectionsResponse for GET page-sections (hero, contact, skills, page_section_order)
|
|
type PageSectionsResponse struct {
|
|
Hero HeroDTO `json:"hero"`
|
|
Contact ContactDTO `json:"contact"`
|
|
Skills []SkillDTO `json:"skills"`
|
|
PageSectionOrder map[string]int `json:"page_section_order"`
|
|
}
|