Commit 79c7e547 authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Refactor : move back UserClient struct in model

parent edd70c27
Pipeline #5195 passed with stages
in 3 minutes and 24 seconds
......@@ -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/"))
......
......@@ -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"`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment