mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-26 02:56:22 +00:00
- Introduced new CSS files for rose, violet, and yellow themes with custom color variables. - Implemented dark mode styles for each theme. - Created a color data structure to manage theme colors in the console settings. feat: implement image cropper component - Added an image cropper component for user profile picture editing. - Integrated the image cropper into the user profile page. feat: enhance console sidebar with user permissions - Defined sidebar items with permission checks for admin and editor roles. - Updated user center navigation to reflect user permissions. feat: add user profile and security settings - Developed user profile page with avatar upload and editing functionality. - Implemented user security settings for password and email verification. feat: create reusable dialog and OTP input components - Built a dialog component for modal interactions. - Developed an OTP input component for email verification. fix: improve file handling utilities - Added utility functions for file URI generation. - Implemented permission checks for user roles in the common utilities.
40 lines
1003 B
Go
40 lines
1003 B
Go
package model
|
|
|
|
import (
|
|
"github.com/snowykami/neo-blog/internal/dto"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
gorm.Model
|
|
Username string `gorm:"uniqueIndex;not null"` // 用户名,唯一
|
|
Nickname string `gorm:"default:''"` // 昵称
|
|
AvatarUrl string
|
|
Email string `gorm:"uniqueIndex"`
|
|
Gender string `gorm:"default:''"`
|
|
Role string `gorm:"default:'user'"` // user editor admin
|
|
Language string `gorm:"default:'en'"`
|
|
Password string // 密码,存储加密后的值
|
|
}
|
|
|
|
type UserOpenID struct {
|
|
gorm.Model
|
|
UserID uint `gorm:"uniqueIndex"`
|
|
User User `gorm:"foreignKey:UserID;references:ID"`
|
|
Issuer string `gorm:"index"` // OIDC Issuer
|
|
Sub string `gorm:"index"` // OIDC Sub openid
|
|
}
|
|
|
|
func (user *User) ToDto() dto.UserDto {
|
|
return dto.UserDto{
|
|
ID: user.ID,
|
|
Username: user.Username,
|
|
Nickname: user.Nickname,
|
|
AvatarUrl: user.AvatarUrl,
|
|
Email: user.Email,
|
|
Gender: user.Gender,
|
|
Role: user.Role,
|
|
Language: user.Language,
|
|
}
|
|
}
|