2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 11:27:17 +08:00

feat: 数据库管理提交1

This commit is contained in:
耗子
2024-11-22 02:58:31 +08:00
parent 39d2eee676
commit a96bbf3dfb
17 changed files with 764 additions and 65 deletions

View File

@@ -140,7 +140,7 @@ func (s *DashboardService) CountInfo(w http.ResponseWriter, r *http.Request) {
}
}
if postgresqlInstalled {
postgres, err := db.NewPostgres("postgres", "", "127.0.0.1", 5432, fmt.Sprintf("%s/server/postgresql/data/pg_hba.conf", app.Root))
postgres, err := db.NewPostgres("postgres", "", "127.0.0.1", 5432)
if err == nil {
defer postgres.Close()
databases, err := postgres.Databases()

View File

@@ -83,3 +83,18 @@ func (s *DatabaseServer) Delete(w http.ResponseWriter, r *http.Request) {
Success(w, nil)
}
func (s *DatabaseServer) Sync(w http.ResponseWriter, r *http.Request) {
req, err := Bind[request.ID](r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, "%v", err)
return
}
if err = s.databaseServerRepo.Sync(req.ID); err != nil {
Error(w, http.StatusInternalServerError, "%v", err)
return
}
Success(w, nil)
}