Initial commit

This commit is contained in:
dushixiang
2020-12-20 21:19:11 +08:00
commit e7f2773c77
77 changed files with 27866 additions and 0 deletions

29
pkg/api/property.go Normal file
View File

@ -0,0 +1,29 @@
package api
import (
"next-terminal/pkg/model"
"fmt"
"github.com/labstack/echo/v4"
)
func PropertyGetEndpoint(c echo.Context) error {
properties := model.FindAllProperties()
return Success(c, properties)
}
func PropertyUpdateEndpoint(c echo.Context) error {
var item map[string]interface{}
if err := c.Bind(&item); err != nil {
return err
}
for key := range item {
value := fmt.Sprintf("%v", item[key])
property := model.Property{
Name: key,
Value: value,
}
model.UpdatePropertyByName(&property, key)
}
return Success(c, nil)
}