feat: move User.PhonePrefix to Organization.PhonePrefix

Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
Kininaru
2021-05-13 09:39:07 +08:00
parent 827930a020
commit 892cb39e3e
11 changed files with 63 additions and 35 deletions

View File

@ -29,6 +29,7 @@ type Organization struct {
Favicon string `xorm:"varchar(100)" json:"favicon"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
PasswordSalt string `xorm:"varchar(100)" json:"passwordSalt"`
PhonePrefix string `xorm:"varchar(10)" json:"phonePrefix"`
}
func GetOrganizations(owner string) []*Organization {
@ -91,3 +92,16 @@ func DeleteOrganization(organization *Organization) bool {
return affected != 0
}
func GetOrganizationByName(name string) *Organization {
var ret Organization
ret.Name = name
has, err := adapter.Engine.Get(&ret)
if err != nil {
panic(err)
}
if !has {
return nil
}
return &ret
}