2019-02-09 12:30:49 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
2020-09-20 08:36:02 +00:00
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/stashapp/stash/pkg/utils"
|
2019-02-09 12:30:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Studio struct {
|
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
Checksum string `db:"checksum" json:"checksum"`
|
|
|
|
Name sql.NullString `db:"name" json:"name"`
|
2019-02-14 22:53:32 +00:00
|
|
|
URL sql.NullString `db:"url" json:"url"`
|
2020-06-15 11:34:39 +00:00
|
|
|
ParentID sql.NullInt64 `db:"parent_id,omitempty" json:"parent_id"`
|
2019-02-09 12:30:49 +00:00
|
|
|
CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
|
|
|
|
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
|
|
|
}
|
2019-08-21 05:48:36 +00:00
|
|
|
|
2020-06-15 11:34:39 +00:00
|
|
|
type StudioPartial struct {
|
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
Checksum *string `db:"checksum" json:"checksum"`
|
|
|
|
Name *sql.NullString `db:"name" json:"name"`
|
|
|
|
URL *sql.NullString `db:"url" json:"url"`
|
|
|
|
ParentID *sql.NullInt64 `db:"parent_id,omitempty" json:"parent_id"`
|
|
|
|
CreatedAt *SQLiteTimestamp `db:"created_at" json:"created_at"`
|
|
|
|
UpdatedAt *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
|
|
|
}
|
|
|
|
|
2020-04-29 02:13:08 +00:00
|
|
|
var DefaultStudioImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4wgVBQsJl1CMZAAAASJJREFUeNrt3N0JwyAYhlEj3cj9R3Cm5rbkqtAP+qrnGaCYHPwJpLlaa++mmLpbAERAgAgIEAEBIiBABERAgAgIEAEBIiBABERAgAgIEAHZuVflj40x4i94zhk9vqsVvEq6AsQqMP1EjORx20OACAgQRRx7T+zzcFBxcjNDfoB4ntQqTm5Awo7MlqywZxcgYQ+RlqywJ3ozJAQCSBiEJSsQA0gYBpDAgAARECACAkRAgAgIEAERECACAmSjUv6eAOSB8m8YIGGzBUjYbAESBgMkbBkDEjZbgITBAClcxiqQvEoatreYIWEBASIgJ4Gkf11ntXH3nS9uxfGWfJ5J9hAgAgJEQAQEiIAAERAgAgJEQAQEiIAAERAgAgJEQAQEiL7qBuc6RKLHxr0CAAAAAElFTkSuQmCC"
|
2020-09-20 08:36:02 +00:00
|
|
|
|
|
|
|
func NewStudio(name string) *Studio {
|
|
|
|
currentTime := time.Now()
|
|
|
|
return &Studio{
|
|
|
|
Checksum: utils.MD5FromString(name),
|
|
|
|
Name: sql.NullString{String: name, Valid: true},
|
|
|
|
CreatedAt: SQLiteTimestamp{Timestamp: currentTime},
|
|
|
|
UpdatedAt: SQLiteTimestamp{Timestamp: currentTime},
|
|
|
|
}
|
|
|
|
}
|