diff --git a/server/server/api/management/commands/seed.py b/server/server/api/management/commands/seed.py new file mode 100644 index 0000000..05dcbe8 --- /dev/null +++ b/server/server/api/management/commands/seed.py @@ -0,0 +1,29 @@ +from server.server.api.models import Transaction +from django.core.management.base import BaseCommand +import random + +class Command(BaseCommand): + help = "Seed database for dev" + + def handle(self, *args, **options): + self.stdout.write('clearing and seeding database...') + + User.objects.all().delete() + # create seed users + # - elijah / toffee15 + # - toffee / toffee15 + + Account.objects.all().delete() + # create seed accounts + # Home Account + # $3000 + # - home expenses + Stack.objects.all().delete() + # create test stacks + # - name: shit + + + Transaction.objects.all().delete() + # generate transaction history + + self.stdout.write('done!') \ No newline at end of file diff --git a/server/server/api/management/commands/seeds.yml b/server/server/api/management/commands/seeds.yml new file mode 100644 index 0000000..ede67d4 --- /dev/null +++ b/server/server/api/management/commands/seeds.yml @@ -0,0 +1,27 @@ +users: + - name: elijah + password: toffee15 + - name: toffee + password: toffee15 + +accounts: + - id: 1 + name: Toffee and Elijah Home + details: some shit about this account + income: 4000 + expenses: 2000 + # add both users to this account + +stacks: # account: 1 + # details can be optional + - name: shit + details: for shit + amount: 400 + - name: stuff + details: for all the stuff + amount: 200 + - name: crap + details: buy some crap + amount: 500 +# Eventually generate transactions for a few months +# for historial analytics and spending trend data viz