diff options
Diffstat (limited to 'invoice/db_actions.go')
-rw-r--r-- | invoice/db_actions.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/invoice/db_actions.go b/invoice/db_actions.go index a4880fa..0cbeec1 100644 --- a/invoice/db_actions.go +++ b/invoice/db_actions.go @@ -117,3 +117,15 @@ func getTransports(filter bson.M) ([]Transport, error) { err = cursor.All(context.TODO(), &transports) return transports, err } + +func getInvoiceByNumber(invoiceNumber int) (Invoice, error) { + var invoice Invoice + err := db.Collection("Invoices").FindOne(context.TODO(), bson.M{"InvoiceNumber": invoiceNumber}).Decode(&invoice) + return invoice, err +} + +func getInvoiceById(invoiceId primitive.ObjectID) (Invoice, error) { + var invoice Invoice + err := db.Collection("Invoices").FindOne(context.TODO(), bson.M{"_id": invoiceId}).Decode(&invoice) + return invoice, err +} |