QRTR-2 added database migrations to qrtr v1 api backend
This commit is contained in:
parent
033a3f9946
commit
1e00f31022
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
qrtr-venv
|
||||
venv
|
||||
__pycache__
|
||||
|
||||
29
connection/connections/abstract.py
Executable file
29
connection/connections/abstract.py
Executable file
@ -0,0 +1,29 @@
|
||||
from abc import (ABCMeta, abstractmethod, )
|
||||
import datetime
|
||||
|
||||
|
||||
class AbstractConnectionClient(metaclass=ABCMeta):
|
||||
"""
|
||||
Clients for connections in this application will be based on this class
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self, credentials):
|
||||
"""
|
||||
Make a connection to the network and returns a client for accessing
|
||||
data.
|
||||
|
||||
Arguments:
|
||||
credentials {json} -- credentials needed by the client to connect
|
||||
"""
|
||||
self.credentials = credentials
|
||||
|
||||
@abstractmethod
|
||||
def get_transactions(self, start_datetime, end_datetime):
|
||||
"""Pulls a list of all transactions available between start and end
|
||||
times.
|
||||
|
||||
Arguments:
|
||||
start_datetime {datetime} -- datetime representing start time
|
||||
end_datetime {datetime} -- datetime representing end time
|
||||
"""
|
||||
24
connection/migrations/0001_initial.py
Normal file
24
connection/migrations/0001_initial.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 2.2.6 on 2019-11-26 02:09
|
||||
|
||||
from django.db import migrations, models
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Connection',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('connection_path', models.CharField(max_length=255)),
|
||||
('credentials', jsonfield.fields.JSONField(default=dict)),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
connection/migrations/__init__.py
Normal file
0
connection/migrations/__init__.py
Normal file
66
qrtr_account/migrations/0001_initial.py
Normal file
66
qrtr_account/migrations/0001_initial.py
Normal file
@ -0,0 +1,66 @@
|
||||
# Generated by Django 2.2.6 on 2019-11-26 02:09
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import jsonfield.fields
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('connection', '__first__'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Account',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=250)),
|
||||
('admin_users', models.ManyToManyField(related_name='admin_accounts', to=settings.AUTH_USER_MODEL)),
|
||||
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('view_users', models.ManyToManyField(related_name='view_accounts', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Bank',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('nickname', models.CharField(max_length=250)),
|
||||
('balance', models.DecimalField(decimal_places=3, max_digits=100)),
|
||||
('ac_type', models.CharField(max_length=250)),
|
||||
('ac_subtype', models.CharField(max_length=250)),
|
||||
('connection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='connection.Connection')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Institution',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Transaction',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('datetime', models.DateTimeField()),
|
||||
('details', jsonfield.fields.JSONField(default=dict)),
|
||||
('Bank', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='qrtr_account.Bank')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bank',
|
||||
name='institution',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banks', to='qrtr_account.Institution'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bank',
|
||||
name='qrtr_account',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='qrtr_account.Account'),
|
||||
),
|
||||
]
|
||||
20
qrtr_account/migrations/0002_auto_20191126_0223.py
Normal file
20
qrtr_account/migrations/0002_auto_20191126_0223.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 2.2.6 on 2019-11-26 02:23
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qrtr_account', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='account',
|
||||
name='owner',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_accounts', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
]
|
||||
24
qrtr_account/migrations/0003_auto_20191126_0227.py
Normal file
24
qrtr_account/migrations/0003_auto_20191126_0227.py
Normal file
@ -0,0 +1,24 @@
|
||||
# Generated by Django 2.2.6 on 2019-11-26 02:27
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qrtr_account', '0002_auto_20191126_0223'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='account',
|
||||
name='admin_users',
|
||||
field=models.ManyToManyField(blank=True, related_name='admin_accounts', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='account',
|
||||
name='view_users',
|
||||
field=models.ManyToManyField(blank=True, related_name='view_accounts', to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
]
|
||||
23
qrtr_account/migrations/0004_auto_20191126_0231.py
Normal file
23
qrtr_account/migrations/0004_auto_20191126_0231.py
Normal file
@ -0,0 +1,23 @@
|
||||
# Generated by Django 2.2.6 on 2019-11-26 02:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qrtr_account', '0003_auto_20191126_0227'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='bank',
|
||||
name='ac_subtype',
|
||||
field=models.CharField(blank=True, max_length=250),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='bank',
|
||||
name='ac_type',
|
||||
field=models.CharField(blank=True, max_length=250),
|
||||
),
|
||||
]
|
||||
Loading…
Reference in New Issue
Block a user