From 79c7e547bb68517b7481ac16e84d51dac47031af Mon Sep 17 00:00:00 2001
From: Alexis Poyen <apoyen@mail.apoyen.fr>
Date: Wed, 6 May 2020 11:46:13 +0200
Subject: [PATCH] Refactor : move back UserClient struct in model

---
 internal/models/clients.go | 13 -------------
 internal/models/models.go  | 12 ++++++++++++
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/internal/models/clients.go b/internal/models/clients.go
index bf958d3..d1af93b 100644
--- a/internal/models/clients.go
+++ b/internal/models/clients.go
@@ -5,23 +5,10 @@ import (
 	"net/http"
 	"strconv"
 	"strings"
-	"time"
 
 	"forge.grandlyon.com/apoyen/sdk-go/internal/auth"
 )
 
-// UserClient has many BankAccounts and one UserBanker
-type UserClient struct {
-	ID           uint       `gorm:"primary_key"`
-	CreatedAt    time.Time  `json:"-"`
-	UpdatedAt    time.Time  `json:"-"`
-	DeletedAt    *time.Time `json:"-"`
-	UserID       int        `gorm:"not null;unique"`
-	Name         string
-	UserBankerID uint
-	BankAccounts []BankAccount
-}
-
 // HandleClients expose the UserClients API
 func (d *DataHandler) HandleClients(w http.ResponseWriter, r *http.Request) {
 	id, _ := strconv.Atoi(strings.TrimPrefix(r.URL.Path, "/api/UserClients/"))
diff --git a/internal/models/models.go b/internal/models/models.go
index 8d5a473..fffe502 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -84,6 +84,18 @@ type UserBanker struct {
 	UserClients []UserClient
 }
 
+// UserClient has many BankAccounts and one UserBanker
+type UserClient struct {
+	ID           uint       `gorm:"primary_key"`
+	CreatedAt    time.Time  `json:"-"`
+	UpdatedAt    time.Time  `json:"-"`
+	DeletedAt    *time.Time `json:"-"`
+	UserID       int        `gorm:"not null;unique"`
+	Name         string
+	UserBankerID uint
+	BankAccounts []BankAccount
+}
+
 // BankAccount belongs to an UserClient
 type BankAccount struct {
 	ID            uint       `gorm:"primary_key"`
-- 
GitLab