wip: user stuff
This commit is contained in:
@ -9,5 +9,7 @@ import (
|
||||
func Init(ctx context.Context, tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
&Todo{},
|
||||
&User{},
|
||||
&Object{},
|
||||
)
|
||||
}
|
10
internal/model/object.go
Normal file
10
internal/model/object.go
Normal file
@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
type Object struct {
|
||||
Id int64 `json:"id" gorm:"column:id,primaryKey"`
|
||||
CreatedAt int64 `json:"created_at" gorm:"column:created_at,autoCreateTime:milli"`
|
||||
Key string `json:"key" gorm:"column:key;type:varchar(32);not null;unique"`
|
||||
ContentType string `json:"content_type" gorm:"column:content_type;type:varchar(255);not null"`
|
||||
Size int64 `json:"size" gorm:"column:size"`
|
||||
Blob []byte `json:"-" gorm:"column:blob;type:blob"`
|
||||
}
|
@ -27,7 +27,7 @@ func (t TodoStatus) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
|
||||
type Todo struct {
|
||||
Id int64 `json:"id" gorm:"column:id,primaryKey;autoIncrement"`
|
||||
Id int64 `json:"id" gorm:"column:id,primaryKey"`
|
||||
CreatedAt int64 `json:"created_at" gorm:"column:created_at,autoCreateTime:milli"`
|
||||
UpdatedAt int64 `json:"updated_at" gorm:"column:updated_at,autoUpdateTime:milli"`
|
||||
DeletedAt int64 `json:"deleted_at" gorm:"column:deleted_at"`
|
||||
|
14
internal/model/user.go
Normal file
14
internal/model/user.go
Normal file
@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
type User struct {
|
||||
Id int64 `json:"id" gorm:"column:id,primaryKey"`
|
||||
CreatedAt int64 `json:"created_at" gorm:"column:created_at,autoCreateTime:milli"`
|
||||
UpdatedAt int64 `json:"updated_at" gorm:"column:updated_at,autoUpdateTime:milli"`
|
||||
DeletedAt int64 `json:"deleted_at" gorm:"column:deleted_at"`
|
||||
Username string `json:"username" gorm:"column:username;type:varchar(255);not null"`
|
||||
Nickname string `json:"nickname" gorm:"column:nickname;type:varchar(255);not null"`
|
||||
Password string `json:"-" gorm:"column:password;type:varchar(255);not null"`
|
||||
Avatar string `json:"avatar" gorm:"column:avatar;type:varchar(32);not null"`
|
||||
Phone string `json:"phone" gorm:"column:phone;type:varchar(16);not null"`
|
||||
Email string `json:"email" gorm:"column:email;type:varchar(255);not null"`
|
||||
}
|
Reference in New Issue
Block a user