From ca592cbb7034e8e7a9f52fd2629fa93aee95d99d Mon Sep 17 00:00:00 2001 From: Tatyana Date: Wed, 30 Jul 2025 11:37:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B1=D0=B5=D0=BA=D0=B5=D0=BD=D0=B4=20+=20=D0=91?= =?UTF-8?q?=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AuthController.go | 158 ++++++ app/Http/Controllers/CasbinRoleController.go | 124 +++++ app/Http/Controllers/DoctorController.go | 512 +++++++++++++++++++ app/Http/Controllers/HomeController.go | 35 ++ app/Http/Controllers/PacientController.go | 183 +++++++ app/Http/Controllers/ResPassController.go | 161 ++++++ app/Http/Controllers/UserController.go | 207 ++++++++ app/Http/Controllers/WelcomeController.go | 22 + app/Http/Middleware/JWTMiddleware.go | 49 ++ app/Http/Middleware/UserCasbinMiddleware.go | 54 ++ app/Model/CasbinRoleModel.go | 35 ++ app/Model/CourseModel.go | 53 ++ app/Model/ResPassUserModel.go | 23 + app/Model/UserModel.go | 51 ++ config/CasbinRole.go | 52 ++ config/Casbin_role_model.conf | 11 + config/Database.go | 183 +++++++ config/Function.go | 37 ++ go.mod | 79 +++ go.sum | 466 +++++++++++++++++ main.go | 129 +++++ package-lock.json | 280 ++++++++++ package.json | 1 + test/test_get.sh | 4 + test/test_get2.sh | 3 + test/test_post.sh | 6 + test/test_postl.sh | 5 + 27 files changed, 2923 insertions(+) create mode 100755 app/Http/Controllers/AuthController.go create mode 100755 app/Http/Controllers/CasbinRoleController.go create mode 100644 app/Http/Controllers/DoctorController.go create mode 100755 app/Http/Controllers/HomeController.go create mode 100644 app/Http/Controllers/PacientController.go create mode 100755 app/Http/Controllers/ResPassController.go create mode 100755 app/Http/Controllers/UserController.go create mode 100755 app/Http/Controllers/WelcomeController.go create mode 100644 app/Http/Middleware/JWTMiddleware.go create mode 100755 app/Http/Middleware/UserCasbinMiddleware.go create mode 100755 app/Model/CasbinRoleModel.go create mode 100644 app/Model/CourseModel.go create mode 100755 app/Model/ResPassUserModel.go create mode 100755 app/Model/UserModel.go create mode 100755 config/CasbinRole.go create mode 100755 config/Casbin_role_model.conf create mode 100755 config/Database.go create mode 100755 config/Function.go create mode 100755 go.mod create mode 100755 go.sum create mode 100755 main.go create mode 100644 test/test_get.sh create mode 100644 test/test_get2.sh create mode 100644 test/test_post.sh create mode 100644 test/test_postl.sh diff --git a/app/Http/Controllers/AuthController.go b/app/Http/Controllers/AuthController.go new file mode 100755 index 0000000..8cacf1f --- /dev/null +++ b/app/Http/Controllers/AuthController.go @@ -0,0 +1,158 @@ +package Controllers + +import ( + "larago/app/Model" + "larago/config" + "net/http" + "time" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" + "golang.org/x/crypto/bcrypt" +) + +func Auth(router *gin.RouterGroup) { + + router.POST("/signup", UsersRegistration) + router.POST("/signin", UsersLogin) + router.GET("/api/register", ApiViewUsersRegistration) + router.GET("/api/login", ApiViewUsersLogin) + router.GET("/api/signout", ApiLoginout) +} + +type PasswordValidation struct { + Name string `form:"name" json:"name" binding:"required,alphanum,min=4,max=255"` + Email string `form:"email" json:"email" binding:"required,email"` + Password string `form:"password" json:"password" binding:"required,min=8,max=255"` +} + +type LoginValidation struct { + Email string `form:"email" json:"email" binding:"required,email"` + Password string `form:"password"json:"password" binding:"required,min=8,max=255"` +} + +func UsersRegistration(c *gin.Context) { + + // Validate input + var input PasswordValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + bytePassword := []byte(input.Password) + + passwordHash, _ := bcrypt.GenerateFromPassword(bytePassword, bcrypt.DefaultCost) + + input.Password = string(passwordHash) + + // Create user + user := Model.UserModel{ + Name: input.Name, + Email: input.Email, + Password: input.Password, + } + + //Gorm_SQL + config.DB.Save(&user) + + token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "user_id": user.ID, + "user_email": user.Email, + "user_name": user.Name, + //session time + "exp": time.Now().Add(time.Hour * 1).Unix(), + }) + + tokenString, err := token.SignedString([]byte(config.EnvFunc("APP_KEYS"))) + + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + c.IndentedJSON(http.StatusOK, gin.H{ + "user_name": user.Name, + "user_email": user.Email, + "user_id": user.ID, + "token": tokenString, + }) + +} + +func UsersLogin(c *gin.Context) { + + // Validate input + var input LoginValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + var model Model.UserModel + + //Gorm_SQL + config.DB.Where("email = ?", input.Email).First(&model) + + bytePassword := []byte(input.Password) + + byteHashedPassword := []byte(model.Password) + + err := bcrypt.CompareHashAndPassword(byteHashedPassword, bytePassword) + + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{ + "success": false, + "error": "Password mismatch", + }) + return + } else { + + token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ + "user_id": model.ID, + "user_email": model.Email, + "user_name": model.Name, + "user_role": model.Role, + //session time + "exp": time.Now().Add(time.Hour * 1).Unix(), + }) + + tokenString, err := token.SignedString([]byte(config.EnvFunc("APP_KEYS"))) + + if err != nil { + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + return + } + c.IndentedJSON(http.StatusCreated, gin.H{ + "user_name": model.Name, + "user_email": model.Email, + "user_id": model.ID, + "user_role": model.Role, + "token": tokenString, + }) + + } + +} + +func ApiViewUsersRegistration(c *gin.Context) { + + c.IndentedJSON(http.StatusOK, gin.H{"message": "ok..."}) + + // RegisterAuth.vue +} + +func ApiViewUsersLogin(c *gin.Context) { + + c.IndentedJSON(http.StatusOK, gin.H{"message": "ok..."}) + + //LoginAuth.vue + +} + +func ApiLoginout(c *gin.Context) { + + c.IndentedJSON(http.StatusOK, gin.H{"message": "Signed out..."}) + +} diff --git a/app/Http/Controllers/CasbinRoleController.go b/app/Http/Controllers/CasbinRoleController.go new file mode 100755 index 0000000..04a21e1 --- /dev/null +++ b/app/Http/Controllers/CasbinRoleController.go @@ -0,0 +1,124 @@ +package Controllers + +import ( + "larago/app/Model" + "larago/config" + "net/http" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" +) + +func CasbinRole(router *gin.RouterGroup) { + + router.POST("/post_add", AddPostCasbinRole) + router.GET("/api/add", ApiAddCasbinRole) + router.GET("/api/list", ApiViewCasbinRole) + router.DELETE("/api/list/:id/delete", ApiDeleteCasbinRole) + +} + +type CasbinRoleAddValidation struct { + RoleName string `form:"rolename" json:"rolename" binding:"required"` + Path string `form:"path" json:"path" binding:"required"` + Method string `form:"method" json:"method" binding:"required"` +} + +func AddPostCasbinRole(c *gin.Context) { + // Validate input + var input CasbinRoleAddValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + role_c := Model.CasbinRoleConf{ + Ptype: "p", + RoleName: input.RoleName, + Path: input.Path, + Method: input.Method, + } + + config.DB.Save(&role_c) + + // Create role + role := Model.CasbinRoleModel{ + RoleName: input.RoleName, + Path: input.Path, + Method: input.Method, + } + + //Gorm_SQL + config.DB.Save(&role) + + c.IndentedJSON(http.StatusCreated, role) +} + +func ApiViewCasbinRole(c *gin.Context) { + + //Gorm_SQL + var model []Model.CasbinRoleModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + config.DB.Find(&model) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + "list": model, + }) + + //CasbinroleList.vue + +} + +func ApiAddCasbinRole(c *gin.Context) { + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + }) + + //CasbinroleAdd.vue + +} + +func ApiDeleteCasbinRole(c *gin.Context) { + + var model Model.CasbinRoleModel + var model_conf Model.CasbinRoleConf + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Where("v0 = ?", model.RoleName).Where("v1 = ?", model.Path).Where("v2 = ?", model.Method).First(&model_conf) + + config.DB.Delete(&model_conf) + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} diff --git a/app/Http/Controllers/DoctorController.go b/app/Http/Controllers/DoctorController.go new file mode 100644 index 0000000..c2bf166 --- /dev/null +++ b/app/Http/Controllers/DoctorController.go @@ -0,0 +1,512 @@ +package Controllers + +import ( + "larago/app/Model" + "larago/config" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" + + "net/http" +) + +func Doctor(router *gin.RouterGroup) { + + router.GET("/api", ApiViewDoctor) + //Exercises + router.GET("/exercises", Exercises) + router.POST("/exercise/add", ExercisesAdd) + router.GET("/exercise/:id", ExercisesPrev) + router.PATCH("/exercise/:id", ExercisesEdit) + router.DELETE("/exercise/:id", ExercisesDelete) + //Courses + router.GET("/courses", Courses) + router.POST("/course/add", CoursesAdd) + router.GET("/course/:id", CourcesPrev) + router.PATCH("/course/:id", CourseEdit) + router.DELETE("/course/:id", CoursesDelete) + router.POST("/course-ex/:id/exercise-add", CoursesAddExerciseCourse) + router.DELETE("/course-ex/:course_id/:exercis_id/exercise-delete", CoursesDeleteExerciseCourse) + //Courses_Pacients + router.GET("/pacients", PacientsCourses) + router.GET("/pacient/:id", PacientPrev) + router.PATCH("/pacient/:id", PacientEdit) + router.POST("/pacient-cr/:id/course-add", PacientAddCourse) + router.DELETE("/pacient-cr/:pacient_id/:course_id/exercise-delete", PacientDeleteCourse) + +} + +type PacientCourseAddValidation struct { + IDCourse uint `form:"IDCourse" json:"IDCourse" binding:"required"` +} +type CoursesExerciseAddValidation struct { + Day int `form:"Day" json:"Day" binding:"required"` + Position int `form:"Position" json:"Position" binding:"required"` + Time string `form:"Time" json:"Time" binding:"required"` + IDExercise uint `form:"IDExercise" json:"IDExercise" binding:"required"` +} +type PacinetDoctorValidation struct { + UserDoctorID uint `form:"UserDoctorID" json:"UserDoctorID" binding:"required"` +} +type CoursesAddValidation struct { + Title string `form:"Title" json:"Title" binding:"required"` + Desc string `form:"Desc" json:"Desc" binding:"required"` + URLFileImg string `form:"URLFileImg" json:"URLFileImg"` +} +type ExercisesAddValidation struct { + Title string `form:"Title" json:"Title" binding:"required"` + Desc string `form:"Desc" json:"Desc" binding:"required"` + URLFile string `form:"URLFile" json:"URLFile" binding:"required"` + URLFileImg string `form:"URLFileImg" json:"URLFileImg"` +} + +func PacientPrev(c *gin.Context) { // Get model if exist + + var model Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).Preload("Courses").First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "ID": model.ID, + "Name": model.Name, + "Email": model.Email, + "CoursePacient": model.Courses, + }) + +} +func Courses(c *gin.Context) { + + var model_courses []Model.CourseModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + config.DB.Find(&model_courses) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "Courses": model_courses, + }) + +} +func PacientsCourses(c *gin.Context) { + + var model_courses []Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + config.DB.Preload("Courses").Find(&model_courses) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "Courses": model_courses, + }) + +} +func Exercises(c *gin.Context) { + + var model_exercises []Model.ExerciseModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + config.DB.Find(&model_exercises) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "Exercises": model_exercises, + }) + +} + +func CoursesAdd(c *gin.Context) { + // Validate input + var input CoursesAddValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + course_add := Model.CourseModel{ + Title: input.Title, + Desc: input.Desc, + URLFileImg: input.URLFileImg, + } + + //Gorm_SQL + config.DB.Save(&course_add) + + c.IndentedJSON(http.StatusCreated, course_add) + +} +func CoursesAddExerciseCourse(c *gin.Context) { + // Validate input + var input CoursesExerciseAddValidation + + var model Model.CourseModel + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + course_exercise := Model.ExerciseCourseModel{ + IDCourse: model.ID, + IDExercise: input.IDExercise, + Day: input.Day, + Position: input.Position, + Time: input.Time, + } + + //Gorm_SQL + config.DB.Save(&course_exercise) + + c.IndentedJSON(http.StatusCreated, course_exercise) + +} +func PacientAddCourse(c *gin.Context) { + // Validate input + var input PacientCourseAddValidation + + var model Model.UserModel + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + course_pacient := Model.UserCourseModel{ + IDUsers: model.ID, + IDCourse: input.IDCourse, + } + + //Gorm_SQL + config.DB.Save(&course_pacient) + + c.IndentedJSON(http.StatusCreated, course_pacient) + +} +func ExercisesAdd(c *gin.Context) { + // Validate input + var input ExercisesAddValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + exercise_add := Model.ExerciseModel{ + Title: input.Title, + Desc: input.Desc, + URLFile: input.URLFile, + URLFileImg: input.URLFileImg, + } + + //Gorm_SQL + config.DB.Save(&exercise_add) + + c.IndentedJSON(http.StatusCreated, exercise_add) + +} +func ExercisesPrev(c *gin.Context) { // Get model if exist + + var model Model.ExerciseModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "ID": model.ID, + "Title": model.Title, + "Desc": model.Desc, + "URLFile": model.URLFile, + "URLFileImg": model.URLFileImg, + }) + +} +func CourcesPrev(c *gin.Context) { // Get model if exist + + var model Model.CourseModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).Preload("Exercises").First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "ID": model.ID, + "Title": model.Title, + "Desc": model.Desc, + "URLFileImg": model.URLFileImg, + "CourseExercises": model.Exercises, + }) + +} +func ExercisesEdit(c *gin.Context) { + + //Gorm_SQL + var model Model.ExerciseModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + // Validate input + var input ExercisesAddValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + //Gorm_SQL + config.DB.Model(&model).Select( + "title", + "desc", + "url_file", + "url_file_img", + ).Updates(Model.ExerciseModel{ + Title: input.Title, + Desc: input.Desc, + URLFile: input.URLFile, + URLFileImg: input.URLFileImg, + }) + + c.IndentedJSON(http.StatusOK, model) + +} +func CourseEdit(c *gin.Context) { + + //Gorm_SQL + var model Model.CourseModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + // Validate input + var input CoursesAddValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + //Gorm_SQL + config.DB.Model(&model).Select( + "title", + "desc", + "url_file_img", + ).Updates(Model.ExerciseModel{ + Title: input.Title, + Desc: input.Desc, + URLFileImg: input.URLFileImg, + }) + + c.IndentedJSON(http.StatusOK, model) + +} +func PacientEdit(c *gin.Context) { + + //Gorm_SQL + var model Model.UserModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + // Validate input + var input PacinetDoctorValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + //Gorm_SQL + config.DB.Model(&model).Select( + "user_doctor_id", + ).Updates(Model.UserModel{ + UserDoctorID: input.UserDoctorID, + }) + + c.IndentedJSON(http.StatusOK, model) + +} +func ExercisesDelete(c *gin.Context) { + + var model_course_exercise Model.ExerciseCourseModel + + if err := config.DB.Where("IDExercise = ?", c.Param("id")).First(&model_course_exercise).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model_course_exercise) + //Gorm_SQL + var model Model.ExerciseModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} +func CoursesDelete(c *gin.Context) { + + var model_course_exercise Model.ExerciseCourseModel + + if err := config.DB.Where("IDCourse = ?", c.Param("id")).First(&model_course_exercise).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model_course_exercise) + //Gorm_SQL + var model Model.CourseModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} +func CoursesDeleteExerciseCourse(c *gin.Context) { + + //Gorm_SQL + var model Model.ExerciseCourseModel + + if err := config.DB.Where("IDCourse = ?", c.Param("course_id")).Where("IDExercise = ?", c.Param("exercis_id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} +func PacientDeleteCourse(c *gin.Context) { + + //Gorm_SQL + var model Model.UserCourseModel + + if err := config.DB.Where("IDUsers = ?", c.Param("pacient_id")).Where("IDCourse = ?", c.Param("course_id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} +func ApiViewDoctor(c *gin.Context) { + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + }) + + // DashboardAdmin.vue + +} diff --git a/app/Http/Controllers/HomeController.go b/app/Http/Controllers/HomeController.go new file mode 100755 index 0000000..da4207a --- /dev/null +++ b/app/Http/Controllers/HomeController.go @@ -0,0 +1,35 @@ +package Controllers + +import ( + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" + + "net/http" +) + +func Home(router *gin.RouterGroup) { + + router.GET("/api", ApiViewHome) + +} + +func ApiViewHome(c *gin.Context) { + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + }) + + // DashboardAdmin.vue + +} diff --git a/app/Http/Controllers/PacientController.go b/app/Http/Controllers/PacientController.go new file mode 100644 index 0000000..2470f52 --- /dev/null +++ b/app/Http/Controllers/PacientController.go @@ -0,0 +1,183 @@ +package Controllers + +import ( + "fmt" + "larago/app/Model" + "larago/config" + "strconv" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" + + "net/http" +) + +func Pacient(router *gin.RouterGroup) { + + router.GET("/api", ApiViewPacient) + router.GET("/courses", ApiPacientCourse) + router.GET("/:pacient_id/:course_id", ApiPacientCourseView) + router.GET("/:pacient_id/:course_id/:exercise_id", ApiPacientExerciseView) + router.POST("/:pacient_id/:course_id/:exercise_id", ApiPacientExercisePost) + +} + +type PacientStartExerciseValidation struct { + TimeUsers string `form:"TimeUsers" json:"TimeUsers" binding:"required"` +} + +func ApiPacientExercisePost(c *gin.Context) { + // Validate input + var user_course Model.UserCourseModel + var input PacientStartExerciseValidation + + if err := config.DB.Where("IDUsers = ?", c.Param("pacient_id")).Where("IDCourse = ?", c.Param("course_id")).First(&user_course).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + uint_pacient, err := strconv.ParseUint(c.Param("pacient_id"), 10, 0) + if err != nil { + fmt.Println("Ошибка преобразования pacient:", err) + return + } + uint_exercise, err := strconv.ParseUint(c.Param("exercise_id"), 10, 0) + if err != nil { + fmt.Println("Ошибка преобразования exercise:", err) + return + } + course_exercise := Model.UserExerciseCourseModel{ + IDUser: uint(uint_pacient), + IDExerciseCourse: uint(uint_exercise), + TimeUsers: input.TimeUsers, + } + + //Gorm_SQL + config.DB.Save(&course_exercise) + + c.IndentedJSON(http.StatusCreated, course_exercise) + +} +func ApiPacientExerciseView(c *gin.Context) { // Get model if exist + + var user_course Model.UserCourseModel + var model Model.ExerciseModel + var course_exercise Model.ExerciseCourseModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("IDUsers = ?", c.Param("pacient_id")).Where("IDCourse = ?", c.Param("course_id")).First(&user_course).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Where("id = ?", c.Param("exercise_id")).First(&model) + config.DB.Where("IDCourse = ?", c.Param("course_id")).Where("IDExercise = ?", c.Param("exercise_id")).First(&course_exercise) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "ID": model.ID, + "Title": model.Title, + "Desc": model.Desc, + "URLFileImg": model.URLFileImg, + "URLFile": model.URLFile, + "Day": course_exercise.Day, + "Position": course_exercise.Position, + "Time": course_exercise.Time, + }) + +} +func ApiPacientCourseView(c *gin.Context) { // Get model if exist + + var user_course Model.UserCourseModel + var model Model.CourseModel + var model_pacients Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("IDUsers = ?", c.Param("pacient_id")).Where("IDCourse = ?", c.Param("course_id")).First(&user_course).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Where("id = ?", c.Param("course_id")).Preload("Exercises").First(&model) + config.DB.Where("id = ?", c.Param("pacient_id")).Preload("Courses", "id = ?", c.Param("course_id")).Preload("ExerciseCourses", "IDUser = ?", c.Param("pacient_id")).First(&model_pacients) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "ID": model.ID, + "Title": model.Title, + "Desc": model.Desc, + "URLFileImg": model.URLFileImg, + "CourseExercises": model.Exercises, + "CoursePacient": model_pacients, + }) + +} +func ApiPacientCourse(c *gin.Context) { + + var model_courses []Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + config.DB.Preload("Courses").Find(&model_courses) + + c.IndentedJSON(http.StatusOK, gin.H{ + "SessionName": user_name, + "Courses": model_courses, + }) + +} +func ApiViewPacient(c *gin.Context) { + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + }) + + // DashboardAdmin.vue + +} diff --git a/app/Http/Controllers/ResPassController.go b/app/Http/Controllers/ResPassController.go new file mode 100755 index 0000000..83b88f4 --- /dev/null +++ b/app/Http/Controllers/ResPassController.go @@ -0,0 +1,161 @@ +package Controllers + +import ( + "crypto/tls" + "larago/app/Model" + "larago/config" + "net/http" + "strconv" + "time" + + "github.com/gin-gonic/gin" + "golang.org/x/crypto/bcrypt" + "gopkg.in/gomail.v2" +) + +func Res_pass(router *gin.RouterGroup) { + router.POST("/post_add", PostForgotPassword) + router.POST("/pass/:url/post", ViewRes_passListPost) + router.GET("/api/pass/:url", ApiViewRes_passListPrev) + router.GET("/api/forgot_password", ApiViewForgotPassword) +} + +type Res_passValidation struct { + Email string `form:"email" json:"email" binding:"required,email"` +} + +type Res_passPasswordValidation struct { + Password string `form:"password" json:"password" binding:"required,min=8,max=255"` +} + +func PostForgotPassword(c *gin.Context) { + // Validate input + var input Res_passValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + var model Model.UserModel + + if err := config.DB.Where("email = ?", input.Email).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Email not found!"}) + return + } + + rand_urls := config.RandomString(90) + + //smtp - forgot_password + + m := gomail.NewMessage() // E: undeclared name: gomail + m.SetHeader("From", config.EnvFunc("MAIL_USERNAME")) + m.SetHeader("To", input.Email) + m.SetHeader("Subject", "Password recovery") + m.SetBody("text/html", "Link to create a new password"+" "+config.EnvFunc("WWWROOT")+"/login/pass/"+rand_urls) + + mail_port, err := strconv.Atoi(config.EnvFunc("MAIL_PORT")) + + if err != nil { + panic(err) + } + + mail_encryption, err := strconv.ParseBool(config.EnvFunc("MAIL_ENCRYPTION")) + + if err != nil { + panic(err) + } + + d := gomail.NewDialer( + config.EnvFunc("MAIL_HOST"), + mail_port, + config.EnvFunc("MAIL_USERNAME"), + config.EnvFunc("MAIL_PASSWORD")) + + d.TLSConfig = &tls.Config{InsecureSkipVerify: mail_encryption} + + // Send the email. + if err := d.DialAndSend(m); err != nil { + panic(err) + } + + //Gorm_SQL + + url_res := Model.ResPassUserModel{ + Email: input.Email, + Url_full: config.EnvFunc("WWWROOT") + "/login/pass/" + rand_urls, + Url: rand_urls, + } + + config.DB.Save(&url_res) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) + + time.AfterFunc(30*time.Minute, func() { + + var model_url_del []Model.ResPassUserModel + + config.DB.Where("email = ?", input.Email).Find(&model_url_del) + config.DB.Delete(&model_url_del) + + }) +} + +func ViewRes_passListPost(c *gin.Context) { // Get model if exist + + var model Model.ResPassUserModel + var user_model Model.UserModel + + //Gorm_SQL + if err := config.DB.Where("url = ?", c.Param("url")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Where("email = ?", model.Email).Find(&user_model) + + var input Res_passPasswordValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + bytePassword := []byte(input.Password) + + passwordHash, _ := bcrypt.GenerateFromPassword(bytePassword, bcrypt.DefaultCost) + + input.Password = string(passwordHash) + + //Gorm_SQL + config.DB.Model(&user_model).Updates(Model.UserModel{Password: input.Password}) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) + +} + +func ApiViewForgotPassword(c *gin.Context) { + + c.IndentedJSON(http.StatusOK, gin.H{"mess": "ok"}) + + //ForgotPassword.vue + +} + +func ApiViewRes_passListPrev(c *gin.Context) { + + var model Model.ResPassUserModel + + //Gorm_SQL + if err := config.DB.Where("url = ?", c.Param("url")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + c.IndentedJSON(http.StatusOK, gin.H{ + "url": model.Url, + }) + + //ResetPassword.vue + +} diff --git a/app/Http/Controllers/UserController.go b/app/Http/Controllers/UserController.go new file mode 100755 index 0000000..efe85ce --- /dev/null +++ b/app/Http/Controllers/UserController.go @@ -0,0 +1,207 @@ +package Controllers + +import ( + "larago/app/Model" + "larago/config" + "net/http" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" + "golang.org/x/crypto/bcrypt" +) + +func UsersRegister(router *gin.RouterGroup) { + + router.POST("/post_add", UsersAddPost) + router.PATCH("/api/list/:id/edit", UpdateUsers) + router.GET("/api/list", ApiViewUsersList) + router.GET("/api/add", ApiViewAddUsers) + router.GET("/api/list/:id", ApiViewUsersListPrev) + router.DELETE("/api/list/:id/delete", ApiDeleteUsers) + +} + +type UsersValidation struct { + Name string `form:"name" json:"name" binding:"required,alphanum,min=4,max=255"` + Email string `form:"email" json:"email" binding:"required,email"` + Role string `form:"role" json:"role"` + Password string `form:"password" json:"password"` +} + +func UsersAddPost(c *gin.Context) { + // Validate input + var input UsersValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + bytePassword := []byte(input.Password) + + passwordHash, _ := bcrypt.GenerateFromPassword(bytePassword, bcrypt.DefaultCost) + + input.Password = string(passwordHash) + + // Create user + user := Model.UserModel{ + Name: input.Name, + Role: input.Role, + Email: input.Email, + Password: input.Password, + } + + //Gorm_SQL + config.DB.Save(&user) + + c.IndentedJSON(http.StatusCreated, user) + +} + +func UpdateUsers(c *gin.Context) { + + //Gorm_SQL + var model Model.UserModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + // Validate input + var input UsersValidation + + if err := c.ShouldBind(&input); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + return + } + + if len(input.Password) > 0 { + bytePassword := []byte(input.Password) + passwordHash, _ := bcrypt.GenerateFromPassword(bytePassword, bcrypt.DefaultCost) + input.Password = string(passwordHash) + //Gorm_SQL + config.DB.Model(&model).Select( + "name", + "email", + "role", + "password", + ).Updates(Model.UserModel{ + Name: input.Name, + Email: input.Email, + Role: input.Role, + Password: input.Password, + }) + } else { + //Gorm_SQL + config.DB.Model(&model).Select( + "name", + "email", + "role", + ).Updates(Model.UserModel{ + Name: input.Name, + Email: input.Email, + Role: input.Role, + }) + } + + c.IndentedJSON(http.StatusOK, model) + +} + +func ApiViewUsersList(c *gin.Context) { + + //Gorm_SQL + var model []Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + config.DB.Find(&model) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + "list": model, + }) + + //UsersList.vue + +} + +func ApiViewAddUsers(c *gin.Context) { // Get model if exist + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + }) + + //UsersAdd.vue + +} + +func ApiViewUsersListPrev(c *gin.Context) { // Get model if exist + + var model Model.UserModel + + claims, exists := c.Get("claims") + + if !exists { + c.IndentedJSON(http.StatusOK, gin.H{"redirect": "redirect_auth_login"}) + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_name := (*userClaims)["user_name"].(string) + + //Gorm_SQL + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.IndentedJSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + c.IndentedJSON(http.StatusOK, gin.H{ + "session_name": user_name, + "id": model.ID, + "name": model.Name, + "email": model.Email, + "role": model.Role, + }) + + //UsersListPrev.vue + +} + +func ApiDeleteUsers(c *gin.Context) { + + //Gorm_SQL + var model Model.UserModel + + if err := config.DB.Where("id = ?", c.Param("id")).First(&model).Error; err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Record not found!"}) + return + } + + config.DB.Delete(&model) + + c.IndentedJSON(http.StatusOK, gin.H{"data": true}) +} diff --git a/app/Http/Controllers/WelcomeController.go b/app/Http/Controllers/WelcomeController.go new file mode 100755 index 0000000..ceba31f --- /dev/null +++ b/app/Http/Controllers/WelcomeController.go @@ -0,0 +1,22 @@ +package Controllers + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +func Welcome(router *gin.RouterGroup) { + + router.GET("/", GetWelcome) + router.GET("/welcome", GetWelcome) + +} + +func GetWelcome(c *gin.Context) { + + c.IndentedJSON(http.StatusOK, gin.H{ + "larago": "ok", + }) + +} diff --git a/app/Http/Middleware/JWTMiddleware.go b/app/Http/Middleware/JWTMiddleware.go new file mode 100644 index 0000000..4faa7aa --- /dev/null +++ b/app/Http/Middleware/JWTMiddleware.go @@ -0,0 +1,49 @@ +package Middleware + +import ( + "larago/config" + "net/http" + "strings" + "time" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" +) + +var mySigningKey = []byte(config.EnvFunc("APP_KEYS")) + +func ValidateToken() gin.HandlerFunc { + + return func(c *gin.Context) { + tokenString := c.Request.Header.Get("Authorization") + if tokenString == "" { + c.JSON(http.StatusUnauthorized, gin.H{"error": "Missing token"}) + c.Abort() + return + } + + tokenString = strings.TrimPrefix(tokenString, "Bearer ") + + claims := &jwt.MapClaims{} + token, err := jwt.ParseWithClaims(tokenString, claims, func(token *jwt.Token) (interface{}, error) { + return mySigningKey, nil + }) + + if err != nil || !token.Valid { + c.JSON(http.StatusUnauthorized, gin.H{"error": "Invalid token"}) + c.Abort() + return + } + + if exp, ok := (*claims)["exp"].(float64); ok { + if time.Now().Unix() > int64(exp) { + c.JSON(http.StatusUnauthorized, gin.H{"error": "Token has expired"}) + c.Abort() + return + } + } + + c.Set("claims", claims) + c.Next() + } +} diff --git a/app/Http/Middleware/UserCasbinMiddleware.go b/app/Http/Middleware/UserCasbinMiddleware.go new file mode 100755 index 0000000..6da06b6 --- /dev/null +++ b/app/Http/Middleware/UserCasbinMiddleware.go @@ -0,0 +1,54 @@ +package Middleware + +import ( + "larago/config" + "net/http" + + "github.com/dgrijalva/jwt-go" + "github.com/gin-gonic/gin" +) + +func JWTAuthCasbinMiddleware(bool) gin.HandlerFunc { + return func(c *gin.Context) { + + claims, exists := c.Get("claims") + + if !exists { + c.Redirect(http.StatusFound, "/auth/login") + c.Abort() + } + + userClaims := claims.(*jwt.MapClaims) + + user_role := (*userClaims)["user_role"].(string) + //Casbinrole + e := config.CasbinRole() + + sub := user_role + obj := c.Request.URL.Path + act := c.Request.Method + + res, err := e.Enforce(sub, obj, act) + + if err != nil { + c.IndentedJSON(http.StatusInternalServerError, gin.H{ + "status": -1, + "error": "wrong information" + err.Error(), + }) + c.Abort() + return + } + + if res { + c.Next() + } else { + c.IndentedJSON(http.StatusOK, gin.H{ + "status": 0, + "error": "Sorry you do not have this permission", + }) + c.Abort() + return + } + + } +} diff --git a/app/Model/CasbinRoleModel.go b/app/Model/CasbinRoleModel.go new file mode 100755 index 0000000..03ce74b --- /dev/null +++ b/app/Model/CasbinRoleModel.go @@ -0,0 +1,35 @@ +package Model + +import ( + _ "fmt" + //database_SQL + "gorm.io/gorm" + //end_database_SQL +) + +// database_SQL +type CasbinRoleModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + RoleName string `gorm:"column:v0"` + Path string `gorm:"column:v1"` + Method string `gorm:"column:v2"` +} + +func (CasbinRoleModel) TableName() string { + return "rh_user_role" +} + +type CasbinRoleConf struct { + ID uint `gorm:"column:id;primary_key"` + Ptype string `gorm:"column:ptype"` + RoleName string `gorm:"column:v0"` + Path string `gorm:"column:v1"` + Method string `gorm:"column:v2"` +} + +func (CasbinRoleConf) TableName() string { + return "casbin_rule" +} + +//end_database_SQL diff --git a/app/Model/CourseModel.go b/app/Model/CourseModel.go new file mode 100644 index 0000000..06ab388 --- /dev/null +++ b/app/Model/CourseModel.go @@ -0,0 +1,53 @@ +package Model + +import ( + _ "fmt" + //database_SQL + "gorm.io/gorm" + //end_database_SQL +) + +// database_SQL +type CourseModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Title string `gorm:"column:title"` + Desc string `gorm:"column:desc"` + TimeCourse string `gorm:"column:time_course"` + DayCourse int `gorm:"column:Day_course"` + URLFileImg string `gorm:"column:url_file_img"` + Users []UserModel `gorm:"many2many:rh_user_course;foreignKey:id;References:id"` + Exercises []ExerciseModel `gorm:"many2many:rh_exercise_course;foreignKey:id;References:id"` +} + +func (CourseModel) TableName() string { + return "rh_course" +} + +type ExerciseModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Title string `gorm:"column:title"` + Desc string `gorm:"column:desc"` + URLFile string `gorm:"column:url_file"` + URLFileImg string `gorm:"column:url_file_img"` + Courses []CourseModel `gorm:"many2many:rh_exercise_course;foreignKey:id;References:id"` +} + +func (ExerciseModel) TableName() string { + return "rh_exercise" +} + +type ExerciseCourseModel struct { + gorm.Model + IDCourse uint `gorm:"column:exercise_model_id"` + IDExercise uint `gorm:"column:course_model_id"` + Day int `gorm:"column:day"` + Position int `gorm:"column:position"` + Time string `gorm:"column:time"` + Users []UserModel `gorm:"many2many:rh_users_exercise_course;foreignKey:id;References:id"` +} + +func (ExerciseCourseModel) TableName() string { + return "rh_exercise_course" +} diff --git a/app/Model/ResPassUserModel.go b/app/Model/ResPassUserModel.go new file mode 100755 index 0000000..e02bfc6 --- /dev/null +++ b/app/Model/ResPassUserModel.go @@ -0,0 +1,23 @@ +package Model + +import ( + _ "fmt" + //database_SQL + "gorm.io/gorm" + //end_database_SQL +) + +// database_SQL +type ResPassUserModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Email string `gorm:"column:email"` + Url string `gorm:"column:url"` + Url_full string `gorm:"column:url_full"` +} + +func (ResPassUserModel) TableName() string { + return "rh_res_pass_users" +} + +//end_database_SQL diff --git a/app/Model/UserModel.go b/app/Model/UserModel.go new file mode 100755 index 0000000..1a89629 --- /dev/null +++ b/app/Model/UserModel.go @@ -0,0 +1,51 @@ +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 diff --git a/config/CasbinRole.go b/config/CasbinRole.go new file mode 100755 index 0000000..44ed7a6 --- /dev/null +++ b/config/CasbinRole.go @@ -0,0 +1,52 @@ +package config + +import ( + "os" + + "github.com/casbin/casbin/v2" + gormadapter "github.com/casbin/gorm-adapter/v3" + "github.com/joho/godotenv" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +func CasbinRole() *casbin.Enforcer { + // Load environment variables + errenv := godotenv.Load() + if errenv != nil { + panic("Error loading .env file") + } + + DB_USERNAME := os.Getenv("DB_USERNAME") + DB_PASSWORD := os.Getenv("DB_PASSWORD") + DB_HOST := os.Getenv("DB_HOST") + DB_PORT := os.Getenv("DB_PORT") + DB_DATABASE := os.Getenv("DB_DATABASE") // Use the existing database name + + // Create a new adapter for the existing database, specifying the database name and dbSpecified + dsn := "host=" + DB_HOST + " user=" + DB_USERNAME + " password=" + DB_PASSWORD + " dbname=" + DB_DATABASE + " port=" + DB_PORT + " sslmode=disable TimeZone=Europe/Moscow" + db, errcasbindb := gorm.Open(postgres.Open(dsn), &gorm.Config{}) + gormadapter.TurnOffAutoMigrate(db) + a, err := gormadapter.NewAdapterByDBWithCustomTable(db, nil, "casbin_rule") + if errcasbindb != nil { + panic("Failed to connect databases: " + errcasbindb.Error()) + } + + if err != nil { + panic("Failed to create adapter: " + err.Error()) + } + // Create a new Casbin enforcer + e, errcasbin := casbin.NewEnforcer("config/Casbin_role_model.conf", a) + if errcasbin != nil { + panic("Failed to create Casbin enforcer: " + errcasbin.Error()) + } + + // Load the policy from the database + if err := e.LoadPolicy(); err != nil { + panic("Failed to load policy: " + err.Error()) + } + // Close the adapter when done + defer a.Close() + + return e +} diff --git a/config/Casbin_role_model.conf b/config/Casbin_role_model.conf new file mode 100755 index 0000000..4f86ba8 --- /dev/null +++ b/config/Casbin_role_model.conf @@ -0,0 +1,11 @@ +[request_definition] +r = sub, obj, act + +[policy_definition] +p = sub, obj, act + +[policy_effect] +e = some(where (p.eft == allow)) + +[matchers] +m = r.sub == p.sub && keyMatch(r.obj, p.obj) && regexMatch(r.act, p.act) \ No newline at end of file diff --git a/config/Database.go b/config/Database.go new file mode 100755 index 0000000..90a6cd9 --- /dev/null +++ b/config/Database.go @@ -0,0 +1,183 @@ +package config + +import ( + + //mysql + //"gorm.io/driver/mysql" + //postgres + + //sqlite + //"gorm.io/driver/sqlite" + //mssql + //"gorm.io/driver/sqlserver" + "os" + + "github.com/joho/godotenv" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +var DB *gorm.DB + +func Init() { + + //env + errenv := godotenv.Load() + if errenv != nil { + panic("Error loading .env file") + } + + DB_USERNAME := os.Getenv("DB_USERNAME") + DB_PASSWORD := os.Getenv("DB_PASSWORD") + DB_HOST := os.Getenv("DB_HOST") + DB_PORT := os.Getenv("DB_PORT") + DB_DATABASE := os.Getenv("DB_DATABASE") + + //mysql + //dsn := DB_USERNAME + ":" + DB_PASSWORD + "@tcp(" + DB_HOST + ":" + DB_PORT + ")/" + DB_DATABASE + "?charset=utf8mb4&parseTime=True&loc=Local" + //db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) + //postgres + dsn := "host=" + DB_HOST + " user=" + DB_USERNAME + " password=" + DB_PASSWORD + " dbname=" + DB_DATABASE + " port=" + DB_PORT + " sslmode=disable TimeZone=Europe/Moscow" + db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) + //sqlite + //db, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{}) + //mssql + //dsn := "sqlserver://"+DB_USERNAME+":"+DB_PASSWORD+"@"+DB_HOST+":"+DB_PORT+"?database="+DB_DATABASE + //db, err := gorm.Open(sqlserver.Open(dsn), &gorm.Config{}) + + if err != nil { + panic("Failed to connect to database!") + } + + // Migrations. + + db.AutoMigrate(&ExerciseCourseModel{}) + db.AutoMigrate(&UserExerciseCourseModel{}) + db.AutoMigrate(&UserCourseModel{}) + db.AutoMigrate(&UserModel{}) + db.AutoMigrate(&CourseModel{}) + db.AutoMigrate(&ExerciseModel{}) + db.AutoMigrate(&CasbinRoleModel{}) + db.AutoMigrate(&ResPassUserModel{}) + db.AutoMigrate(&CasbinRoleConf{}) + + //End Migrations. + + DB = db +} + +// Run the migrations. + +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 CourseModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Title string `gorm:"column:title"` + Desc string `gorm:"column:desc"` + TimeCourse string `gorm:"column:time_course"` + DayCourse int `gorm:"column:Day_course"` + URLFileImg string `gorm:"column:url_file_img"` + Users []UserModel `gorm:"many2many:rh_user_course;foreignKey:id;References:id"` + Exercises []ExerciseModel `gorm:"many2many:rh_exercise_course;foreignKey:id;References:id"` +} + +func (CourseModel) TableName() string { + return "rh_course" +} + +type ExerciseModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Title string `gorm:"column:title"` + Desc string `gorm:"column:desc"` + URLFile string `gorm:"column:url_file"` + URLFileImg string `gorm:"column:url_file_img"` + Courses []CourseModel `gorm:"many2many:rh_exercise_course;foreignKey:id;References:id"` +} + +func (ExerciseModel) TableName() string { + return "rh_exercise" +} + +type ExerciseCourseModel struct { + gorm.Model + Day int `gorm:"column:day"` + Position int `gorm:"column:position"` + Time string `gorm:"column:time"` + Users []UserModel `gorm:"many2many:rh_users_exercise_course;foreignKey:id;References:id"` +} + +func (ExerciseCourseModel) TableName() string { + return "rh_exercise_course" +} + +type UserCourseModel struct { + gorm.Model + 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 + TimeUsers string `gorm:"column:time_users"` + Status int `gorm:"column:status"` +} + +func (UserExerciseCourseModel) TableName() string { + return "rh_users_exercise_course" +} + +type CasbinRoleModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + RoleName string `gorm:"column:v0"` + Path string `gorm:"column:v1"` + Method string `gorm:"column:v2"` +} + +func (CasbinRoleModel) TableName() string { + return "rh_user_role" +} + +type ResPassUserModel struct { + gorm.Model + ID uint `gorm:"column:id;primary_key"` + Email string `gorm:"column:email"` + Url string `gorm:"column:url"` + Url_full string `gorm:"column:url_full"` +} + +func (ResPassUserModel) TableName() string { + return "rh_res_pass_users" +} + +type CasbinRoleConf struct { + ID uint `gorm:"column:id;primary_key"` + Ptype string `gorm:"column:ptype"` + RoleName string `gorm:"column:v0"` + Path string `gorm:"column:v1"` + Method string `gorm:"column:v2"` +} + +func (CasbinRoleConf) TableName() string { + return "casbin_rule" +} diff --git a/config/Function.go b/config/Function.go new file mode 100755 index 0000000..d523c71 --- /dev/null +++ b/config/Function.go @@ -0,0 +1,37 @@ +package config + +import ( + "math/rand" + "os" + "time" + + "github.com/joho/godotenv" +) + +func RandomString(n int) string { + + rand.Seed(time.Now().UnixNano()) + + var letter = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + + b := make([]rune, n) + + for i := range b { + b[i] = letter[rand.Intn(len(letter))] + } + + return string(b) +} + +func EnvFunc(env string) string { + + errenv := godotenv.Load() + + if errenv != nil { + panic("Error loading .env file") + } + + env = os.Getenv(env) + + return string(env) +} diff --git a/go.mod b/go.mod new file mode 100755 index 0000000..0b6e294 --- /dev/null +++ b/go.mod @@ -0,0 +1,79 @@ +module larago + +go 1.23.0 + +toolchain go1.23.11 + +require ( + github.com/casbin/casbin/v2 v2.60.0 + github.com/casbin/gorm-adapter/v3 v3.14.0 + github.com/gin-contrib/sessions v0.0.5 + github.com/gin-gonic/gin v1.10.1 + github.com/joho/godotenv v1.4.0 + github.com/utrack/gin-csrf v0.0.0-20190424104817-40fb8d2c8fca + golang.org/x/crypto v0.39.0 + gorm.io/driver/mysql v1.4.5 + gorm.io/gorm v1.24.3 +) + +require ( + github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect + github.com/bytedance/sonic v1.13.3 // indirect + github.com/bytedance/sonic/loader v0.2.4 // indirect + github.com/cloudwego/base64x v0.1.5 // indirect + github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9 // indirect + github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect + github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/gin-contrib/cors v1.7.6 // indirect + github.com/gin-contrib/sse v1.1.0 // indirect + github.com/glebarez/go-sqlite v1.19.1 // indirect + github.com/glebarez/sqlite v1.5.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.26.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/goccy/go-json v0.10.5 // indirect + github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect + github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/gorilla/context v1.1.1 // indirect + github.com/gorilla/securecookie v1.1.1 // indirect + github.com/gorilla/sessions v1.2.1 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.13.0 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgtype v1.12.0 // indirect + github.com/jackc/pgx/v4 v4.17.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/microsoft/go-mssqldb v0.17.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect + golang.org/x/arch v0.18.0 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/text v0.26.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect + gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/driver/postgres v1.4.4 // indirect + gorm.io/driver/sqlserver v1.4.1 // indirect + gorm.io/plugin/dbresolver v1.3.0 // indirect + modernc.org/libc v1.19.0 // indirect + modernc.org/mathutil v1.5.0 // indirect + modernc.org/memory v1.4.0 // indirect + modernc.org/sqlite v1.19.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100755 index 0000000..1220557 --- /dev/null +++ b/go.sum @@ -0,0 +1,466 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff/go.mod h1:+RTT1BOk5P97fT2CiHkbFQwkK3mjsFAP6zCYV2aXtjw= +github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= +github.com/bradleypeabody/gorilla-sessions-memcache v0.0.0-20181103040241-659414f458e1/go.mod h1:dkChI7Tbtx7H1Tj7TqGSZMOeGpMP5gLHtjroHd4agiI= +github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= +github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= +github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/casbin/casbin/v2 v2.55.1/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= +github.com/casbin/casbin/v2 v2.60.0 h1:ZmC0/t4wolfEsDpDxTEsu2z6dfbMNpc11F52ceLs2Eo= +github.com/casbin/casbin/v2 v2.60.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= +github.com/casbin/gorm-adapter/v3 v3.14.0 h1:zZ6AIiNHJZ3ntdf5RBrqD+0Cb4UO+uKFk79R9yJ7mpw= +github.com/casbin/gorm-adapter/v3 v3.14.0/go.mod h1:jqaf4bUITbCyMPUellaTd8IQJ77JfVAbe77gZZnx98w= +github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= +github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9 h1:74lLNRzvsdIlkTgfDSMuaPjBr4cf6k7pwQQANm/yLKU= +github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= +github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= +github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY= +github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk= +github.com/gin-contrib/sessions v0.0.0-20190101140330-dc5246754963/go.mod h1:4lkInX8nHSR62NSmhXM3xtPeMSyfiR58NaEz+om1lHM= +github.com/gin-contrib/sessions v0.0.5 h1:CATtfHmLMQrMNpJRgzjWXD7worTh7g7ritsQfmF+0jE= +github.com/gin-contrib/sessions v0.0.5/go.mod h1:vYAuaUPqie3WUSsft6HUlCjlwwoJQs97miaG2+7neKY= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= +github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/gin-gonic/gin v1.8.2 h1:UzKToD9/PoFj/V4rvlKqTRKnQYyz8Sc1MJlv4JHPtvY= +github.com/gin-gonic/gin v1.8.2/go.mod h1:qw5AYuDrzRTnhvusDsrov+fDIxp9Dleuu12h8nfB398= +github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= +github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/glebarez/go-sqlite v1.19.1 h1:o2XhjyR8CQ2m84+bVz10G0cabmG0tY4sIMiCbrcUTrY= +github.com/glebarez/go-sqlite v1.19.1/go.mod h1:9AykawGIyIcxoSfpYWiX1SgTNHTNsa/FVc75cDkbp4M= +github.com/glebarez/sqlite v1.5.0 h1:+8LAEpmywqresSoGlqjjT+I9m4PseIM3NcerIJ/V7mk= +github.com/glebarez/sqlite v1.5.0/go.mod h1:0wzXzTvfVJIN2GqRhCdMbnYd+m+aH5/QV7B30rM6NgY= +github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= +github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= +github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= +github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= +github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= +github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.13.0 h1:3L1XMNV2Zvca/8BYhzcRFS70Lr0WlDg16Di6SFGAbys= +github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.1 h1:nwj7qwf0S+Q7ISFfBndqeLwSwxs+4DPsbRFjECT1Y4Y= +github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.12.0 h1:Dlq8Qvcch7kiehm8wPGIW0W3KsCCHJnRacKW0UM8n5w= +github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.17.2 h1:0Ut0rpeKwvIVbMQ1KbMBU4h6wxehBI535LK6Flheh8E= +github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= +github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b/go.mod h1:g2nVr8KZVXJSS97Jo8pJ0jgq29P6H7dG0oplUA86MQw= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= +github.com/memcachier/mc v2.0.1+incompatible/go.mod h1:7bkvFE61leUBvXz+yxsOnGBQSZpBSPIMUQSmmSHvuXc= +github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= +github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= +github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= +github.com/utrack/gin-csrf v0.0.0-20190424104817-40fb8d2c8fca h1:lpvAjPK+PcxnbcB8H7axIb4fMNwjX9bE4DzwPjGg8aE= +github.com/utrack/gin-csrf v0.0.0-20190424104817-40fb8d2c8fca/go.mod h1:XXKxNbpoLihvvT7orUZbs/iZayg1n4ip7iJakJPAwA8= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc= +golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.3.2/go.mod h1:ChK6AHbHgDCFZyJp0F+BmVGb06PSIoh9uVYKAlRbb2U= +gorm.io/driver/mysql v1.4.1/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c= +gorm.io/driver/mysql v1.4.5 h1:u1lytId4+o9dDaNcPCFzNv7h6wvmc92UjNk3z8enSBU= +gorm.io/driver/mysql v1.4.5/go.mod h1:SxzItlnT1cb6e1e4ZRpgJN2VYtcqJgqnHxWr4wsP8oc= +gorm.io/driver/postgres v1.4.4 h1:zt1fxJ+C+ajparn0SteEnkoPg0BQ6wOWXEQ99bteAmw= +gorm.io/driver/postgres v1.4.4/go.mod h1:whNfh5WhhHs96honoLjBAMwJGYEuA3m1hvgUbNXhPCw= +gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0= +gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHDnJLig= +gorm.io/gorm v1.23.1/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.7/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= +gorm.io/gorm v1.24.3 h1:WL2ifUmzR/SLp85CSURAfybcHnGZ+yLSGSxgYXlFBHg= +gorm.io/gorm v1.24.3/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= +gorm.io/plugin/dbresolver v1.3.0 h1:uFDX3bIuH9Lhj5LY2oyqR/bU6pqWuDgas35NAPF4X3M= +gorm.io/plugin/dbresolver v1.3.0/go.mod h1:Pr7p5+JFlgDaiM6sOrli5olekJD16YRunMyA2S7ZfKk= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= +modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= +modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= +modernc.org/cc/v3 v3.38.1/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= +modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= +modernc.org/ccgo/v3 v3.0.0-20220910160915-348f15de615a/go.mod h1:8p47QxPkdugex9J4n9P2tLZ9bK01yngIVp00g4nomW0= +modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= +modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= +modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= +modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= +modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= +modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= +modernc.org/libc v1.19.0 h1:bXyVhGQg6KIClTr8FMVIDPl7jtbcs7aS5WP7vLDaxPs= +modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= +modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= +modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= +modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/memory v1.4.0 h1:crykUfNSnMAXaOJnnxcSzbUGMqkLWjklJKkBK2nwZwk= +modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= +modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= +modernc.org/sqlite v1.19.1 h1:8xmS5oLnZtAK//vnd4aTVj8VOeTAccEFOtUnIzfSw+4= +modernc.org/sqlite v1.19.1/go.mod h1:UfQ83woKMaPW/ZBruK0T7YaFCrI+IE0LeWVY6pmnVms= +modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= +modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= +modernc.org/tcl v1.14.0/go.mod h1:gQ7c1YPMvryCHCcmf8acB6VPabE59QBeuRQLL7cTUlM= +modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= +modernc.org/z v1.6.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= diff --git a/main.go b/main.go new file mode 100755 index 0000000..9c40d58 --- /dev/null +++ b/main.go @@ -0,0 +1,129 @@ +package main + +import ( + "larago/app/Http/Controllers" + "larago/app/Http/Middleware" + "larago/config" + + "github.com/gin-contrib/cors" + "github.com/gin-gonic/gin" + ///sessions_redis + //"github.com/gin-contrib/sessions/redis" + //end_sessions_redis + //sessions_cookie + //end_sessions_cookie + //Memcached + //"github.com/bradfitz/gomemcache/memcache" + //"github.com/gin-contrib/sessions/memcached" + //end_Memcached +) + +func main() { + + //database_SQL + config.Init() + //end_database_SQL + + //APP_KEYS := config.EnvFunc("APP_KEYS") + + //gin + //switch to "release" mode in production + + //gin.SetMode(gin.ReleaseMode) + + r := gin.Default() + + r.Use(cors.New(cors.Config{ + AllowOrigins: []string{"http://127.0.0.1", "http://127.0.0.1:5173"}, + AllowMethods: []string{"PUT", "GET", "POST", "PATCH", "OPTIONS"}, + AllowHeaders: []string{"Accept-Language", "Authorization", "Content-Language", "X-CSRF-Token", "X-XSRF-Token", "Origin", "X-Requested-With", "Content-Type", "Accept", "Access-Control-Allow-Origin"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: true, + })) + + //Trusted_proxies + //r.SetTrustedProxies([]string{"192.168.1.2"}) + //end_Trusted_proxies + + //sessions + + //sessions_cookie + //store := cookie.NewStore([]byte(APP_KEYS)) + //end_sessions_cookie + + //redis_sessions + //REDIS_HOST := config.EnvFunc("REDIS_HOST") + //REDIS_PASSWORD := config.EnvFunc("REDIS_PASSWORD") + //REDIS_PORT := config.EnvFunc("REDIS_PORT") + //REDIS_SECRET := config.EnvFunc("REDIS_SECRET") + + //store, err := redis.NewStore(10, "tcp", REDIS_HOST+":"+REDIS_PORT, REDIS_PASSWORD, []byte(REDIS_SECRET)) + + //if err != nil { + // panic("Failed to connect to redis_sessions!") + // } + //redis_sessions + + //Memcached + //store := memcached.NewStore(memcache.New("localhost:11211"), "", []byte("APP_KEYS")) + //end_Memcached + + //sessions_use + //r.Use(sessions.Sessions(config.EnvFunc("SESSION_NAME"), store)) + //end_sessions + + //gin_html_and_static + r.Static("/public", "./public") + + r.MaxMultipartMemory = 8 << 20 + + //gin_route_middleware + + welcome := r.Group("/") + Controllers.Welcome(welcome.Group("/")) + + auth := r.Group("/auth") + Controllers.Auth(auth.Group("/")) + + res_pass := r.Group("/login") + Controllers.Res_pass(res_pass.Group("/")) + + //JWT_Middleware + r.Use(Middleware.ValidateToken()) + //end_JWT_Middleware + + home := r.Group("/home") + Controllers.Home(home.Group("/")) + + pacient := r.Group("/pacient") + Controllers.Pacient(pacient.Group("/")) + + //Casbin_Role_Middleware + //r.Use(Middleware.JWTAuthCasbinMiddleware(true)) + //end_Casbin_Role_Middleware + + doctor := r.Group("/doctor") + Controllers.Doctor(doctor.Group("/")) + + users := r.Group("/users") + Controllers.UsersRegister(users.Group("/")) + + role := r.Group("/role") + Controllers.CasbinRole(role.Group("/")) + + //end_gin_route_middleware + + //test + //test := r.Group("/api/ping") + //test.Use(Middleware.AuthMiddleware(true)) + + //test.GET("/", func(c *gin.Context) { + // c.JSON(200, gin.H{ + // "message": "pong", + // }) + //}) + //end_test + + PORT := config.EnvFunc("PORT") + r.Run(PORT) // listen and serve on 0.0.0.0:8080 +} diff --git a/package-lock.json b/package-lock.json index 5821cc8..5cc0586 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@ionic/react": "^8.6.5", "@ionic/react-router": "^8.6.5", "@tailwindcss/vite": "^4.1.11", + "axios": "^1.11.0", "react": "^19.1.0", "react-dom": "^19.1.0", "tailwindcss": "^4.1.11" @@ -2635,6 +2636,12 @@ "node": ">=8" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -2644,6 +2651,17 @@ "node": ">= 4.0.0" } }, + "node_modules/axios": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.11.0.tgz", + "integrity": "sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -2758,6 +2776,19 @@ "node": "*" } }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2833,6 +2864,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -2910,6 +2953,15 @@ "node": ">=8" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/detect-libc": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", @@ -2919,6 +2971,20 @@ "node": ">=8" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2972,6 +3038,51 @@ "node": ">=6" } }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/esbuild": { "version": "0.25.8", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.8.tgz", @@ -3348,6 +3459,26 @@ "dev": true, "license": "ISC" }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", @@ -3376,6 +3507,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs-extra": { "version": "11.3.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", @@ -3434,6 +3581,15 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3444,6 +3600,43 @@ "node": ">=6.9.0" } }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob": { "version": "11.0.3", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", @@ -3508,6 +3701,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -3531,6 +3736,45 @@ "node": ">=8" } }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/history": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", @@ -4117,6 +4361,15 @@ "@jridgewell/sourcemap-codec": "^1.5.0" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -4141,6 +4394,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4514,6 +4788,12 @@ "react-is": "^16.13.1" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/package.json b/package.json index e74dc9a..12e266a 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@ionic/react": "^8.6.5", "@ionic/react-router": "^8.6.5", "@tailwindcss/vite": "^4.1.11", + "axios": "^1.11.0", "react": "^19.1.0", "react-dom": "^19.1.0", "tailwindcss": "^4.1.11" diff --git a/test/test_get.sh b/test/test_get.sh new file mode 100644 index 0000000..9787ab9 --- /dev/null +++ b/test/test_get.sh @@ -0,0 +1,4 @@ +curl -X GET http://127.0.0.1:8080/auth/test \ +-H "Content-Type: application/json" \ +-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huMTFAZXhhbXBsZS5jb20iLCJleHAiOjE3NTA4NDMwMzR9.ZFwsnnM9KMsLY9WHHGANb2i3Z4COSzn3-AL0TUKSiaU" + diff --git a/test/test_get2.sh b/test/test_get2.sh new file mode 100644 index 0000000..b57ea31 --- /dev/null +++ b/test/test_get2.sh @@ -0,0 +1,3 @@ +curl -X GET http://127.0.0.1:8080/users/2 \ +-H "Content-Type: application/json" \ + diff --git a/test/test_post.sh b/test/test_post.sh new file mode 100644 index 0000000..1ffbba5 --- /dev/null +++ b/test/test_post.sh @@ -0,0 +1,6 @@ +curl -X POST http://127.0.0.1:8080/auth/signup -H "Content-Type: application/json" -d '{ + "name": "JohnDoe11", + "password": "s11ecurePassword123", + "email": "john11111@example.com" +}' + diff --git a/test/test_postl.sh b/test/test_postl.sh new file mode 100644 index 0000000..94be3f8 --- /dev/null +++ b/test/test_postl.sh @@ -0,0 +1,5 @@ +curl -X POST http://127.0.0.1:8080/auth/signin -H "Content-Type: application/json" -d '{ + "password": "securePassword123", + "email": "john11@example.com" +}' +