1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: add ui for managing aliases (resolve #91)

This commit is contained in:
Ferdinand Mütsch
2021-01-21 00:26:52 +01:00
parent 16b683fcbd
commit d57c02af7c
20 changed files with 865 additions and 365 deletions

View File

@ -8,3 +8,16 @@ type Alias struct {
Key string `gorm:"not null; index:idx_alias_type_key"`
Value string `gorm:"not null"`
}
func (a *Alias) IsValid() bool {
return a.Key != "" && a.Value != "" && a.validateType()
}
func (a *Alias) validateType() bool {
for _, t := range SummaryTypes() {
if a.Type == t {
return true
}
}
return false
}

View File

@ -5,10 +5,17 @@ import "github.com/muety/wakapi/models"
type SettingsViewModel struct {
User *models.User
LanguageMappings []*models.LanguageMapping
Aliases []*SettingsVMCombinedAlias
Success string
Error string
}
type SettingsVMCombinedAlias struct {
Key string
Type uint8
Values []string
}
func (s *SettingsViewModel) WithSuccess(m string) *SettingsViewModel {
s.Success = m
return s