Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMaster482 committed Dec 28, 2023
1 parent 2299cd2 commit 0cce87e
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions internal/microservices/IOhub/delivery/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,10 @@ func (h *Handler) ImportTransactions(w http.ResponseWriter, r *http.Request) {

if len(record) < 8 {
continue
// response.ErrorResponse(w, http.StatusBadRequest, err, "wrong format not enough args for transaction", h.logger)
// return
}

if len(record) > 9 {
continue
// response.ErrorResponse(w, http.StatusBadRequest, err, "wrong format too much args for transaction", h.logger)
// return
}

accountIncome := record[0]
Expand Down Expand Up @@ -340,21 +336,23 @@ func (h *Handler) ImportTransactions(w http.ResponseWriter, r *http.Request) {
if value, ok := tagCache.Load(tagName); ok {
tagId = value.(uuid.UUID)
} else {
tag, err := h.tagService.CreateTag(r.Context(), &generated.CreateTagRequest{
UserId: user.ID.String(),
Name: tagName,
Image: 0,
ShowIncome: false,
Regular: false,
ShowOutcome: true,
})
if err != nil {
response.ErrorResponse(w, http.StatusInternalServerError, err, "Import error tag add failed", h.logger)
return
if tagName != "" {
tag, err := h.tagService.CreateTag(r.Context(), &generated.CreateTagRequest{
UserId: user.ID.String(),
Name: tagName,
Image: 0,
ShowIncome: false,
Regular: false,
ShowOutcome: true,
})
if err != nil {
response.ErrorResponse(w, http.StatusInternalServerError, err, "Import error tag add failed", h.logger)
return
}

tagId, _ = uuid.Parse(tag.TagId)
tagCache.Store(tagName, tagId)
}

tagId, _ = uuid.Parse(tag.TagId)
tagCache.Store(tagName, tagId)
}

// Parse the record to a Transaction struct
Expand Down

0 comments on commit 0cce87e

Please sign in to comment.