36 lines
666 B
Go
36 lines
666 B
Go
package oauth
|
|
|
|
import "code.mrmelon54.com/melon/summer/pkg/utils"
|
|
|
|
type App struct {
|
|
AppId uint64 `json:"id" xorm:"pk autoincr"`
|
|
UserId uint64 `json:"user_id"`
|
|
Secret string `json:"-"`
|
|
Enabled *bool `json:"enabled"`
|
|
AppName string `json:"app_name"`
|
|
AppDesc string `json:"app_desc"`
|
|
AppIcon string `json:"app_icon"`
|
|
Privacy string `json:"privacy"`
|
|
Terms string `json:"terms"`
|
|
}
|
|
|
|
func (c App) TableName() string {
|
|
return "oauth_app"
|
|
}
|
|
|
|
func (c App) GetId() uint64 {
|
|
return c.AppId
|
|
}
|
|
|
|
func (c App) SetEnabled(v bool) App {
|
|
c.Enabled = utils.PBool(v)
|
|
return c
|
|
}
|
|
|
|
func (c App) ClearForNew() App {
|
|
c.AppId = 0
|
|
c.UserId = 0
|
|
c.Secret = ""
|
|
return c
|
|
}
|