Organised flag (#988)

* Add organized boolean to scene model (#729)
* Add organized button to scene page
* Add flag to galleries and images
* Import/export changes
* Make organized flag not null
* Ignore organized scenes for autotag

Co-authored-by: com1234 <com1234@notarealemail.com>
This commit is contained in:
WithoutPants
2020-12-18 08:06:49 +11:00
committed by GitHub
parent 99bd7bc750
commit aadbcaeec2
58 changed files with 543 additions and 81 deletions

View File

@@ -23,6 +23,7 @@ func ToBasicJSON(image *models.Image) *jsonschema.Image {
newImageJSON.Rating = int(image.Rating.Int64)
}
newImageJSON.Organized = image.Organized
newImageJSON.OCounter = image.OCounter
newImageJSON.File = getImageFileJSON(image)

View File

@@ -39,13 +39,14 @@ const (
)
const (
checksum = "checksum"
title = "title"
rating = 5
ocounter = 2
size = 123
width = 100
height = 100
checksum = "checksum"
title = "title"
rating = 5
organized = true
ocounter = 2
size = 123
width = 100
height = 100
)
const (
@@ -63,14 +64,15 @@ var updateTime time.Time = time.Date(2002, 01, 01, 0, 0, 0, 0, time.UTC)
func createFullImage(id int) models.Image {
return models.Image{
ID: id,
Title: modelstest.NullString(title),
Checksum: checksum,
Height: modelstest.NullInt64(height),
OCounter: ocounter,
Rating: modelstest.NullInt64(rating),
Size: modelstest.NullInt64(int64(size)),
Width: modelstest.NullInt64(width),
ID: id,
Title: modelstest.NullString(title),
Checksum: checksum,
Height: modelstest.NullInt64(height),
OCounter: ocounter,
Rating: modelstest.NullInt64(rating),
Organized: organized,
Size: modelstest.NullInt64(int64(size)),
Width: modelstest.NullInt64(width),
CreatedAt: models.SQLiteTimestamp{
Timestamp: createTime,
},
@@ -94,10 +96,11 @@ func createEmptyImage(id int) models.Image {
func createFullJSONImage() *jsonschema.Image {
return &jsonschema.Image{
Title: title,
Checksum: checksum,
OCounter: ocounter,
Rating: rating,
Title: title,
Checksum: checksum,
OCounter: ocounter,
Rating: rating,
Organized: organized,
File: &jsonschema.ImageFile{
Height: height,
Size: size,

View File

@@ -63,6 +63,7 @@ func (i *Importer) imageJSONToImage(imageJSON jsonschema.Image) models.Image {
newImage.Rating = sql.NullInt64{Int64: int64(imageJSON.Rating), Valid: true}
}
newImage.Organized = imageJSON.Organized
newImage.OCounter = imageJSON.OCounter
newImage.CreatedAt = models.SQLiteTimestamp{Timestamp: imageJSON.CreatedAt.GetTime()}
newImage.UpdatedAt = models.SQLiteTimestamp{Timestamp: imageJSON.UpdatedAt.GetTime()}