Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dc6c217fa | ||
|
|
c4bd121388 | ||
|
|
e26c2af201 |
@@ -153,9 +153,12 @@ func (aH *AccessHandler) DeleteWorkspace(c *gin.Context) {
|
|||||||
c.JSON(http.StatusInternalServerError, nil)
|
c.JSON(http.StatusInternalServerError, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, u := range users {
|
for _, u := range users {
|
||||||
if u.Settings.Workspace == workspace.Name {
|
if u.Workspaces == nil {
|
||||||
u.Settings.Workspace = ""
|
continue
|
||||||
|
} else if u.Settings.Workspace.Name == workspace.Name {
|
||||||
|
u.Settings.Workspace = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
u.Workspaces = slices.DeleteFunc(u.Workspaces, func(w *models.Workspace) bool {
|
u.Workspaces = slices.DeleteFunc(u.Workspaces, func(w *models.Workspace) bool {
|
||||||
@@ -163,13 +166,14 @@ func (aH *AccessHandler) DeleteWorkspace(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// crearemove folder
|
// remove folder
|
||||||
err = os.RemoveAll(workspace.Uuid.String())
|
err = os.RemoveAll(workspace.Uuid.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aH.logger.Error("DeleteWorkspace", err)
|
aH.logger.Error("DeleteWorkspace", err)
|
||||||
c.JSON(http.StatusBadRequest, models.NewJsonErrorResponse(err))
|
c.JSON(http.StatusBadRequest, models.NewJsonErrorResponse(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
@@ -188,12 +192,19 @@ func (aH *AccessHandler) ReadWorkspaceData(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if workspace.Uuid == uuid.Nil {
|
||||||
|
aH.logger.Error("ReadWorkspaceData", "uuid nil")
|
||||||
|
c.JSON(http.StatusBadRequest, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
files, err := os.ReadDir(workspace.Uuid.String())
|
files, err := os.ReadDir(workspace.Uuid.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
aH.logger.Error("ReadWorkspaceData", err)
|
aH.logger.Error("ReadWorkspaceData", err)
|
||||||
c.JSON(http.StatusBadRequest, nil)
|
c.JSON(http.StatusBadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var response []string
|
var response []string
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
if f.IsDir() || !strings.Contains(filepath.Ext(f.Name()), ".db") {
|
if f.IsDir() || !strings.Contains(filepath.Ext(f.Name()), ".db") {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ type Settings struct {
|
|||||||
AppName string `json:"appName,omitempty"`
|
AppName string `json:"appName,omitempty"`
|
||||||
DatabaseName string `json:"databaseName,omitempty"`
|
DatabaseName string `json:"databaseName,omitempty"`
|
||||||
DatabaseToken string `json:"databaseToken,omitempty"`
|
DatabaseToken string `json:"databaseToken,omitempty"`
|
||||||
Workspace string `json:"workspace,omitempty"`
|
Workspace *Workspace `json:"workspace,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Settings) DefaultQuasarSettings() {
|
func (s *Settings) DefaultQuasarSettings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user