Forum Academy Marketplace Showcase Pricing Features

Invoice - List of Invoices under customer

I have a basic question here but I would like to know the best way to structure this.

I have a Customer data type and an Invoice data type. Each invoice will have only one customer, each customer can have multiple invoices.

Is it best to have a List of Invoices field in the Customer data type or have a Customer field in the Invoice data type?

Experimenting with it I can pull the report data (customers - all invoices) both ways but I want to structure the app for the least resistance in the future.

I would put a field named “Customer” of type user on the invoice. You can do it any way you please, but for the sake of a clean data structure, that would be my input.

Sometimes it helps to check out how other startups structure their data. Have a look at Stripe’s docs:

https://stripe.com/docs/api#charge_object