From cfc1892863a97835395be3fcc45b3b58eb522337 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Thu, 8 Aug 2024 07:43:46 +0200 Subject: [PATCH 1/3] fix: param OpenAPI docs (#249) --- api/router/file_router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/router/file_router.go b/api/router/file_router.go index 9b3ddef11..4cbe470ec 100644 --- a/api/router/file_router.go +++ b/api/router/file_router.go @@ -891,8 +891,8 @@ func (r *FileRouter) DownloadOriginal(c *fiber.Ctx) error { // @Id files_download_preview // @Produce json // @Param id path string true "ID" +// @Param ext path string true "Extension" // @Param access_token query string true "Access Token" -// @Param ext query string true "Extension" // @Failure 404 {object} errorpkg.ErrorResponse // @Failure 500 {object} errorpkg.ErrorResponse // @Router /files/{id}/preview{ext} [get] From af60abafd8b5a7697bee831166231eaffa2fd34f Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Thu, 8 Aug 2024 07:44:24 +0200 Subject: [PATCH 2/3] fix(conversion): mosaic S3 key (#253) --- conversion/pipeline/mosaic_pipeline.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversion/pipeline/mosaic_pipeline.go b/conversion/pipeline/mosaic_pipeline.go index 72033a792..365d4806e 100644 --- a/conversion/pipeline/mosaic_pipeline.go +++ b/conversion/pipeline/mosaic_pipeline.go @@ -90,7 +90,7 @@ func (p *mosaicPipeline) create(inputPath string, opts api_client.PipelineRunOpt Options: opts, Fields: []string{api_client.SnapshotFieldMosaic}, Mosaic: &api_client.S3Object{ - Key: filepath.FromSlash(opts.SnapshotID + "/mosaic.json"), + Key: filepath.FromSlash(opts.SnapshotID + "/mosaic"), Bucket: opts.Bucket, }, }); err != nil { From 1d8b54eba630f72605f9a17c05e1f8c60298979a Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Thu, 8 Aug 2024 08:08:18 +0200 Subject: [PATCH 3/3] refactor(api): stylecheck suggestions (#255) --- api/repo/task_repo.go | 84 +++++++++++++++++------------------ api/router/snapshot_router.go | 6 +-- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/api/repo/task_repo.go b/api/repo/task_repo.go index fe907fb4d..cf9f8ff69 100644 --- a/api/repo/task_repo.go +++ b/api/repo/task_repo.go @@ -41,103 +41,103 @@ func (*taskEntity) TableName() string { return "task" } -func (o *taskEntity) BeforeCreate(*gorm.DB) (err error) { - o.CreateTime = helper.NewTimestamp() +func (e *taskEntity) BeforeCreate(*gorm.DB) (err error) { + e.CreateTime = helper.NewTimestamp() return nil } -func (o *taskEntity) BeforeSave(*gorm.DB) (err error) { +func (e *taskEntity) BeforeSave(*gorm.DB) (err error) { timeNow := helper.NewTimestamp() - o.UpdateTime = &timeNow + e.UpdateTime = &timeNow return nil } -func (p *taskEntity) GetID() string { - return p.ID +func (e *taskEntity) GetID() string { + return e.ID } -func (p *taskEntity) GetName() string { - return p.Name +func (e *taskEntity) GetName() string { + return e.Name } -func (p *taskEntity) GetError() *string { - return p.Error +func (e *taskEntity) GetError() *string { + return e.Error } -func (p *taskEntity) GetPercentage() *int { - return p.Percentage +func (e *taskEntity) GetPercentage() *int { + return e.Percentage } -func (p *taskEntity) GetIsIndeterminate() bool { - return p.IsIndeterminate +func (e *taskEntity) GetIsIndeterminate() bool { + return e.IsIndeterminate } -func (p *taskEntity) GetUserID() string { - return p.UserID +func (e *taskEntity) GetUserID() string { + return e.UserID } -func (p *taskEntity) GetStatus() string { - return p.Status +func (e *taskEntity) GetStatus() string { + return e.Status } -func (s *taskEntity) GetPayload() map[string]string { - if s.Payload.String() == "" { +func (e *taskEntity) GetPayload() map[string]string { + if e.Payload.String() == "" { return nil } res := map[string]string{} - if err := json.Unmarshal([]byte(s.Payload.String()), &res); err != nil { + if err := json.Unmarshal([]byte(e.Payload.String()), &res); err != nil { log.GetLogger().Fatal(err) return nil } return res } -func (o *taskEntity) GetCreateTime() string { - return o.CreateTime +func (e *taskEntity) GetCreateTime() string { + return e.CreateTime } -func (o *taskEntity) GetUpdateTime() *string { - return o.UpdateTime +func (e *taskEntity) GetUpdateTime() *string { + return e.UpdateTime } -func (p *taskEntity) HasError() bool { - return p.Error != nil +func (e *taskEntity) HasError() bool { + return e.Error != nil } -func (p *taskEntity) SetName(name string) { - p.Name = name +func (e *taskEntity) SetName(name string) { + e.Name = name } -func (p *taskEntity) SetError(error *string) { - p.Error = error +func (e *taskEntity) SetError(error *string) { + e.Error = error } -func (p *taskEntity) SetPercentage(percentage *int) { - p.Percentage = percentage +func (e *taskEntity) SetPercentage(percentage *int) { + e.Percentage = percentage } -func (p *taskEntity) SetIsIndeterminate(isIndeterminate bool) { - p.IsIndeterminate = isIndeterminate +func (e *taskEntity) SetIsIndeterminate(isIndeterminate bool) { + e.IsIndeterminate = isIndeterminate } -func (p *taskEntity) SetUserID(userID string) { - p.UserID = userID +func (e *taskEntity) SetUserID(userID string) { + e.UserID = userID } -func (p *taskEntity) SetStatus(status string) { - p.Status = status +func (e *taskEntity) SetStatus(status string) { + e.Status = status } -func (s *taskEntity) SetPayload(p map[string]string) { +func (e *taskEntity) SetPayload(p map[string]string) { if p == nil { - s.Payload = nil + e.Payload = nil } else { b, err := json.Marshal(p) if err != nil { log.GetLogger().Fatal(err) return } - if err := s.Payload.UnmarshalJSON(b); err != nil { + if err := e.Payload.UnmarshalJSON(b); err != nil { log.GetLogger().Fatal(err) } } diff --git a/api/router/snapshot_router.go b/api/router/snapshot_router.go index 21a1e42c1..c3f1bc33a 100644 --- a/api/router/snapshot_router.go +++ b/api/router/snapshot_router.go @@ -62,8 +62,8 @@ func (r *SnapshotRouter) AppendNonJWTRoutes(g fiber.Router) { // @Router /snapshots [get] func (r *SnapshotRouter) List(c *fiber.Ctx) error { var err error - fileId := c.Query("file_id") - if fileId == "" { + fileID := c.Query("file_id") + if fileID == "" { return errorpkg.NewMissingQueryParamError("file_id") } var page int64 @@ -92,7 +92,7 @@ func (r *SnapshotRouter) List(c *fiber.Ctx) error { if !IsValidSortOrder(sortOrder) { return errorpkg.NewInvalidQueryParamError("sort_order") } - res, err := r.snapshotSvc.List(fileId, service.SnapshotListOptions{ + res, err := r.snapshotSvc.List(fileID, service.SnapshotListOptions{ Page: uint(page), Size: uint(size), SortBy: sortBy,