Skip to content

Commit

Permalink
Merge branch 'main' into feat/segmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba committed Aug 8, 2024
2 parents 8f6e041 + 1d8b54e commit 418866a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
84 changes: 42 additions & 42 deletions api/repo/task_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
6 changes: 3 additions & 3 deletions api/router/snapshot_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion conversion/pipeline/mosaic_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 418866a

Please sign in to comment.