Added create contact ednpoint

This commit is contained in:
Nedim
2023-10-06 10:47:26 +02:00
parent f32b5d5748
commit 314abe0462
15 changed files with 1278 additions and 146 deletions

View File

@@ -47,13 +47,15 @@ func GetInvoices(buyerName string, sortBy string, limit int, offset int, id uint
Find(&invoices).Error; err != nil {
return nil, 0, err
}
for i := range invoices {
var sum int64
for _, item := range invoices[i].InvoiceItem {
if invoices[i].InvoiceItem != nil {
for _, item := range *invoices[i].InvoiceItem {
sum += item.PriceCents * item.Quantity
}
invoices[i].PriceCents = sum
}
}
return invoices, total, nil