modified: README.md
modified: serv_nginx/api_bb/internal/config/config.go new file: serv_nginx/api_bb/internal/models/email.go add email config to config api_bb and email model into models
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
### tasks: profile page need full upgreade, main sender (почтовая рассылка)
|
### tasks: profile page need full upgreade, main sender (почтовая рассылка)
|
||||||
### BackEnd REST API on Golang 1.25.1
|
### BackEnd REST API on Golang 1.25.1
|
||||||
### FrontEnd vue3.js
|
### FrontEnd vue3.js
|
||||||
|
|
||||||
|
|
||||||
### Zagir Загир тренер
|
### Zagir Загир тренер
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,16 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
Port string
|
Port string
|
||||||
DatabaseURL string
|
DatabaseURL string
|
||||||
JWTSecret string
|
|
||||||
StaticURL string `env:"STATIC_URL" envDefault:"http://localhost:8080"`
|
StaticURL string `env:"STATIC_URL" envDefault:"http://localhost:8080"`
|
||||||
|
JWTSecret string `env:"JWT_SECRET,required"`
|
||||||
|
|
||||||
|
// Email configuration
|
||||||
|
SMTPHost string `env:"SMTP_HOST,required"`
|
||||||
|
SMTPPort int `env:"SMTP_PORT,required"`
|
||||||
|
SMTPUsername string `env:"SMTP_USERNAME,required"`
|
||||||
|
SMTPPassword string `env:"SMTP_PASSWORD,required"`
|
||||||
|
FromEmail string `env:"FROM_EMAIL,required"`
|
||||||
|
FrontendURL string `env:"FRONTEND_URL,required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Load() *Config {
|
func Load() *Config {
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// models/email.go
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EmailVerification struct {
|
||||||
|
ID uint `json:"id" gorm:"primaryKey"`
|
||||||
|
UserID uint `json:"user_id" gorm:"not null;index"`
|
||||||
|
Token string `json:"token" gorm:"size:100;not null;uniqueIndex"`
|
||||||
|
Email string `json:"email" gorm:"not null"`
|
||||||
|
Type string `json:"type" gorm:"size:20;not null"` // verification, password_reset
|
||||||
|
ExpiresAt time.Time `json:"expires_at" gorm:"not null"`
|
||||||
|
Used bool `json:"used" gorm:"default:false"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||||
|
|
||||||
|
// Связи
|
||||||
|
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PasswordResetRequest struct {
|
||||||
|
Email string `json:"email" validate:"required,email"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PasswordResetConfirm struct {
|
||||||
|
Token string `json:"token" validate:"required"`
|
||||||
|
Password string `json:"password" validate:"required,min=6"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user