This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
property.go
96 lines (82 loc) · 3.57 KB
/
property.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package interfaces
import (
"context"
"errors"
"github.com/reearth/reearth-backend/internal/usecase"
"github.com/reearth/reearth-backend/pkg/file"
"github.com/reearth/reearth-backend/pkg/id"
"github.com/reearth/reearth-backend/pkg/property"
)
type UpdatePropertyValueParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
Value *property.Value
}
type RemovePropertyFieldParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
}
type UploadFileParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
File *file.File
}
type LinkPropertyValueParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
Links *property.Links
}
type UnlinkPropertyValueParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
}
type AddPropertyItemParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
Index *int
NameFieldValue *property.Value
}
type MovePropertyItemParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
Index int
}
type RemovePropertyItemParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
}
type UpdatePropertyItemsParam struct {
PropertyID id.PropertyID
Pointer *property.Pointer
Operations []UpdatePropertyItemsOperationParam
}
type UpdatePropertyItemsOperationParam struct {
Operation ListOperation
ItemID *id.PropertyItemID
Index *int
NameFieldValue *property.Value
}
var (
ErrPropertyNotFound error = errors.New("property not found")
ErrPropertyInvalidType error = errors.New("property invalid type")
ErrInvalidFile error = errors.New("invalid file")
ErrFailedToUploadFile error = errors.New("failed to upload file")
ErrPropertySchemaMustBeSpecified error = errors.New("property schema must be specified")
ErrInvalidDatasetFieldID error = errors.New("invalid dataset field id")
ErrInvalidPropertyLinks error = errors.New("invalid property links")
ErrInvalidPropertyValue error = errors.New("invalid property value")
)
type Property interface {
Fetch(context.Context, []id.PropertyID, *usecase.Operator) ([]*property.Property, error)
FetchSchema(context.Context, []id.PropertySchemaID, *usecase.Operator) ([]*property.Schema, error)
FetchMerged(context.Context, *id.PropertyID, *id.PropertyID, *id.DatasetID, *usecase.Operator) (*property.Merged, error)
UpdateValue(context.Context, UpdatePropertyValueParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, *property.Field, error)
RemoveField(context.Context, RemovePropertyFieldParam, *usecase.Operator) (*property.Property, error)
UploadFile(context.Context, UploadFileParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, *property.Field, error)
LinkValue(context.Context, LinkPropertyValueParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, *property.Field, error)
UnlinkValue(context.Context, UnlinkPropertyValueParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, *property.Field, error)
AddItem(context.Context, AddPropertyItemParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, error)
MoveItem(context.Context, MovePropertyItemParam, *usecase.Operator) (*property.Property, *property.GroupList, *property.Group, error)
RemoveItem(context.Context, RemovePropertyItemParam, *usecase.Operator) (*property.Property, error)
UpdateItems(context.Context, UpdatePropertyItemsParam, *usecase.Operator) (*property.Property, error)
}