mirror of
https://github.com/gotify/server.git
synced 2026-05-07 22:06:38 +08:00
Sqlite sorting is by default case sensitive. Postgres & mysql seem to be case insensitive text sorting. Sorting bytes is consistent between mysql,sqlite, and postgres.
63 lines
2.1 KiB
Go
63 lines
2.1 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// Application Model
|
|
//
|
|
// The Application holds information about an app which can send notifications.
|
|
//
|
|
// swagger:model Application
|
|
type Application struct {
|
|
// The application id.
|
|
//
|
|
// read only: true
|
|
// required: true
|
|
// example: 5
|
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
// The application token. Can be used as `appToken`. See Authentication.
|
|
//
|
|
// read only: true
|
|
// required: true
|
|
// example: AWH0wZ5r0Mbac.r
|
|
Token string `gorm:"type:varchar(180);uniqueIndex:uix_applications_token" json:"token"`
|
|
UserID uint `gorm:"index;uniqueIndex:uix_application_user_id_sort_key,priority:1" json:"-"`
|
|
// The application name. This is how the application should be displayed to the user.
|
|
//
|
|
// required: true
|
|
// example: Backup Server
|
|
Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
|
|
// The description of the application.
|
|
//
|
|
// required: true
|
|
// example: Backup server for the interwebs
|
|
Description string `gorm:"type:text" form:"description" query:"description" json:"description"`
|
|
// Whether the application is an internal application. Internal applications should not be deleted.
|
|
//
|
|
// read only: true
|
|
// required: true
|
|
// example: false
|
|
Internal bool `form:"internal" query:"internal" json:"internal"`
|
|
// The image of the application.
|
|
//
|
|
// read only: true
|
|
// required: true
|
|
// example: image/image.jpeg
|
|
Image string `gorm:"type:text" json:"image"`
|
|
Messages []MessageExternal `gorm:"-" json:"-"`
|
|
// The default priority of messages sent by this application. Defaults to 0.
|
|
//
|
|
// required: false
|
|
// example: 4
|
|
DefaultPriority int `form:"defaultPriority" query:"defaultPriority" json:"defaultPriority"`
|
|
// The last time the application token was used.
|
|
//
|
|
// read only: true
|
|
// example: 2019-01-01T00:00:00Z
|
|
LastUsed *time.Time `json:"lastUsed"`
|
|
// The sort key of this application. Uses fractional indexing.
|
|
//
|
|
// required: true
|
|
// example: a1
|
|
SortKey string `gorm:"type:bytes;uniqueIndex:uix_application_user_id_sort_key,priority:2,length:255" form:"sortKey" query:"sortKey" json:"sortKey"`
|
|
}
|