antempus / coin-bot

Add/Remove coins for slack users, using Azure Function Apps and backed by Azure Storage Queue & Cosmos DB
0 stars 0 forks source link

Add recent changes to records #6

Open antempus opened 4 years ago

antempus commented 4 years ago

For each user, they should have a property (history) that contains the last operations made by other users, when it occurred, qty changed, and change op (rm, add), for each of the coin types. This can be used to prevent a single user from spamming repeated operations or rollback the last change.

Ex:

{
    "id": "user_312",
    "type": "user",
    // user record
    "history": [
        {
            "coinType": "dogecoin",
            "transactions": [
                {
                    "user": "user_1",
                    "time": 1603519700,
                    "qty": 12,
                    "op": "add"
                }
            ]
        },
        {
            "coinType": "litecoin",
            "transactions": [
                {
                    "user": "user_2",
                    "time": 1603512100,
                    "qty": 5,
                    "op": "rm"
                }
            ]
        }
    ]
}
antempus commented 4 years ago

Looking into rate-limiting a single user across all users/coins could also be valuable.