chore: refactoring and fixes for the invoices api

This commit is contained in:
2025-07-28 12:25:22 +01:00
parent 6c37031b00
commit 09ae7e8ce9
6 changed files with 61 additions and 160 deletions
+2
View File
@@ -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,
})
+2 -1
View File
@@ -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 {