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
|
@ -28,7 +28,7 @@ func NewGroupRepository(db *ent.Client) *GroupRepository {
|
|||
Name: g.Name,
|
||||
CreatedAt: g.CreatedAt,
|
||||
UpdatedAt: g.UpdatedAt,
|
||||
Currency: strings.ToUpper(g.Currency.String()),
|
||||
Currency: strings.ToUpper(g.Currency),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,11 +265,9 @@ func (r *GroupRepository) GroupCreate(ctx context.Context, name string) (Group,
|
|||
}
|
||||
|
||||
func (r *GroupRepository) GroupUpdate(ctx context.Context, ID uuid.UUID, data GroupUpdate) (Group, error) {
|
||||
currency := group.Currency(strings.ToLower(data.Currency))
|
||||
|
||||
entity, err := r.db.Group.UpdateOneID(ID).
|
||||
SetName(data.Name).
|
||||
SetCurrency(currency).
|
||||
SetCurrency(strings.ToLower(data.Currency)).
|
||||
Save(ctx)
|
||||
|
||||
return r.groupMapper.MapErr(entity, err)
|
||||
|
|
|
@ -68,7 +68,7 @@ type (
|
|||
ItemUpdate struct {
|
||||
ParentID uuid.UUID `json:"parentId" extensions:"x-nullable,x-omitempty"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
AssetID AssetID `json:"assetId"`
|
||||
AssetID AssetID `json:"assetId" swaggertype:"string"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Quantity int `json:"quantity"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue