|
|
@@ -13,10 +13,10 @@ import (
|
|
|
)
|
|
|
|
|
|
// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:10000/test/v1/class/create"
|
|
|
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"1b86aba688384f43a0981f1d41ac8346", "name":"test-new"}' "http://localhost:10000/test/v1/class/update"
|
|
|
+// curl -X PUT -H "Content-Type: application/json" -d '{"id":"faa5452038204246971c48e5b0d775af", "name":"test-new"}' "http://localhost:10000/test/v1/class/update"
|
|
|
// curl -X GET "http://localhost:10000/test/v1/class/query?name=test-new&pageNo=0&pageSize=1"
|
|
|
-// curl -X GET "http://localhost:10000/test/v1/class/get?id=1b86aba688384f43a0981f1d41ac8346"
|
|
|
-// curl -X DELETE "http://localhost:10000/test/v1/class/1b86aba688384f43a0981f1d41ac8346/delete"
|
|
|
+// curl -X GET "http://localhost:10000/test/v1/class/get?id=faa5452038204246971c48e5b0d775af"
|
|
|
+// curl -X DELETE "http://localhost:10000/test/v1/class/faa5452038204246971c48e5b0d775af/delete"
|
|
|
|
|
|
type CreateClassJsonBody struct {
|
|
|
Name string `json:"name" binding:"required" assign:"toField:Name"`
|
|
|
@@ -110,15 +110,7 @@ func main() {
|
|
|
Path: "/class/update",
|
|
|
ResponseFunc: binding.SendMsgResponse,
|
|
|
DTO: &UpdateClassJsonBody{},
|
|
|
- FormDomainObjectsFunc: func(c *api.Context, dto binding.DTO) ([]domain.Object, error) {
|
|
|
- jsonBody := binding.ToConcreteDTO[*UpdateClassJsonBody](dto)
|
|
|
- return []domain.Object{
|
|
|
- &Class{
|
|
|
- ID: jsonBody.ID,
|
|
|
- Name: jsonBody.Name,
|
|
|
- },
|
|
|
- }, nil
|
|
|
- },
|
|
|
+ Objects: []domain.Object{&Class{}},
|
|
|
ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object) (any, error) {
|
|
|
id := domain.Field[string](objects[0], "ID")
|
|
|
newName := domain.Field[string](objects[0], "Name")
|