-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
43 lines (36 loc) · 933 Bytes
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import "gorm.io/gorm"
// json responses
type StorePayload struct {
StoreId string `json:"store_id"`
ImageUrls []string `json:"image_url"`
VisitTime string `json:"visit_time"`
}
type ImagesPayload struct {
Count int `json:"count"`
Visits []StorePayload `json:"visits"`
}
type JobError struct {
StoreId string `json:"store_id"`
Error string `json:"error"`
}
type JobStatusResponse struct {
JobId string `json:"job_id"`
Status string `json:"status"`
Error []JobError `json:"error"`
}
// db models
type Job struct {
gorm.Model
Status string `json:"status"`
}
type Image struct {
gorm.Model
JobId int `json:"job_id"`
Job Job `json:"job" gorm:"foreignKey:JobId"`
StoreId string `json:"store_id"`
Url string `json:"url"`
Perimeter int `json:"perimeter"`
Success bool `json:"success"`
ErrorMessage string `json:"error"`
}