Files
server/model/client.go
饺子w (Yumechi) 496c166981 chore: Migrate github.com/jinzhu/gorm to gorm.io/gorm (#863)
* chore: Migrate github.com/jinzhu/gorm to gorm.io/gorm

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* chore: drop singleton connection limit on sqlite3 backend

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* enhance: database logging

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* Revert "chore: drop singleton connection limit on sqlite3 backend"

This reverts commit b494a3bd1f.

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* typo

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* rename unique_index -> uniqueIndex

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* drop uniqueIndex on primary key

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* migrate fully to new gorm tag format

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* specify unique index name

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* remove pluginConf duplicate index

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

* disable auto migrate FK

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>

---------

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
2025-10-29 22:23:10 +00:00

35 lines
952 B
Go

package model
import "time"
// Client Model
//
// The Client holds information about a device which can receive notifications (and other stuff).
//
// swagger:model Client
type Client struct {
// The client id.
//
// read only: true
// required: true
// example: 5
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
// The client token. Can be used as `clientToken`. See Authentication.
//
// read only: true
// required: true
// example: CWH0wZ5r0Mbac.r
Token string `gorm:"type:varchar(180);uniqueIndex:uix_clients_token" json:"token"`
UserID uint `gorm:"index" json:"-"`
// The client name. This is how the client should be displayed to the user.
//
// required: true
// example: Android Phone
Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
// The last time the client token was used.
//
// read only: true
// example: 2019-01-01T00:00:00Z
LastUsed *time.Time `json:"lastUsed"`
}