From a44351f3322b524981cd3d3b5fa183b42a382ee6 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 16 Sep 2020 16:24:03 +0200 Subject: [PATCH] Person: Refactor / rename entity fields #98 #144 Signed-off-by: Michael Mayer --- frontend/src/common/session.js | 2 +- frontend/src/model/user.js | 15 ++++++++------- internal/entity/person.go | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/frontend/src/common/session.js b/frontend/src/common/session.js index b1c9e94db..ea5d959b3 100644 --- a/frontend/src/common/session.js +++ b/frontend/src/common/session.js @@ -132,7 +132,7 @@ export default class Session { getEmail() { if (this.isUser()) { - return this.user.Email; + return this.user.PrimaryEmail; } return ""; diff --git a/frontend/src/model/user.js b/frontend/src/model/user.js index 105e5b1b6..459e51049 100644 --- a/frontend/src/model/user.js +++ b/frontend/src/model/user.js @@ -40,7 +40,6 @@ export class User extends RestModel { Address: {}, ParentUID: "", GlobalUID: "", - UserName: "", DisplayName: "", DisplayLocation: "", DisplayBio: "", @@ -48,11 +47,13 @@ export class User extends RestModel { GivenName: "", FamilyName: "", NameSuffix: "", - Email: "", + PrimaryEmail: "", BackupEmail: "", - URL: "", + PersonURL: "", + PersonPhone: "", + PersonStatus: "", + PersonAvatar: "", CompanyURL: "", - Phone: "", CompanyPhone: "", CompanyName: "", DepartmentName: "", @@ -60,9 +61,9 @@ export class User extends RestModel { BirthYear: -1, BirthMonth: -1, BirthDay: -1, - Status: "", - Avatar: "", - Active: false, + UserName: "", + UserSettings: "", + UserActive: false, TermsAccepted: false, IsArtist: false, IsSubject: false, diff --git a/internal/entity/person.go b/internal/entity/person.go index fdd1e3d48..079857705 100644 --- a/internal/entity/person.go +++ b/internal/entity/person.go @@ -20,7 +20,6 @@ type Person struct { PersonUID string `gorm:"type:VARBINARY(42);unique_index;" json:"UID" yaml:"UID"` ParentUID string `gorm:"type:VARBINARY(42);" json:"ParentUID" yaml:"ParentUID,omitempty"` GlobalUID string `gorm:"type:VARBINARY(42);index;" json:"GlobalUID" yaml:"GlobalUID,omitempty"` - UserName string `gorm:"size:64;" json:"UserName" yaml:"UserName,omitempty"` DisplayName string `gorm:"size:128;" json:"DisplayName" yaml:"DisplayName,omitempty"` DisplayLocation string `gorm:"size:128;" json:"DisplayLocation" yaml:"DisplayLocation,omitempty"` DisplayBio string `gorm:"type:TEXT;" json:"DisplayBio" yaml:"DisplayBio,omitempty"` @@ -28,12 +27,14 @@ type Person struct { GivenName string `gorm:"size:128;" json:"GivenName" yaml:"GivenName,omitempty"` FamilyName string `gorm:"size:128;" json:"FamilyName" yaml:"FamilyName,omitempty"` NameSuffix string `gorm:"size:64;" json:"NameSuffix" yaml:"NameSuffix,omitempty"` - UserEmail string `gorm:"size:255;index;" json:"Email" yaml:"Email,omitempty"` - ConfirmToken string `gorm:"type:VARBINARY(128);" json:"-" yaml:"-"` + PrimaryEmail string `gorm:"size:255;index;" json:"PrimaryEmail" yaml:"PrimaryEmail,omitempty"` BackupEmail string `gorm:"size:255;" json:"BackupEmail" yaml:"BackupEmail,omitempty"` - UserURL string `gorm:"type:VARBINARY(255);" json:"URL" yaml:"URL,omitempty"` + PersonURL string `gorm:"type:VARBINARY(255);" json:"PersonURL" yaml:"PersonURL,omitempty"` + PersonPhone string `gorm:"size:32;" json:"PersonPhone" yaml:"PersonPhone,omitempty"` + PersonStatus string `gorm:"type:VARBINARY(32);" json:"PersonStatus" yaml:"PersonStatus,omitempty"` + PersonAvatar string `gorm:"type:VARBINARY(255);" json:"PersonAvatar" yaml:"PersonAvatar,omitempty"` + PersonAccounts string `gorm:"type:LONGTEXT;" json:"-" yaml:"-"` CompanyURL string `gorm:"type:VARBINARY(255);" json:"CompanyURL" yaml:"CompanyURL,omitempty"` - UserPhone string `gorm:"size:32;" json:"Phone" yaml:"Phone,omitempty"` CompanyPhone string `gorm:"size:32;" json:"CompanyPhone" yaml:"CompanyPhone,omitempty"` CompanyName string `gorm:"size:128;" json:"CompanyName" yaml:"CompanyName,omitempty"` DepartmentName string `gorm:"size:128;" json:"DepartmentName" yaml:"DepartmentName,omitempty"` @@ -41,11 +42,9 @@ type Person struct { BirthYear int `json:"BirthYear" yaml:"BirthYear,omitempty"` BirthMonth int `json:"BirthMonth" yaml:"BirthMonth,omitempty"` BirthDay int `json:"BirthDay" yaml:"BirthDay,omitempty"` - UserStatus string `gorm:"type:VARBINARY(255);" json:"Status" yaml:"Status,omitempty"` - UserAvatar string `gorm:"type:VARBINARY(255);" json:"Avatar" yaml:"Avatar,omitempty"` + UserName string `gorm:"size:64;" json:"UserName" yaml:"UserName,omitempty"` UserSettings string `gorm:"type:LONGTEXT;" json:"-" yaml:"-"` - UserAccounts string `gorm:"type:LONGTEXT;" json:"-" yaml:"-"` - UserActive bool `json:"Active" yaml:"Active,omitempty"` + UserActive bool `json:"UserActive" yaml:"UserActive,omitempty"` TermsAccepted bool `json:"TermsAccepted" yaml:"TermsAccepted,omitempty"` IsArtist bool `json:"IsArtist" yaml:"IsArtist,omitempty"` IsSubject bool `json:"IsSubject" yaml:"IsSubject,omitempty"` @@ -56,6 +55,8 @@ type Person struct { RoleFriend bool `json:"RoleFriend" yaml:"RoleFriend,omitempty"` WebDAV bool `gorm:"column:webdav" json:"WebDAV" yaml:"WebDAV,omitempty"` StoragePath string `gorm:"column:storage_path;type:VARBINARY(255);" json:"StoragePath" yaml:"StoragePath,omitempty"` + ConfirmToken string `gorm:"type:VARBINARY(128);" json:"-" yaml:"-"` + ResetToken string `gorm:"type:VARBINARY(128);" json:"-" yaml:"-"` ApiToken string `gorm:"column:api_token;type:VARBINARY(128);" json:"-" yaml:"-"` ApiSecret string `gorm:"column:api_secret;type:VARBINARY(128);" json:"-" yaml:"-"` LoginAttempts int `json:"-" yaml:"-"`