36 lines
1.4 KiB
Go
36 lines
1.4 KiB
Go
|
|
package models
|
||
|
|
|
||
|
|
import "time"
|
||
|
|
|
||
|
|
// ProfileQuestion سوالاتی که ادمین از پیش در پنل وارد میکند
|
||
|
|
// (مثلاً «بزرگترین درسی که از زندگی گرفتی چیه؟») و کاربر باید
|
||
|
|
// دقیقاً ۳ تا از آنها را انتخاب و برایش پاسخ بنویسد.
|
||
|
|
type ProfileQuestion struct {
|
||
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
||
|
|
Text string `gorm:"size:255;not null" json:"text"`
|
||
|
|
SortOrder int `gorm:"default:0;not null" json:"sort_order"`
|
||
|
|
IsActive bool `gorm:"default:true;not null" json:"is_active"`
|
||
|
|
CreatedAt time.Time `json:"created_at"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ProfileQuestion) TableName() string {
|
||
|
|
return "profile_questions"
|
||
|
|
}
|
||
|
|
|
||
|
|
// UserProfileAnswer پاسخ کاربر به یکی از سوالات انتخابی
|
||
|
|
type UserProfileAnswer struct {
|
||
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
||
|
|
UserID uint `gorm:"not null;uniqueIndex:idx_user_question" json:"user_id"`
|
||
|
|
QuestionID uint `gorm:"not null;uniqueIndex:idx_user_question" json:"question_id"`
|
||
|
|
Answer string `gorm:"type:text;not null" json:"answer"`
|
||
|
|
CreatedAt time.Time `json:"created_at"`
|
||
|
|
UpdatedAt time.Time `json:"updated_at"`
|
||
|
|
|
||
|
|
Question *ProfileQuestion `gorm:"foreignKey:QuestionID" json:"question,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (UserProfileAnswer) TableName() string {
|
||
|
|
return "user_profile_answers"
|
||
|
|
}
|