Add json tags to PhotoName and PhotoPath
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
e0aff43d16
commit
bbf6f206f4
2 changed files with 13 additions and 2 deletions
|
@ -45,8 +45,8 @@ type Photo struct {
|
|||
PhotoDescription string `gorm:"type:text;" json:"Description" yaml:"Description,omitempty"`
|
||||
DescriptionSrc string `gorm:"type:varbinary(8);" json:"DescriptionSrc" yaml:"DescriptionSrc,omitempty"`
|
||||
Details Details `json:"Details" yaml:"Details"`
|
||||
PhotoPath string `gorm:"type:varbinary(768);index;" yaml:"-"`
|
||||
PhotoName string `gorm:"type:varbinary(255);" json:"PhotoName" yaml:"-"`
|
||||
PhotoPath string `gorm:"type:varbinary(768);index;" json:"Path" yaml:"-"`
|
||||
PhotoName string `gorm:"type:varbinary(255);" json:"Name" yaml:"-"`
|
||||
OriginalName string `gorm:"type:varbinary(768);" json:"OriginalName" yaml:"OriginalName,omitempty"`
|
||||
PhotoFavorite bool `json:"Favorite" yaml:"Favorite,omitempty"`
|
||||
PhotoPrivate bool `json:"Private" yaml:"Private,omitempty"`
|
||||
|
|
|
@ -33,4 +33,15 @@ func TestPhoto_EstimateCountry(t *testing.T) {
|
|||
assert.Equal(t, "de", m.CountryCode())
|
||||
assert.Equal(t, "Germany", m.CountryName())
|
||||
})
|
||||
|
||||
t.Run("ca", func(t *testing.T) {
|
||||
m := Photo{PhotoTitle: "Port Lands / Gardiner Expressway / Toronto", PhotoPath: "2012/09", PhotoName: "20120910_231851_CA06E1AD", OriginalName: "demo/Toronto/port-lands--gardiner-expressway--toronto_7999515645_o.jpg"}
|
||||
assert.Equal(t, UnknownCountry.ID, m.CountryCode())
|
||||
assert.Equal(t, UnknownCountry.CountryName, m.CountryName())
|
||||
m.EstimateCountry()
|
||||
assert.Equal(t, "ca", m.CountryCode())
|
||||
assert.Equal(t, "Canada", m.CountryName())
|
||||
})
|
||||
|
||||
//OriginalName: "demo/Toronto/port-lands--gardiner-expressway--toronto_7999515645_o.jpg"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue