made rough-in seed file, and seed.yml

This commit is contained in:
Elijah Lucian 2021-07-12 21:08:59 -06:00
parent 32705a486d
commit 5e5c539ee7
2 changed files with 56 additions and 0 deletions

View 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!')

View 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