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:
buua436
2026-05-12 17:16:48 +08:00
committed by GitHub
parent 4374e07a29
commit 9ee481807f
5 changed files with 101 additions and 0 deletions

View File

@@ -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)