forked from mirrors/homebox
feat: user defined currencies (#700)
* basic currency service for loading at runtime * api endpoint for currencies * sort slice before return * remove currency validation * validate using currency service * implement selecting dynamic currency options * bump go version * fix type definition * specify explicit type * change go versions * proper types for assetId * log/return currency error * make case insensative * use ToUpper instead * feat: adding new currencies (#715) * fix: task swag (#710) Co-authored-by: Quoing <pavel.cadersky@mavenir.com> * [feat] Adding new currencies --------- Co-authored-by: quoing <quoing@users.noreply.github.com> Co-authored-by: Quoing <pavel.cadersky@mavenir.com> Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com> * remove ts file and consoldate new values into json * move flag to options namespace * add env config for currencies * basic documentaion * remove in sync test --------- Co-authored-by: quoing <quoing@users.noreply.github.com> Co-authored-by: Quoing <pavel.cadersky@mavenir.com> Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com> Former-commit-id: c4b923847a1b695dcddd1b346adcccfd3f3ce706
This commit is contained in:
parent
ce923a5b4c
commit
2b79788fbe
39 changed files with 1226 additions and 328 deletions
|
@ -2340,7 +2340,7 @@ type GroupMutation struct {
|
|||
created_at *time.Time
|
||||
updated_at *time.Time
|
||||
name *string
|
||||
currency *group.Currency
|
||||
currency *string
|
||||
clearedFields map[string]struct{}
|
||||
users map[uuid.UUID]struct{}
|
||||
removedusers map[uuid.UUID]struct{}
|
||||
|
@ -2581,12 +2581,12 @@ func (m *GroupMutation) ResetName() {
|
|||
}
|
||||
|
||||
// SetCurrency sets the "currency" field.
|
||||
func (m *GroupMutation) SetCurrency(gr group.Currency) {
|
||||
m.currency = &gr
|
||||
func (m *GroupMutation) SetCurrency(s string) {
|
||||
m.currency = &s
|
||||
}
|
||||
|
||||
// Currency returns the value of the "currency" field in the mutation.
|
||||
func (m *GroupMutation) Currency() (r group.Currency, exists bool) {
|
||||
func (m *GroupMutation) Currency() (r string, exists bool) {
|
||||
v := m.currency
|
||||
if v == nil {
|
||||
return
|
||||
|
@ -2597,7 +2597,7 @@ func (m *GroupMutation) Currency() (r group.Currency, exists bool) {
|
|||
// OldCurrency returns the old "currency" field's value of the Group entity.
|
||||
// If the Group object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *GroupMutation) OldCurrency(ctx context.Context) (v group.Currency, err error) {
|
||||
func (m *GroupMutation) OldCurrency(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCurrency is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -3105,7 +3105,7 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error {
|
|||
m.SetName(v)
|
||||
return nil
|
||||
case group.FieldCurrency:
|
||||
v, ok := value.(group.Currency)
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue