Skip to content

Commit

Permalink
style: func rename + remove newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
mgjules committed May 14, 2022
1 parent dcf6edf commit 6f403d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions http/deck.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func DomainDeckToDeckClosed(d *deck.Deck) *DeckClosed {
return &dc
}

// DomainDeckToRepo transforms a domain deck to a repo deck.
func DomainDeckToRepo(d *deck.Deck) *repo.Deck {
// DomainDeckToRepoDeck transforms a domain deck to a repo deck.
func DomainDeckToRepoDeck(d *deck.Deck) *repo.Deck {
var rd repo.Deck
rd.ID = d.ID()
rd.Shuffled = d.IsShuffled()
Expand Down
8 changes: 3 additions & 5 deletions http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *Server) handleCreateDeck() gin.HandlerFunc {
return
}

rd := DomainDeckToRepo(d)
rd := DomainDeckToRepoDeck(d)

if err := s.repo.Save(c, rd); err != nil {
s.log.Errorf("save deck: %v", err)
Expand Down Expand Up @@ -213,8 +213,7 @@ func (s *Server) handleDrawCards() gin.HandlerFunc {
return
}

rd = DomainDeckToRepo(d)

rd = DomainDeckToRepoDeck(d)
if err := s.repo.Save(c, rd); err != nil {
s.log.Errorf("save deck: %v", err)
c.AbortWithStatusJSON(http.StatusInternalServerError, Error{err.Error()})
Expand Down Expand Up @@ -274,8 +273,7 @@ func (s *Server) handleShuffleDeck() gin.HandlerFunc {

d.Shuffle()

rd = DomainDeckToRepo(d)

rd = DomainDeckToRepoDeck(d)
if err := s.repo.Save(c, rd); err != nil {
s.log.Errorf("save deck: %v", err)
c.AbortWithStatusJSON(http.StatusInternalServerError, Error{err.Error()})
Expand Down

0 comments on commit 6f403d0

Please sign in to comment.