diff options
| author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 20:55:48 +0530 | 
|---|---|---|
| committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 20:55:48 +0530 | 
| commit | bc154857fb5569d7c1fa9785cc891cb927a6a156 (patch) | |
| tree | 590c9f6a00a1b97b2ee45cfa5a767558089affe0 /invoice/validators.go | |
| parent | 8a47978ca17d2f251d67d12b0e34fa26bb1e4ace (diff) | |
removed per-user itemsv0.17.0
Diffstat (limited to 'invoice/validators.go')
| -rw-r--r-- | invoice/validators.go | 28 | 
1 files changed, 1 insertions, 27 deletions
diff --git a/invoice/validators.go b/invoice/validators.go index 9f145dc..1c39cbe 100644 --- a/invoice/validators.go +++ b/invoice/validators.go @@ -24,7 +24,7 @@ import (  func (i *Invoice) validate() error {  	var count int64  	err := db.Model(&Invoice{}). -		Where("user_id = ? and invoice_number = ?", i.UserID, i.InvoiceNumber). +		Where("invoice_number = ?", i.InvoiceNumber).  		Count(&count).  		Error @@ -59,29 +59,3 @@ func isDraft(invoiceId uint) (bool, error) {  	return invoice.IsDraft, nil  } - -func checkInvoiceOwnership(invoiceId, userId uint) error { -	var invoice Invoice -	err := db. -		Select("id", "user_id"). -		Where("id = ?", invoiceId). -		Find(&invoice). -		Error - -	// TODO: handle potential errors -	if err != nil { -		return err -  } - -	// invoice doesn't exist -	if invoice.ID == 0 { -		return errors.ErrNotFound -	} - -	// user doesn't own this invoice -	if invoice.UserID != userId { -		return errors.ErrForbidden -	} - -	return nil -}  |