removing gorm struct tags (#491)

This commit is contained in:
Mike Arpaia 2016-11-16 09:48:43 -08:00 committed by GitHub
parent c1866c48c4
commit 587d5c9a09
5 changed files with 19 additions and 19 deletions

View file

@ -59,13 +59,13 @@ type InvitePayload struct {
type Invite struct {
UpdateCreateTimestamps
DeleteFields
ID uint `json:"id" gorm:"primary_key"`
InvitedBy uint `json:"invited_by" gorm:"not null" db:"invited_by"`
Email string `json:"email" gorm:"not null;unique_index:idx_invite_unique_email"`
ID uint `json:"id"`
InvitedBy uint `json:"invited_by" db:"invited_by"`
Email string `json:"email"`
Admin bool `json:"admin"`
Name string `json:"name"`
Position string `json:"position,omitempty"`
Token string `json:"-" gorm:"not null;unique_index:idx_invite_unique_key"`
Token string `json:"-"`
}
// TODO: fixme

View file

@ -46,13 +46,13 @@ type PackService interface {
type Pack struct {
UpdateCreateTimestamps
DeleteFields
ID uint `json:"id" gorm:"primary_key"`
Name string `json:"name" gorm:"not null;unique_index:idx_pack_unique_name"`
ID uint `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"`
}
type PackQuery struct {
ID uint `gorm:"primary_key"`
ID uint
CreatedAt time.Time
UpdatedAt time.Time
PackID uint
@ -60,7 +60,7 @@ type PackQuery struct {
}
type PackTarget struct {
ID uint `gorm:"primary_key"`
ID uint
PackID uint
Target
}

View file

@ -69,10 +69,10 @@ type SessionService interface {
// Session is the model object which represents what an active session is
type Session struct {
CreateTimestamp
ID uint `gorm:"primary_key"`
ID uint
AccessedAt time.Time `db:"accessed_at"`
UserID uint `gorm:"not null" db:"user_id"`
Key string `gorm:"not null;unique_index:idx_session_unique_key"`
UserID uint
Key string
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -11,7 +11,7 @@ type CreateTimestamp struct {
// delete record in the database. We mark it deleted, records with Deleted
// set to true will not normally be included in results
type DeleteFields struct {
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at" gorm:"-"`
DeletedAt *time.Time `json:"deleted_at" db:"deleted_at"`
Deleted bool `json:"deleted"`
}

View file

@ -56,14 +56,14 @@ type UserService interface {
type User struct {
UpdateCreateTimestamps
DeleteFields
ID uint `json:"id" gorm:"primary_key"`
Username string `json:"username" gorm:"not null;unique_index:idx_user_unique_username"`
Password []byte `json:"-" gorm:"not null"`
Salt string `json:"-" gorm:"not null"`
ID uint `json:"id"`
Username string `json:"username"`
Password []byte `json:"-"`
Salt string `json:"-"`
Name string `json:"name"`
Email string `json:"email" gorm:"not null;unique_index:idx_user_unique_email"`
Admin bool `json:"admin" gorm:"not null"`
Enabled bool `json:"enabled" gorm:"not null"`
Email string `json:"email"`
Admin bool `json:"admin"`
Enabled bool `json:"enabled"`
AdminForcedPasswordReset bool `json:"force_password_reset" db:"admin_forced_password_reset"`
GravatarURL string `json:"gravatar_url" db:"gravatar_url"`
Position string `json:"position,omitempty"` // job role