feat: add short_code field to device login API

- Add optional short_code parameter to DeviceLoginRequest
- Add ShortCode field to Device model
- Save short_code to database during device registration
- Add database migration for user_device.short_code column
- Fix duplicate variable declaration in routes.go
This commit is contained in:
EUForest
2026-01-10 18:11:24 +08:00
parent ed669d0620
commit 3359704a45
7 changed files with 10 additions and 2 deletions
+1
View File
@@ -81,6 +81,7 @@ type Device struct {
UserId int64 `gorm:"index:idx_user_id;not null;comment:User ID"`
UserAgent string `gorm:"default:null;comment:UserAgent."`
Identifier string `gorm:"type:varchar(255);unique;index:idx_identifier;default:'';comment:Device Identifier"`
ShortCode string `gorm:"type:varchar(255);default:'';comment:Short Code"`
Online bool `gorm:"default:false;not null;comment:Online"`
Enabled bool `gorm:"default:true;not null;comment:Enabled"`
CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`