Skip to content

Commit

Permalink
Merge branch 'multiple-users-working'
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ngr31 committed Feb 27, 2021
2 parents f3aa814 + 2c71fe3 commit 25a47da
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</svg>
</p>

Current version: **1.0-beta4**
Current version: **1.0-beta5**

## About
The idea for this app came from using my Hobonichi Techo planner every morning to write down what I needed to accomplish that day & using it for scratching down random thoughts and notes as the day went on. The closest thing I've seen to an app for replacing this system is Noteplan, but I don't use a Mac or an iOS device, and it's not self-hostable, so I decided to write my own.
Expand Down
4 changes: 2 additions & 2 deletions app/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from app import app, db
from app.model_types import GUID
from sqlalchemy.sql import func
from sqlalchemy.ext.hybrid import hybrid_property, hybrid_method, Comparator
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import event
from sqlalchemy.orm.attributes import InstrumentedAttribute
from Crypto.Cipher import AES
Expand Down Expand Up @@ -91,7 +91,7 @@ class Note(db.Model):
uuid = db.Column(GUID, primary_key=True, index=True, unique=True, default=lambda: uuid.uuid4())
user_id = db.Column(GUID, db.ForeignKey('user.uuid'), nullable=False)
data = db.Column(db.String)
title = db.Column(db.String(128), nullable=False, unique=True)
title = db.Column(db.String(128), nullable=False)
date = db.Column(db.DateTime(timezone=True), server_default=func.now())
is_date = db.Column(db.Boolean, default=False)
meta = db.relationship('Meta', lazy='dynamic', cascade='all, delete, delete-orphan')
Expand Down
2 changes: 0 additions & 2 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from app.models import User, Note, Meta, aes_encrypt, aes_encrypt_old
from flask import render_template, request, jsonify, abort
from flask_jwt_extended import jwt_required, create_access_token, get_jwt_identity
import itertools
import re


@app.route('/api/sign-up', methods=['POST'])
Expand Down
26 changes: 26 additions & 0 deletions migrations/versions/9bd71ed6ccff_remove_unique_constraint_name_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Remove unique constraint name for note title
Revision ID: 9bd71ed6ccff
Revises: c440f31aff28
Create Date: 2021-02-27 15:10:54.803203
"""
from alembic import op
import sqlalchemy as sa
import app.model_types


# revision identifiers, used by Alembic.
revision = '9bd71ed6ccff'
down_revision = 'c440f31aff28'
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table('note', schema=None) as batch_op:
batch_op.drop_constraint('title_uniq', type_='unique')


def downgrade():
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Add named unique constraint name for note title
Revision ID: c440f31aff28
Revises: 7bd1ee1840ca
Create Date: 2021-02-27 08:59:27.748780
"""
from alembic import op
import sqlalchemy as sa
import app.model_types


# revision identifiers, used by Alembic.
revision = 'c440f31aff28'
down_revision = '7bd1ee1840ca'
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table('note', schema=None) as batch_op:
batch_op.create_unique_constraint('title_uniq', ['title'])


def downgrade():
with op.batch_alter_table('note', schema=None) as batch_op:
pass

0 comments on commit 25a47da

Please sign in to comment.