mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-22 00:25:43 +00:00
feat: add czech currency (#323)
This commit is contained in:
parent
1f47d96e4c
commit
dc08dbbd7a
4 changed files with 11 additions and 3 deletions
|
@ -145,6 +145,7 @@ const (
|
||||||
CurrencyPln Currency = "pln"
|
CurrencyPln Currency = "pln"
|
||||||
CurrencyTry Currency = "try"
|
CurrencyTry Currency = "try"
|
||||||
CurrencyRon Currency = "ron"
|
CurrencyRon Currency = "ron"
|
||||||
|
CurrencyCzk Currency = "czk"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c Currency) String() string {
|
func (c Currency) String() string {
|
||||||
|
@ -154,7 +155,7 @@ func (c Currency) String() string {
|
||||||
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
// CurrencyValidator is a validator for the "currency" field enum values. It is called by the builders before save.
|
||||||
func CurrencyValidator(c Currency) error {
|
func CurrencyValidator(c Currency) error {
|
||||||
switch c {
|
switch c {
|
||||||
case CurrencyUsd, CurrencyEur, CurrencyGbp, CurrencyJpy, CurrencyZar, CurrencyAud, CurrencyNok, CurrencySek, CurrencyDkk, CurrencyInr, CurrencyRmb, CurrencyBgn, CurrencyChf, CurrencyPln, CurrencyTry, CurrencyRon:
|
case CurrencyUsd, CurrencyEur, CurrencyGbp, CurrencyJpy, CurrencyZar, CurrencyAud, CurrencyNok, CurrencySek, CurrencyDkk, CurrencyInr, CurrencyRmb, CurrencyBgn, CurrencyChf, CurrencyPln, CurrencyTry, CurrencyRon, CurrencyCzk:
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
return fmt.Errorf("group: invalid enum value for currency field: %q", c)
|
||||||
|
|
|
@ -116,7 +116,7 @@ var (
|
||||||
{Name: "created_at", Type: field.TypeTime},
|
{Name: "created_at", Type: field.TypeTime},
|
||||||
{Name: "updated_at", Type: field.TypeTime},
|
{Name: "updated_at", Type: field.TypeTime},
|
||||||
{Name: "name", Type: field.TypeString, Size: 255},
|
{Name: "name", Type: field.TypeString, Size: 255},
|
||||||
{Name: "currency", Type: field.TypeEnum, Enums: []string{"usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb", "bgn", "chf", "pln", "try", "ron"}, Default: "usd"},
|
{Name: "currency", Type: field.TypeEnum, Enums: []string{"usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb", "bgn", "chf", "pln", "try", "ron", "czk"}, Default: "usd"},
|
||||||
}
|
}
|
||||||
// GroupsTable holds the schema information for the "groups" table.
|
// GroupsTable holds the schema information for the "groups" table.
|
||||||
GroupsTable = &schema.Table{
|
GroupsTable = &schema.Table{
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (Group) Fields() []ent.Field {
|
||||||
NotEmpty(),
|
NotEmpty(),
|
||||||
field.Enum("currency").
|
field.Enum("currency").
|
||||||
Default("usd").
|
Default("usd").
|
||||||
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb", "bgn", "chf", "pln", "try", "ron"),
|
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "sek", "dkk", "inr", "rmb", "bgn", "chf", "pln", "try", "ron", "czk"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ export type Codes =
|
||||||
| "AUD"
|
| "AUD"
|
||||||
| "BGN"
|
| "BGN"
|
||||||
| "CHF"
|
| "CHF"
|
||||||
|
| "CZK"
|
||||||
| "DKK"
|
| "DKK"
|
||||||
| "EUR"
|
| "EUR"
|
||||||
| "GBP"
|
| "GBP"
|
||||||
|
@ -120,4 +121,10 @@ export const currencies: Currency[] = [
|
||||||
symbol: "chf",
|
symbol: "chf",
|
||||||
name: "Swiss Francs",
|
name: "Swiss Francs",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
code: "CZK",
|
||||||
|
local: "cs-CZ",
|
||||||
|
symbol: "Kč",
|
||||||
|
name: "Czech Koruna",
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue