query_set_controller.go
6.6 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package controllers
import (
"github.com/linmadan/egglib-go/web/beego"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/querySet/command"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/querySet/query"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/querySet/service"
)
type QuerySetController struct {
beego.BaseController
}
func (controller *QuerySetController) CreateQuerySet() {
querySetService := service.NewQuerySetService(nil)
createQuerySetCommand := &command.CreateQuerySetCommand{}
Must(controller.Unmarshal(createQuerySetCommand))
data, err := querySetService.CreateQuerySet(ParseContext(controller.BaseController), createQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) UpdateQuerySet() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &command.UpdateQuerySetCommand{}
Must(controller.Unmarshal(updateQuerySetCommand))
Id, _ := controller.GetInt(":querySetId")
updateQuerySetCommand.QuerySetId = Id
data, err := querySetService.UpdateQuerySet(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) RefreshQuerySet() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &command.RefreshQuerySetCommand{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.RefreshQuerySet(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) PreviewPrepare() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &command.UpdateQuerySetCommand{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.PreviewPrepare(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) CalculateItemPreview() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &query.CalculateItemPreviewQuery{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.CalculateItemPreview(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) CalculateItemExport() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &query.CalculateItemPreviewQuery{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.CalculateItemExport(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) GetQuerySet() {
querySetService := service.NewQuerySetService(nil)
getQuerySetQuery := &query.GetQuerySetQuery{}
Id, _ := controller.GetInt(":querySetId")
getQuerySetQuery.QuerySetId = Id
data, err := querySetService.GetQuerySet(ParseContext(controller.BaseController), getQuerySetQuery)
controller.Response(data, err)
}
func (controller *QuerySetController) RemoveQuerySet() {
querySetService := service.NewQuerySetService(nil)
removeQuerySetCommand := &command.RemoveQuerySetCommand{}
controller.Unmarshal(removeQuerySetCommand)
Id, _ := controller.GetInt(":querySetId")
removeQuerySetCommand.QuerySetId = Id
data, err := querySetService.RemoveQuerySet(ParseContext(controller.BaseController), removeQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) ListQuerySet() {
querySetService := service.NewQuerySetService(nil)
listQuerySetQuery := &query.ListQuerySetQuery{}
offset, _ := controller.GetInt("offset")
listQuerySetQuery.Offset = offset
limit, _ := controller.GetInt("limit")
listQuerySetQuery.Limit = limit
data, err := querySetService.ListQuerySet(ParseContext(controller.BaseController), listQuerySetQuery)
controller.Response(data, err)
}
func (controller *QuerySetController) ChangeStatus() {
querySetService := service.NewQuerySetService(nil)
changeStatusCommand := &command.ChangeStatusCommand{}
Must(controller.Unmarshal(changeStatusCommand))
data, err := querySetService.ChangeStatus(ParseContext(controller.BaseController), changeStatusCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) Copy() {
querySetService := service.NewQuerySetService(nil)
copyCommand := &command.CopyCommand{}
Must(controller.Unmarshal(copyCommand))
data, err := querySetService.Copy(ParseContext(controller.BaseController), copyCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) DependencyGraph() {
querySetService := service.NewQuerySetService(nil)
dependencyGraphQuery := &query.DependencyGraphQuery{}
Must(controller.Unmarshal(dependencyGraphQuery))
data, err := querySetService.DependencyGraph(ParseContext(controller.BaseController), dependencyGraphQuery)
controller.Response(data, err)
}
func (controller *QuerySetController) Move() {
querySetService := service.NewQuerySetService(nil)
moveCommand := &command.MoveCommand{}
Must(controller.Unmarshal(moveCommand))
data, err := querySetService.Move(ParseContext(controller.BaseController), moveCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) Rename() {
querySetService := service.NewQuerySetService(nil)
renameCommand := &command.RenameCommand{}
Must(controller.Unmarshal(renameCommand))
data, err := querySetService.Rename(ParseContext(controller.BaseController), renameCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) SearchQuerySet() {
querySetService := service.NewQuerySetService(nil)
searchQuerySetQuery := &query.SearchQuerySetQuery{}
Must(controller.Unmarshal(searchQuerySetQuery))
data, err := querySetService.SearchQuerySet(ParseContext(controller.BaseController), searchQuerySetQuery)
controller.Response(data, err)
}
func (controller *QuerySetController) CalculateSetPreview() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &command.UpdateQuerySetCommand{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.CalculateSetPreview(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}
func (controller *QuerySetController) CalculateSetExport() {
querySetService := service.NewQuerySetService(nil)
updateQuerySetCommand := &command.UpdateQuerySetCommand{}
Must(controller.Unmarshal(updateQuerySetCommand))
data, err := querySetService.CalculateSetExport(ParseContext(controller.BaseController), updateQuerySetCommand)
controller.Response(data, err)
}