同步历史版本代码
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const (
|
||||
FamilyStatusActive uint8 = 1
|
||||
FamilyRoleOwner uint8 = 1
|
||||
FamilyRoleMember uint8 = 2
|
||||
FamilyMemberActive uint8 = 1
|
||||
FamilyMemberLeft uint8 = 2
|
||||
FamilyMemberRemoved uint8 = 3
|
||||
DefaultFamilyMaxSize int64 = 5
|
||||
)
|
||||
|
||||
type UserFamily struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
OwnerUserId int64 `gorm:"uniqueIndex:uniq_owner_user_id;not null;comment:Owner User ID"`
|
||||
MaxMembers int64 `gorm:"not null;default:5;comment:Max members in family"`
|
||||
Status uint8 `gorm:"type:tinyint(1);not null;default:1;comment:Status: 1=active, 0=disabled"`
|
||||
CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`
|
||||
UpdatedAt time.Time `gorm:"comment:Update Time"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index;comment:Deletion Time"`
|
||||
}
|
||||
|
||||
func (*UserFamily) TableName() string {
|
||||
return "user_family"
|
||||
}
|
||||
|
||||
type UserFamilyMember struct {
|
||||
Id int64 `gorm:"primaryKey"`
|
||||
FamilyId int64 `gorm:"index:idx_family_status,priority:1;not null;comment:Family ID"`
|
||||
UserId int64 `gorm:"uniqueIndex:uniq_user_id;not null;comment:Member User ID"`
|
||||
Role uint8 `gorm:"type:tinyint(1);not null;default:2;comment:Role: 1=owner, 2=member"`
|
||||
Status uint8 `gorm:"index:idx_family_status,priority:2;type:tinyint(1);not null;default:1;comment:Status: 1=active, 2=left, 3=removed"`
|
||||
JoinSource string `gorm:"type:varchar(32);not null;default:'';comment:Join source"`
|
||||
JoinedAt time.Time `gorm:"not null;comment:Joined time"`
|
||||
LeftAt *time.Time `gorm:"default:NULL;comment:Left time"`
|
||||
CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`
|
||||
UpdatedAt time.Time `gorm:"comment:Update Time"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index;comment:Deletion Time"`
|
||||
}
|
||||
|
||||
func (*UserFamilyMember) TableName() string {
|
||||
return "user_family_member"
|
||||
}
|
||||
Reference in New Issue
Block a user