-
Notifications
You must be signed in to change notification settings - Fork 0
/
category.go
41 lines (35 loc) · 1.32 KB
/
category.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
package yeahapi
import "context"
type Category struct {
ID int `json:"id"`
ParentID *int `json:"parent_id"`
Title string `json:"title"`
Description string `json:"description"`
}
type CategoryReference struct {
TableName string
CategoryID int
Columns []string
}
type CategoryAttribute struct {
ID int `json:"id"`
Required bool `json:"required"`
EnabledForVariations bool `json:"enabled_for_variations"`
Key string `json:"key"`
Name string `json:"name"`
CategoryID int `json:"category_id"`
Options []CategoryAttributeOption `json:"options"`
}
type CategoryAttributeOption struct {
ID int `json:"id"`
AttributeID int `json:"attribute_id"`
Value string `json:"value"`
Unit string `json:"unit"`
Name string `json:"name"`
}
type CategoryService interface {
Categories(ctx context.Context, lang string) ([]Category, error)
References(ctx context.Context) ([]CategoryReference, error)
Attributes(ctx context.Context, categoryID string, lang string) ([]*CategoryAttribute, error)
CreateCategory(ctx context.Context, category *Category) (*Category, error)
}