mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
refactor: migrate to latest gorm version
refactor: language mappings implementation
This commit is contained in:
17
models/language_mapping.go
Normal file
17
models/language_mapping.go
Normal file
@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
type LanguageMapping struct {
|
||||
ID uint `json:"id" gorm:"primary_key"`
|
||||
User *User `json:"-" gorm:"not null"`
|
||||
UserID string `json:"-" gorm:"not null; index:idx_language_mapping_user; uniqueIndex:idx_language_mapping_composite"`
|
||||
Extension string `json:"extension" gorm:"uniqueIndex:idx_language_mapping_composite"`
|
||||
Language string `json:"language"`
|
||||
}
|
||||
|
||||
func validateLanguage(language string) bool {
|
||||
return len(language) >= 1
|
||||
}
|
||||
|
||||
func validateExtension(extension string) bool {
|
||||
return len(extension) >= 1
|
||||
}
|
Reference in New Issue
Block a user