Space-Market / API

MIT License
7 stars 3 forks source link

multiple types of transactions #3

Open YtvwlD opened 7 years ago

YtvwlD commented 7 years ago

We currently have a single type of transaction which appears under /audits:

{

    "id": 0,
    "created_at": "2017-09-27T18:45:15Z",
    "difference": 5,
    "product": 0

}

But there are actually at least two different types of transactions here:

We distinguish these via the product and via the difference field.

But there can probably be more types:

I just wanted to hear your opinions about changing the data model of a transaction and how we could achieve transferring money.

mikafinja commented 7 years ago

Transactions in version 3 have a field called action which can either be spend or deposit. A transfer between to users creates two transactions. One on the senders account with the action spend and one on the receivers account with the action deposit, but they are not linked.