Browse Source

提交代码

fix-mlops
ychao_1983 2 years ago
parent
commit
f43020f035
2 changed files with 23 additions and 0 deletions
  1. +1
    -0
      routers/api/v1/api.go
  2. +22
    -0
      routers/api/v1/repo/datasets.go

+ 1
- 0
routers/api/v1/api.go View File

@@ -738,6 +738,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID)

m.Group("/datasets/:username/:reponame", func() {
m.Get("", repo.CurrentRepoDatasetInfoWithoutAttachment)
m.Get("/current_repo", repo.CurrentRepoDatasetMultiple)
m.Get("/my_datasets", repo.MyDatasetsMultiple)
m.Get("/public_datasets", repo.PublicDatasetMultiple)


+ 22
- 0
routers/api/v1/repo/datasets.go View File

@@ -51,6 +51,28 @@ func CurrentRepoDatasetMultiple(ctx *context.APIContext) {

}

func CurrentRepoDatasetInfoWithoutAttachment(ctx *context.APIContext) {
dataset, err := models.GetDatasetByRepo(ctx.Repo.Repository)

if err != nil {
log.Warn("can not get dataset.", err)
ctx.JSON(200, map[string]interface{}{
"code": 0,
"message": "",
"data": []*api.Dataset{},
})
return
}

dataset.Repo = ctx.Repo.Repository
ctx.JSON(200, map[string]interface{}{
"code": 0,
"message": "",
"data": []*api.Dataset{convert.ToDataset(dataset)},
})

}

func MyDatasetsMultiple(ctx *context.APIContext) {

opts := &models.SearchDatasetOptions{


Loading…
Cancel
Save