mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-11 22:25:41 +08:00
GO: implement GET /api/v1/datasets/:dataset_id (#14834)
### What problem does this PR solve? implement GET /api/v1/datasets/:dataset_id ### Type of change - [x] Refactoring
This commit is contained in:
@@ -142,6 +142,27 @@ func (h *DatasetsHandler) CreateDataset(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// GetDataset handles GET /api/v1/datasets/:dataset_id.
|
||||
func (h *DatasetsHandler) GetDataset(c *gin.Context) {
|
||||
user, errorCode, errorMessage := GetUser(c)
|
||||
if errorCode != common.CodeSuccess {
|
||||
jsonError(c, errorCode, errorMessage)
|
||||
return
|
||||
}
|
||||
|
||||
datasetID := c.Param("dataset_id")
|
||||
result, code, err := h.datasetsService.GetDataset(datasetID, user.ID)
|
||||
if err != nil {
|
||||
jsonError(c, code, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": common.CodeSuccess,
|
||||
"data": result,
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteDatasets handles DELETE /api/v1/datasets.
|
||||
func (h *DatasetsHandler) DeleteDatasets(c *gin.Context) {
|
||||
user, errorCode, errorMessage := GetUser(c)
|
||||
|
||||
Reference in New Issue
Block a user