feat(supervisor): add invite, bind, and read-only overview

This commit is contained in:
nepiedg
2026-04-16 11:42:53 +08:00
parent a32ec911a1
commit 0eaf3a206a
7 changed files with 496 additions and 0 deletions
@@ -0,0 +1,31 @@
package model
import (
"time"
"gorm.io/gorm"
)
// SupervisorInvite 表示一次“邀请监督人”的邀请记录。
// 邀请通过 token 进行一次性绑定:被接受后 used_at/used_by_uid 会被写入。
type SupervisorInvite struct {
ID uint `gorm:"primaryKey;comment:主键" json:"id"`
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
OwnerUID int `gorm:"column:owner_uid;index;comment:被监督用户ID" json:"-"`
Token string `gorm:"column:token;size:64;uniqueIndex;comment:邀请token" json:"token"`
ExpireAt time.Time `gorm:"column:expire_at;comment:过期时间" json:"expire_at"`
UsedAt *time.Time `gorm:"column:used_at;comment:被使用时间" json:"used_at,omitempty"`
UsedByUID *int `gorm:"column:used_by_uid;comment:使用者(监督人)用户ID" json:"used_by_uid,omitempty"`
}
func (SupervisorInvite) TableName() string {
return "fa_quit_checkin_supervisor_invite"
}
func (SupervisorInvite) TableComment() string {
return "V2-无烟打卡-监督人邀请"
}