2020-04-30 17:25:46 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
type CameraMap map[string]Camera
|
|
|
|
|
2020-05-11 14:41:20 +02:00
|
|
|
func (m CameraMap) Get(name string) Camera {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
return *NewCamera(name, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m CameraMap) Pointer(name string) *Camera {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewCamera(name, "")
|
|
|
|
}
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
var CameraFixtures = CameraMap{
|
2020-04-30 17:25:46 +02:00
|
|
|
"apple-iphone-se": {
|
|
|
|
ID: 1000000,
|
|
|
|
CameraSlug: "apple-iphone-se",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraName: "Apple iPhone SE",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraMake: "Apple",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraModel: "iPhone SE",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
"canon-eos-5d": {
|
|
|
|
ID: 1000001,
|
|
|
|
CameraSlug: "canon-eos-5d",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraName: "Canon EOS 5D",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraMake: "Canon",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraModel: "EOS 5D",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
"canon-eos-7d": {
|
|
|
|
ID: 1000002,
|
|
|
|
CameraSlug: "canon-eos-7d",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraName: "Canon EOS 7D",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraMake: "Canon",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraModel: "EOS 7D",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
"canon-eos-6d": {
|
|
|
|
ID: 1000003,
|
|
|
|
CameraSlug: "canon-eos-6d",
|
|
|
|
CameraModel: "EOS 6D",
|
|
|
|
CameraMake: "Canon",
|
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
"apple-iphone-6": {
|
|
|
|
ID: 1000004,
|
|
|
|
CameraSlug: "apple-iphone-6",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraName: "Apple iPhone 6",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraMake: "Apple",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraModel: "iPhone 6",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
"apple-iphone-7": {
|
|
|
|
ID: 1000005,
|
|
|
|
CameraSlug: "apple-iphone-7",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraName: "Apple iPhone 7",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraMake: "Apple",
|
2020-05-29 18:04:30 +02:00
|
|
|
CameraModel: "iPhone 7",
|
2020-04-30 17:25:46 +02:00
|
|
|
CameraType: "",
|
|
|
|
CameraDescription: "",
|
|
|
|
CameraNotes: "",
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-04-30 17:25:46 +02:00
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateCameraFixtures inserts known entities into the database for testing.
|
2020-05-01 14:13:59 +02:00
|
|
|
func CreateCameraFixtures() {
|
2020-04-30 17:25:46 +02:00
|
|
|
for _, entity := range CameraFixtures {
|
2020-05-01 14:13:59 +02:00
|
|
|
Db().Create(&entity)
|
2020-04-30 17:25:46 +02:00
|
|
|
}
|
|
|
|
}
|