Add some changes.
I no longer know what they mean, I found them many years later.
This commit is contained in:
parent
79b2bf0f1f
commit
9783960857
|
@ -13,6 +13,8 @@ def do_all():
|
|||
|
||||
def transactions(source, account):
|
||||
body = vanth.ofx.query_transactions(source, account)
|
||||
response = requests.post('https://ofx.americafirst.com/', data=body, headers={'Content-Type': 'application/x-ofx'})
|
||||
url = 'https://ofx.americafirst.com/'
|
||||
response = requests.post(url, data=body, headers={'Content-Type': 'application/x-ofx'})
|
||||
assert response.ok, response.text
|
||||
return vanth.ofx.parse(response.text)
|
||||
LOGGER.debug("Response from %s: %s %d bytes", url, response.status_code, len(response.text))
|
||||
return parse(response.text)
|
||||
|
|
|
@ -15,7 +15,7 @@ def parse(args):
|
|||
if supplied is None:
|
||||
missing_parameters.append(key)
|
||||
else:
|
||||
values[key] = converter(supplied)
|
||||
values[key] = converter(supplied) if converter else supplied
|
||||
if missing_parameters:
|
||||
return (json.dumps({'errors': [{
|
||||
'title' : "Missing required paramter '{}'".format(parameter),
|
||||
|
|
|
@ -65,6 +65,7 @@ def by_user(user_id):
|
|||
query = query.where(
|
||||
vanth.tables.OFXAccount.c.owner == user_id
|
||||
)
|
||||
LOGGER.debug(query)
|
||||
return _execute_and_convert(query)
|
||||
|
||||
def create(values):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import chryso.constants
|
||||
from sqlalchemy import (Column, Date, DateTime, ForeignKey, Integer, MetaData,
|
||||
Numeric, String, Table, UniqueConstraint, func, text)
|
||||
from sqlalchemy import (Column, Date, DateTime, ForeignKey, Integer,
|
||||
Numeric, MetaData, String, Table, UniqueConstraint, func, text)
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
metadata = MetaData(naming_convention=chryso.constants.CONVENTION)
|
||||
|
@ -75,3 +75,46 @@ OFXRecord = table('ofxrecord',
|
|||
Column('posted', Date(), nullable=True), # The date the record posted
|
||||
Column('type', String(255), nullable=True), # The type of the record, like 'POS'
|
||||
)
|
||||
|
||||
Pool = table('pool',
|
||||
Column('balance', Integer(), nullable=False), # The balance of the pool, like -10 or +12
|
||||
Column('name', String(255), nullable=False), # The name of the pool, like 'Bills' or 'Heating oil'
|
||||
Column('parent', None, ForeignKey('pool.uuid', name='fk_parent'), nullable=True),
|
||||
Column('user_uri', String(2048), nullable=False), # The URI of the user that created the record
|
||||
UniqueConstraint('name', 'user_uri', name='pool_name_by_user')
|
||||
)
|
||||
|
||||
Spring = table('spring',
|
||||
Column('description', String(1024), nullable=False), # A user-significant description
|
||||
Column('name', String(256), nullable=False), # A user-significant name
|
||||
Column('user_uri', String(2048), nullable=False), # The URI of the user that created the record
|
||||
UniqueConstraint('name', 'user_uri', name='sprint_name_by_user')
|
||||
)
|
||||
|
||||
Sink = table('drain',
|
||||
Column('description', String(1024), nullable=False), # A user-significant description
|
||||
Column('name', String(256), nullable=False), # A user-significant name
|
||||
Column('user_uri', String(2048), nullable=False), # The URI of the user that created the record
|
||||
UniqueConstraint('name', 'user_uri', name='sink_name_by_user')
|
||||
)
|
||||
|
||||
Flow = table('flow',
|
||||
Column('amount', Numeric(precision=20, scale=2, asdecimal=True), nullable=False), # The amount like -$177.91
|
||||
Column('description', String(1024), nullable=False), # The description that is meaningful to the user
|
||||
Column('destination', None, ForeignKey(Pool.c.uuid, name='fk_destination'), nullable=True), # The pool that receives the amount
|
||||
Column('source', None, ForeignKey(Pool.c.uuid, name='fk_source'), nullable=True), # The pool that originally provides the amount
|
||||
)
|
||||
|
||||
Inflow = table('inflow',
|
||||
Column('amount', Numeric(precision=20, scale=2, asdecimal=True), nullable=False), # The amount like -$177.91
|
||||
Column('description', String(1024), nullable=False), # The description that is meaningful to the user
|
||||
Column('destination', None, ForeignKey(Pool.c.uuid, name='fk_destination'), nullable=False), # The pool that receives the amount
|
||||
Column('source', None, ForeignKey(Spring.c.uuid, name='fk_source'), nullable=False), # The sprint that originally provided the amount
|
||||
)
|
||||
|
||||
Outflow = table('outflow',
|
||||
Column('amount', Numeric(precision=20, scale=2, asdecimal=True), nullable=False), # The amount like -$177.91
|
||||
Column('description', String(1024), nullable=False), # The description that is meaningful to the user
|
||||
Column('destination', None, ForeignKey(Sink.c.uuid, name='fk_destination'), nullable=False), # The sink that receives the amount
|
||||
Column('source', None, ForeignKey(Pool.c.uuid, name='fk_source'), nullable=False), # The pool that originally provided the amount
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue