orgs_controller.go
1.7 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
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/service"
)
type OrgsController struct {
baseController
}
func (controller *OrgsController) OrgAdd() {
orgsService := service.NewOrgsService(nil)
orgAddCommand := &command.OrgAddCommand{}
controller.Unmarshal(orgAddCommand)
orgAddCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgAdd(orgAddCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgUpdate() {
orgsService := service.NewOrgsService(nil)
orgUpdateCommand := &command.OrgUpdateCommand{}
controller.Unmarshal(orgUpdateCommand)
orgId := controller.GetString(":orgId")
orgUpdateCommand.OrgId = orgId
orgUpdateCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgUpdate(orgUpdateCommand)
controller.Response(data, err)
}
func (controller *OrgsController) OrgList() {
orgsService := service.NewOrgsService(nil)
orgListQuery := &query.OrgListQuery{}
controller.Unmarshal(orgListQuery)
orgListQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgList(orgListQuery)
controller.Response(data, err)
}
func (controller *OrgsController) OrgGet() {
orgsService := service.NewOrgsService(nil)
orgGetQuery := &query.OrgGetQuery{}
orgId := controller.GetString(":orgId")
orgGetQuery.OrgId = orgId
orgGetQuery.Operator = controller.GetOperator()
data, err := orgsService.OrgGet(orgGetQuery)
controller.Response(data, err)
}