mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-22 00:25:43 +00:00
feat Adding NZD currency (#360)
* Adding NZD as currency option * Updating frontend * Sorting alphabetically * Fixing typo
This commit is contained in:
parent
40e76bac0c
commit
2d768e2b9c
4 changed files with 11 additions and 3 deletions
|
@ -136,6 +136,7 @@ const (
|
||||||
CurrencyZar Currency = "zar"
|
CurrencyZar Currency = "zar"
|
||||||
CurrencyAud Currency = "aud"
|
CurrencyAud Currency = "aud"
|
||||||
CurrencyNok Currency = "nok"
|
CurrencyNok Currency = "nok"
|
||||||
|
CurrencyNzd Currency = "nzd"
|
||||||
CurrencySek Currency = "sek"
|
CurrencySek Currency = "sek"
|
||||||
CurrencyDkk Currency = "dkk"
|
CurrencyDkk Currency = "dkk"
|
||||||
CurrencyInr Currency = "inr"
|
CurrencyInr Currency = "inr"
|
||||||
|
@ -155,7 +156,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, CurrencyCzk:
|
case CurrencyUsd, CurrencyEur, CurrencyGbp, CurrencyJpy, CurrencyZar, CurrencyAud, CurrencyNok, CurrencyNzd, 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", "czk"}, Default: "usd"},
|
{Name: "currency", Type: field.TypeEnum, Enums: []string{"usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "nzd", "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", "czk"),
|
Values("usd", "eur", "gbp", "jpy", "zar", "aud", "nok", "nzd", "sek", "dkk", "inr", "rmb", "bgn", "chf", "pln", "try", "ron", "czk"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ export type Codes =
|
||||||
| "INR"
|
| "INR"
|
||||||
| "JPY"
|
| "JPY"
|
||||||
| "NOK"
|
| "NOK"
|
||||||
|
| "NZD"
|
||||||
| "PLN"
|
| "PLN"
|
||||||
| "RMB"
|
| "RMB"
|
||||||
| "RON"
|
| "RON"
|
||||||
|
@ -73,6 +74,12 @@ export const currencies: Currency[] = [
|
||||||
symbol: "kr",
|
symbol: "kr",
|
||||||
name: "Norwegian Krone",
|
name: "Norwegian Krone",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
code: "NZD",
|
||||||
|
local: "en-NZ",
|
||||||
|
symbol: "NZ$",
|
||||||
|
name: "New Zealand Dollar",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
code: "PLN",
|
code: "PLN",
|
||||||
local: "pl-PL",
|
local: "pl-PL",
|
||||||
|
|
Loading…
Reference in a new issue