refactor: Update models to use DatabaseV2 instead of DataSourceV2

This commit is contained in:
Marvin Zhang
2024-08-05 13:14:57 +08:00
parent f38b11e7ed
commit fc28a742de
21 changed files with 44 additions and 54 deletions

View File

@@ -16,7 +16,7 @@ func PostDatabase(c *gin.Context) {
Type string `json:"type"`
Description string `json:"description"`
Host string `json:"host"`
Port string `json:"port"`
Port int `json:"port"`
Url string `json:"url"`
Hosts []string `json:"hosts"`
Database string `json:"database"`
@@ -42,7 +42,6 @@ func PostDatabase(c *gin.Context) {
Host: payload.Host,
Port: payload.Port,
Url: payload.Url,
Hosts: payload.Hosts,
Database: payload.Database,
Username: payload.Username,
Password: payload.Password,

View File

@@ -56,18 +56,6 @@ func InitRoutes(app *gin.Engine) (err error) {
groups := NewRouterGroups(app)
RegisterController(groups.AuthGroup, "/data/collections", NewControllerV2[models2.DataCollectionV2]())
RegisterController(groups.AuthGroup, "/databases", NewControllerV2[models2.DatabaseV2]([]Action{
{
Method: http.MethodPost,
Path: "",
HandlerFunc: PostDatabase,
},
{
Method: http.MethodPut,
Path: "/:id",
HandlerFunc: PutDatabaseById,
},
}...))
RegisterController(groups.AuthGroup, "/environments", NewControllerV2[models2.EnvironmentV2]())
RegisterController(groups.AuthGroup, "/nodes", NewControllerV2[models2.NodeV2]())
RegisterController(groups.AuthGroup, "/projects", NewControllerV2[models2.ProjectV2]([]Action{