52 lines
1.5 KiB
Go
Executable File
52 lines
1.5 KiB
Go
Executable File
package Model
|
|
|
|
import (
|
|
_ "fmt"
|
|
//database_SQL
|
|
"gorm.io/gorm"
|
|
//end_database_SQL
|
|
)
|
|
|
|
// database_SQL
|
|
type UserModel struct {
|
|
gorm.Model
|
|
ID uint `gorm:"column:id;primary_key"`
|
|
Name string `gorm:"column:name;unique_index"`
|
|
Email string `gorm:"column:email;unique_index"`
|
|
Password string `gorm:"column:password;not null"`
|
|
Role string `gorm:"column:role"`
|
|
UserDoctorID uint `gorm:"column:user_doctor_id"`
|
|
ExerciseCourses []ExerciseCourseModel `gorm:"many2many:rh_users_exercise_course;foreignKey:id;References:id"`
|
|
Courses []CourseModel `gorm:"many2many:rh_user_course;foreignKey:id;References:id"`
|
|
}
|
|
|
|
func (UserModel) TableName() string {
|
|
return "rh_users"
|
|
}
|
|
|
|
type UserCourseModel struct {
|
|
gorm.Model
|
|
IDUsers uint `gorm:"column:user_model_id"`
|
|
IDCourse uint `gorm:"column:course_model_id"`
|
|
Status int `gorm:"column:status"`
|
|
UserTimeCourse string `gorm:"column:user_time_course"`
|
|
}
|
|
|
|
func (UserCourseModel) TableName() string {
|
|
return "rh_user_course"
|
|
}
|
|
|
|
type UserExerciseCourseModel struct {
|
|
gorm.Model
|
|
IDUser uint `gorm:"column:user_model_id"`
|
|
IDExerciseCourse uint `gorm:"column:exercise_course_model_id"`
|
|
TimeUsers string `gorm:"column:time_users"`
|
|
Status int `gorm:"column:status"`
|
|
}
|
|
|
|
func (UserExerciseCourseModel) TableName() string {
|
|
return "rh_users_exercise_course"
|
|
}
|
|
|
|
//end_database_SQL
|