|
@@ -7,6 +7,7 @@ import (
|
|
|
"git.sxidc.com/go-framework/baize/application"
|
|
|
"git.sxidc.com/go-framework/baize/binding"
|
|
|
"git.sxidc.com/go-framework/baize/domain"
|
|
|
+ "git.sxidc.com/go-framework/baize/infrastructure"
|
|
|
"git.sxidc.com/go-tools/utils/strutils"
|
|
|
DEATH "github.com/vrecan/death"
|
|
|
"syscall"
|
|
@@ -69,7 +70,7 @@ func main() {
|
|
|
ResponseFunc: binding.SendIDResponse[string],
|
|
|
DTO: &CreateClassJsonBody{},
|
|
|
Objects: []domain.Object{&Class{}},
|
|
|
- ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (string, error) {
|
|
|
+ ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (string, error) {
|
|
|
e := domain.ToConcreteObject[*Class](objects[0])
|
|
|
e.ID = strutils.SimpleUUID()
|
|
|
classMap[e.ID] = e
|
|
@@ -83,7 +84,7 @@ func main() {
|
|
|
ResponseFunc: binding.SendMsgResponse,
|
|
|
DTO: &DeleteClassPathParams{},
|
|
|
Objects: []domain.Object{&Class{}},
|
|
|
- ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (any, error) {
|
|
|
+ ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
|
|
|
id := domain.Field[string](objects[0], "ID")
|
|
|
delete(classMap, id)
|
|
|
fmt.Println("Deleted Entity:" + id)
|
|
@@ -97,7 +98,7 @@ func main() {
|
|
|
ResponseFunc: binding.SendMsgResponse,
|
|
|
DTO: &UpdateClassJsonBody{},
|
|
|
Objects: []domain.Object{&Class{}},
|
|
|
- ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (any, error) {
|
|
|
+ ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
|
|
|
id := domain.Field[string](objects[0], "ID")
|
|
|
newName := domain.Field[string](objects[0], "Name")
|
|
|
|
|
@@ -123,7 +124,7 @@ func main() {
|
|
|
ResponseFunc: binding.SendInfosResponse[ClassInfo],
|
|
|
DTO: &QueryClassesQueryParams{},
|
|
|
Objects: []domain.Object{&Class{}},
|
|
|
- ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (binding.InfosData[ClassInfo], error) {
|
|
|
+ ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (binding.InfosData[ClassInfo], error) {
|
|
|
name := domain.Field[string](objects[0], "Name")
|
|
|
|
|
|
classInfos := make([]ClassInfo, 0)
|
|
@@ -189,7 +190,7 @@ func main() {
|
|
|
ResponseFunc: binding.SendInfoResponse[*ClassInfo],
|
|
|
DTO: &GetClassQueryParams{},
|
|
|
Objects: []domain.Object{&Class{}},
|
|
|
- ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (*ClassInfo, error) {
|
|
|
+ ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (*ClassInfo, error) {
|
|
|
id := domain.Field[string](objects[0], "ID")
|
|
|
|
|
|
classInfo := new(ClassInfo)
|