mirror of
https://github.com/hazemKrimi/crimson-vault.git
synced 2026-05-01 18:20:27 +00:00
chore: refactoring and fixes for the invoices api
This commit is contained in:
@@ -16,6 +16,7 @@ func (db *DB) CreateItem(userId, invoiceId uuid.UUID, body types.CreateItemReque
|
||||
Name: body.Name,
|
||||
Type: body.Type,
|
||||
Quantity: body.Quantity,
|
||||
Price: body.Price,
|
||||
Tax: body.Tax,
|
||||
}
|
||||
|
||||
@@ -135,6 +136,7 @@ func (db *DB) UpdateItem(userId, id uuid.UUID, body types.UpdateItemRequestBody,
|
||||
Name: body.Name,
|
||||
Type: body.Type,
|
||||
Quantity: body.Quantity,
|
||||
Price: body.Price,
|
||||
Tax: body.Tax,
|
||||
})
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ func (db *DB) CreateUser(body types.CreateUserRequestBody) (types.User, error) {
|
||||
user := types.User{
|
||||
ID: uuid.New().String(),
|
||||
SessionID: uuid.New().String(),
|
||||
Username: strings.ToLower(body.Username),
|
||||
Name: body.Name,
|
||||
FiscalCode: body.FiscalCode,
|
||||
Address: body.Address,
|
||||
@@ -81,6 +82,7 @@ func (db *DB) UpdateUser(id uuid.UUID, body types.UpdateUserRequestBody, user *t
|
||||
}
|
||||
|
||||
result = db.instance.Model(user).Updates(types.User{
|
||||
Username: strings.ToLower(body.Username),
|
||||
Name: body.Name,
|
||||
FiscalCode: body.FiscalCode,
|
||||
Address: body.Address,
|
||||
@@ -88,7 +90,6 @@ func (db *DB) UpdateUser(id uuid.UUID, body types.UpdateUserRequestBody, user *t
|
||||
Country: body.Country,
|
||||
Phone: body.Phone,
|
||||
Email: body.Email,
|
||||
Username: strings.ToLower(body.Username),
|
||||
})
|
||||
|
||||
if result.Error != nil {
|
||||
|
||||
Reference in New Issue
Block a user