Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
systemes-dinformation
project-template
SDK-GO
Commits
79c7e547
Commit
79c7e547
authored
May 06, 2020
by
Alexis POYEN
Browse files
Refactor : move back UserClient struct in model
parent
edd70c27
Pipeline
#5195
passed with stages
in 3 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
internal/models/clients.go
View file @
79c7e547
...
...
@@ -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/"
))
...
...
internal/models/models.go
View file @
79c7e547
...
...
@@ -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"`
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment