made rough-in seed file, and seed.yml
This commit is contained in:
parent
32705a486d
commit
5e5c539ee7
29
server/server/api/management/commands/seed.py
Normal file
29
server/server/api/management/commands/seed.py
Normal file
|
@ -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!')
|
27
server/server/api/management/commands/seeds.yml
Normal file
27
server/server/api/management/commands/seeds.yml
Normal file
|
@ -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
|
Loading…
Reference in New Issue
Block a user