-
Notifications
You must be signed in to change notification settings - Fork 6
/
team.go
40 lines (35 loc) · 1.14 KB
/
team.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Copyright 2021 Adevinta
*/
package api
import (
"time"
)
type Team struct {
ID string `gorm:"primary_key;AUTO_INCREMENT" json:"id" sql:"DEFAULT:gen_random_uuid()"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
Tag string `json:"tag" validate:"required"`
CreatedAt *time.Time `json:"-"`
UpdatedAt *time.Time `json:"-"`
Assets []*Asset `json:"assets"` // This line is infered from other tables.
UserTeam []*UserTeam `json:"user_team"` // This line is infered from other tables.
Groups []*Group
UsingTracker bool `json:"using_tracker" sql:"-"` // feature flag.
}
func (t Team) ToResponse() *TeamResponse {
response := &TeamResponse{}
response.ID = t.ID
response.Name = t.Name
response.Description = t.Description
response.Tag = t.Tag
response.UsingTracker = t.UsingTracker
return response
}
type TeamResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Tag string `json:"tag"`
UsingTracker bool `json:"using_tracker"` // feature flag.
}