From 5a3dd7d9a0e79ca269dc150c4468c5ecc79c4e70 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:59:50 -0800 Subject: [PATCH 01/25] finished set up --- app/models/__init__.py | 2 + app/models/board.py | 5 ++ app/models/card.py | 5 ++ migrations/README | 1 + migrations/alembic.ini | 45 ++++++++++++++++++ migrations/env.py | 96 +++++++++++++++++++++++++++++++++++++++ migrations/script.py.mako | 24 ++++++++++ 7 files changed, 178 insertions(+) create mode 100644 migrations/README create mode 100644 migrations/alembic.ini create mode 100644 migrations/env.py create mode 100644 migrations/script.py.mako diff --git a/app/models/__init__.py b/app/models/__init__.py index e69de29b..cf00f458 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -0,0 +1,2 @@ +from app.models.board import Board +from app.models.card import Card \ No newline at end of file diff --git a/app/models/board.py b/app/models/board.py index 147eb748..c7c454be 100644 --- a/app/models/board.py +++ b/app/models/board.py @@ -1 +1,6 @@ from app import db + +class Board(db.Model): + board_id = db.Column(db.Integer, primary_key=True, autoincrement=True) + title = db.Column(db.String) + owner = db.Column(db.String) \ No newline at end of file diff --git a/app/models/card.py b/app/models/card.py index 147eb748..331beb03 100644 --- a/app/models/card.py +++ b/app/models/card.py @@ -1 +1,6 @@ from app import db + +class Card(db.Model): + card_id = db.Column(db.Integer, primary_key=True, autoincrement=True) + message = db.Column(db.String) + likes_count = db.Column(db.String) \ No newline at end of file diff --git a/migrations/README b/migrations/README new file mode 100644 index 00000000..98e4f9c4 --- /dev/null +++ b/migrations/README @@ -0,0 +1 @@ +Generic single-database configuration. \ No newline at end of file diff --git a/migrations/alembic.ini b/migrations/alembic.ini new file mode 100644 index 00000000..f8ed4801 --- /dev/null +++ b/migrations/alembic.ini @@ -0,0 +1,45 @@ +# A generic, single database configuration. + +[alembic] +# template used to generate migration files +# file_template = %%(rev)s_%%(slug)s + +# set to 'true' to run the environment during +# the 'revision' command, regardless of autogenerate +# revision_environment = false + + +# Logging configuration +[loggers] +keys = root,sqlalchemy,alembic + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARN +handlers = console +qualname = + +[logger_sqlalchemy] +level = WARN +handlers = +qualname = sqlalchemy.engine + +[logger_alembic] +level = INFO +handlers = +qualname = alembic + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(levelname)-5.5s [%(name)s] %(message)s +datefmt = %H:%M:%S diff --git a/migrations/env.py b/migrations/env.py new file mode 100644 index 00000000..8b3fb335 --- /dev/null +++ b/migrations/env.py @@ -0,0 +1,96 @@ +from __future__ import with_statement + +import logging +from logging.config import fileConfig + +from sqlalchemy import engine_from_config +from sqlalchemy import pool +from flask import current_app + +from alembic import context + +# this is the Alembic Config object, which provides +# access to the values within the .ini file in use. +config = context.config + +# Interpret the config file for Python logging. +# This line sets up loggers basically. +fileConfig(config.config_file_name) +logger = logging.getLogger('alembic.env') + +# add your model's MetaData object here +# for 'autogenerate' support +# from myapp import mymodel +# target_metadata = mymodel.Base.metadata +config.set_main_option( + 'sqlalchemy.url', + str(current_app.extensions['migrate'].db.engine.url).replace('%', '%%')) +target_metadata = current_app.extensions['migrate'].db.metadata + +# other values from the config, defined by the needs of env.py, +# can be acquired: +# my_important_option = config.get_main_option("my_important_option") +# ... etc. + + +def run_migrations_offline(): + """Run migrations in 'offline' mode. + + This configures the context with just a URL + and not an Engine, though an Engine is acceptable + here as well. By skipping the Engine creation + we don't even need a DBAPI to be available. + + Calls to context.execute() here emit the given string to the + script output. + + """ + url = config.get_main_option("sqlalchemy.url") + context.configure( + url=url, target_metadata=target_metadata, literal_binds=True + ) + + with context.begin_transaction(): + context.run_migrations() + + +def run_migrations_online(): + """Run migrations in 'online' mode. + + In this scenario we need to create an Engine + and associate a connection with the context. + + """ + + # this callback is used to prevent an auto-migration from being generated + # when there are no changes to the schema + # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html + def process_revision_directives(context, revision, directives): + if getattr(config.cmd_opts, 'autogenerate', False): + script = directives[0] + if script.upgrade_ops.is_empty(): + directives[:] = [] + logger.info('No changes in schema detected.') + + connectable = engine_from_config( + config.get_section(config.config_ini_section), + prefix='sqlalchemy.', + poolclass=pool.NullPool, + ) + + with connectable.connect() as connection: + context.configure( + connection=connection, + target_metadata=target_metadata, + process_revision_directives=process_revision_directives, + **current_app.extensions['migrate'].configure_args + ) + + with context.begin_transaction(): + context.run_migrations() + + +if context.is_offline_mode(): + run_migrations_offline() +else: + run_migrations_online() diff --git a/migrations/script.py.mako b/migrations/script.py.mako new file mode 100644 index 00000000..2c015630 --- /dev/null +++ b/migrations/script.py.mako @@ -0,0 +1,24 @@ +"""${message} + +Revision ID: ${up_revision} +Revises: ${down_revision | comma,n} +Create Date: ${create_date} + +""" +from alembic import op +import sqlalchemy as sa +${imports if imports else ""} + +# revision identifiers, used by Alembic. +revision = ${repr(up_revision)} +down_revision = ${repr(down_revision)} +branch_labels = ${repr(branch_labels)} +depends_on = ${repr(depends_on)} + + +def upgrade(): + ${upgrades if upgrades else "pass"} + + +def downgrade(): + ${downgrades if downgrades else "pass"} From 006318b74318cb16518df9396f5bf230d1fd5f46 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Mon, 20 Dec 2021 14:05:02 -0800 Subject: [PATCH 02/25] "moved imports to correct init file" --- app/__init__.py | 3 +++ app/models/__init__.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 1c821436..80b98536 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -20,6 +20,9 @@ def create_app(): # Import models here for Alembic setup # from app.models.ExampleModel import ExampleModel + from app.models.board import Board + from app.models.card import Card + db.init_app(app) migrate.init_app(app, db) diff --git a/app/models/__init__.py b/app/models/__init__.py index cf00f458..e69de29b 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -1,2 +0,0 @@ -from app.models.board import Board -from app.models.card import Card \ No newline at end of file From c5ea86645b4955e915d9b21d2325541c72960f6f Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Mon, 20 Dec 2021 22:02:20 -0800 Subject: [PATCH 03/25] wrote some notes about relationships and endpoints --- app/models/board.py | 4 +++- app/models/card.py | 41 ++++++++++++++++++++++++++++++++++++++++- app/routes.py | 13 +++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/app/models/board.py b/app/models/board.py index c7c454be..a00fd5e2 100644 --- a/app/models/board.py +++ b/app/models/board.py @@ -3,4 +3,6 @@ class Board(db.Model): board_id = db.Column(db.Integer, primary_key=True, autoincrement=True) title = db.Column(db.String) - owner = db.Column(db.String) \ No newline at end of file + owner = db.Column(db.String) + + \ No newline at end of file diff --git a/app/models/card.py b/app/models/card.py index 331beb03..1d14dd9f 100644 --- a/app/models/card.py +++ b/app/models/card.py @@ -3,4 +3,43 @@ class Card(db.Model): card_id = db.Column(db.Integer, primary_key=True, autoincrement=True) message = db.Column(db.String) - likes_count = db.Column(db.String) \ No newline at end of file + likes_count = db.Column(db.String) + + #do we want to use back populate or backref? + #I think we want to do this: + + """ + One To Many +A one to many relationship places a foreign key on the child table referencing the parent. relationship() is then specified on the parent, as referencing a collection of items represented by the child: + +class Parent(Base): + __tablename__ = 'parent' + id = Column(Integer, primary_key=True) + children = relationship("Child") + +class Child(Base): + __tablename__ = 'child' + id = Column(Integer, primary_key=True) + parent_id = Column(Integer, ForeignKey('parent.id')) + + + +__________________________ + + + +To establish a bidirectional relationship in one-to-many, where the “reverse” side is a many to one, specify an additional relationship() and connect the two using the relationship.back_populates parameter: + +class Parent(Base): + __tablename__ = 'parent' + id = Column(Integer, primary_key=True) + children = relationship("Child", back_populates="parent") + +class Child(Base): + __tablename__ = 'child' + id = Column(Integer, primary_key=True) + parent_id = Column(Integer, ForeignKey('parent.id')) + parent = relationship("Parent", back_populates="children") + + + """ \ No newline at end of file diff --git a/app/routes.py b/app/routes.py index 480b8c4b..40d2d61b 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,4 +1,17 @@ from flask import Blueprint, request, jsonify, make_response from app import db +#copy similar import statements as the ones used in video store + +#import and load dotenv +#i believe this gets our key-value pairs from .env + +#write the blueprint # example_bp = Blueprint('example_bp', __name__) + +#head to init to register the blueprint + + +#then, start writing the routes + + From 5ee0705e5a23b85569ee65740c4286f87fee646b Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 10:24:52 -0800 Subject: [PATCH 04/25] Model relationships and first card route. --- app/__init__.py | 4 ++++ app/board_routes.py | 19 +++++++++++++++++++ app/card_routes.py | 39 +++++++++++++++++++++++++++++++++++++++ app/models/board.py | 2 ++ app/models/card.py | 4 ++++ 5 files changed, 68 insertions(+) create mode 100644 app/board_routes.py create mode 100644 app/card_routes.py diff --git a/app/__init__.py b/app/__init__.py index 80b98536..2ef3ae57 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -29,6 +29,10 @@ def create_app(): # Register Blueprints here # from .routes import example_bp # app.register_blueprint(example_bp) + from .card_routes import cards_bp + app.register_blueprint(cards_bp) + # from .card_routes import cards_bp + # app.register_blueprint(cards_bp) CORS(app) return app diff --git a/app/board_routes.py b/app/board_routes.py new file mode 100644 index 00000000..5ab20a0f --- /dev/null +++ b/app/board_routes.py @@ -0,0 +1,19 @@ +from flask import Blueprint, request, jsonify, make_response +from app import db + + + +#copy similar import statements as the ones used in video store + +#import and load dotenv +#i believe this gets our key-value pairs from .env + +#write the blueprint +# example_bp = Blueprint('example_bp', __name__) + +#head to init to register the blueprint + + +#then, start writing the routes + + diff --git a/app/card_routes.py b/app/card_routes.py new file mode 100644 index 00000000..8780b2bc --- /dev/null +++ b/app/card_routes.py @@ -0,0 +1,39 @@ +from flask import Blueprint, request, jsonify, make_response +from app import db +from app.models.board import Board +from app.models.card import Card +import requests +from dotenv import load_dotenv +load_dotenv() + +cards_bp=Blueprint("card", __name__, url_prefix="/card") + + +@cards_bp.route("", methods=["POST"]) +def create_card(): + request_body = request.get_json() + new_card= Card( + message = request_body["message"], + likes_count = 0 + # Hardcoded likes, could set as default value. + ) + db.session.add(new_card) + db.session.commit() + + return jsonify({"message": new_card.message}), 201 + + +#copy similar import statements as the ones used in video store + +#import and load dotenv +#i believe this gets our key-value pairs from .env + +#write the blueprint +# example_bp = Blueprint('example_bp', __name__) + +#head to init to register the blueprint + + +#then, start writing the routes + + diff --git a/app/models/board.py b/app/models/board.py index a00fd5e2..5babbf20 100644 --- a/app/models/board.py +++ b/app/models/board.py @@ -5,4 +5,6 @@ class Board(db.Model): title = db.Column(db.String) owner = db.Column(db.String) + card = db.relationship("Card", backref="board", passive_deletes=True) + \ No newline at end of file diff --git a/app/models/card.py b/app/models/card.py index 1d14dd9f..baa806e9 100644 --- a/app/models/card.py +++ b/app/models/card.py @@ -1,9 +1,13 @@ +from sqlalchemy.orm import backref from app import db class Card(db.Model): card_id = db.Column(db.Integer, primary_key=True, autoincrement=True) message = db.Column(db.String) likes_count = db.Column(db.String) + board_id = db.Column(db.Integer, db.ForeignKey('board.board_id', ondelete='cascade')) + + #do we want to use back populate or backref? #I think we want to do this: From 421539ad99a53ae0b637b7f9604b9ec806215612 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 10:25:55 -0800 Subject: [PATCH 05/25] Dealing with commitment issues --- app/routes.py | 17 ----------- migrations/versions/4b8fa1f327d5_.py | 42 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 17 deletions(-) delete mode 100644 app/routes.py create mode 100644 migrations/versions/4b8fa1f327d5_.py diff --git a/app/routes.py b/app/routes.py deleted file mode 100644 index 40d2d61b..00000000 --- a/app/routes.py +++ /dev/null @@ -1,17 +0,0 @@ -from flask import Blueprint, request, jsonify, make_response -from app import db - -#copy similar import statements as the ones used in video store - -#import and load dotenv -#i believe this gets our key-value pairs from .env - -#write the blueprint -# example_bp = Blueprint('example_bp', __name__) - -#head to init to register the blueprint - - -#then, start writing the routes - - diff --git a/migrations/versions/4b8fa1f327d5_.py b/migrations/versions/4b8fa1f327d5_.py new file mode 100644 index 00000000..2fa2fb85 --- /dev/null +++ b/migrations/versions/4b8fa1f327d5_.py @@ -0,0 +1,42 @@ +"""empty message + +Revision ID: 4b8fa1f327d5 +Revises: +Create Date: 2021-12-21 10:21:46.458774 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '4b8fa1f327d5' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('board', + sa.Column('board_id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('title', sa.String(), nullable=True), + sa.Column('owner', sa.String(), nullable=True), + sa.PrimaryKeyConstraint('board_id') + ) + op.create_table('card', + sa.Column('card_id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('message', sa.String(), nullable=True), + sa.Column('likes_count', sa.String(), nullable=True), + sa.Column('board_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['board_id'], ['board.board_id'], ondelete='cascade'), + sa.PrimaryKeyConstraint('card_id') + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('card') + op.drop_table('board') + # ### end Alembic commands ### From c8ba4100d98a72d06822817fa0f8480385e09c95 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 10:35:59 -0800 Subject: [PATCH 06/25] Get all route --- app/card_routes.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/card_routes.py b/app/card_routes.py index 8780b2bc..573bc7d0 100644 --- a/app/card_routes.py +++ b/app/card_routes.py @@ -1,4 +1,5 @@ from flask import Blueprint, request, jsonify, make_response +from sqlalchemy.orm.query import Query from app import db from app.models.board import Board from app.models.card import Card @@ -22,6 +23,20 @@ def create_card(): return jsonify({"message": new_card.message}), 201 +@cards_bp.route("", methods=["GET"]) +# Update enpoint with board id at a later date +# "/" +def get_all_cards(): + all_cards = Card.query.all() + output_dicts_list = [] + for card in all_cards: + output_dicts_list.append( + {"id":card.card_id, + "message":card.message + }) + + return jsonify(output_dicts_list), 201 + #copy similar import statements as the ones used in video store From d4fc90c6c1755b6650a059fe30e12a2b44e3388b Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Tue, 21 Dec 2021 17:59:25 -0500 Subject: [PATCH 07/25] Added routes & moved some - see comments --- app/__init__.py | 7 ++--- app/board_routes.py | 72 ++++++++++++++++++++++++++++++++++----------- app/card_routes.py | 35 +++++++--------------- app/models/card.py | 43 +-------------------------- 4 files changed, 69 insertions(+), 88 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 2ef3ae57..7e3f1367 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -27,12 +27,11 @@ def create_app(): migrate.init_app(app, db) # Register Blueprints here - # from .routes import example_bp - # app.register_blueprint(example_bp) from .card_routes import cards_bp app.register_blueprint(cards_bp) - # from .card_routes import cards_bp - # app.register_blueprint(cards_bp) + + from .board_routes import boards_bp + app.register_blueprint(boards_bp) CORS(app) return app diff --git a/app/board_routes.py b/app/board_routes.py index 5ab20a0f..7861c254 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -1,19 +1,57 @@ from flask import Blueprint, request, jsonify, make_response +from sqlalchemy.orm.query import Query from app import db - - - -#copy similar import statements as the ones used in video store - -#import and load dotenv -#i believe this gets our key-value pairs from .env - -#write the blueprint -# example_bp = Blueprint('example_bp', __name__) - -#head to init to register the blueprint - - -#then, start writing the routes - - +from app.models.board import Board +from app.models.card import Card +import requests +from dotenv import load_dotenv +load_dotenv() + +boards_bp=Blueprint("board", __name__, url_prefix="/board") + +#CREATE ONE BOARD +@boards_bp.route("", methods=["POST"]) +def create_board(): + request_body = request.get_json() + new_board = Board( + title = request_body["title"], + owner = request_body["owner"] + ) + + db.session.add(new_board) + db.session.commit() + + return jsonify({ + "title" : new_board.title, + "owner" : new_board.owner + }), 201 + + +#CREATE ONE CARD ON A SPECIFIC BOARD +@boards_bp.route("/", methods=["POST"]) +def create_card(board_id): + request_body = request.get_json() + new_card= Card( + message = request_body["message"], + likes_count = 0 + # Hardcoded likes, could set as default value. + ) + db.session.add(new_card) + db.session.commit() + + return jsonify({"message": new_card.message}), 201 + +#GET ALL CARDS FOR SPECIFIC BOARD BY ID +@boards_bp.route("/", methods=["GET"]) +def get_all_cards_from_a_board(board_id): + #trying to get all cards with same board_id + all_cards = Card.query.filter_by(board_id=board_id) + output_dicts_list = [] + for card in all_cards: + output_dicts_list.append( + {"id":card.card_id, + "message":card.message + }) +#the route returns 201, but it's returning an empty list +#not sure why & will revisit in the morning - reid + return jsonify(output_dicts_list), 201 \ No newline at end of file diff --git a/app/card_routes.py b/app/card_routes.py index 573bc7d0..a3e7e9ba 100644 --- a/app/card_routes.py +++ b/app/card_routes.py @@ -9,23 +9,19 @@ cards_bp=Blueprint("card", __name__, url_prefix="/card") +#I moved the create card blueprint to board_routes +#Because the endpoint for this should start with board +#like this: +#/board/board_id/card -@cards_bp.route("", methods=["POST"]) -def create_card(): - request_body = request.get_json() - new_card= Card( - message = request_body["message"], - likes_count = 0 - # Hardcoded likes, could set as default value. - ) - db.session.add(new_card) - db.session.commit() +#I think we might want to move everything over to board, too. +#maybe we actually only want one file for routes? +#because all of the routes for card are written as add-ons to the board endpoint(s) - return jsonify({"message": new_card.message}), 201 - -@cards_bp.route("", methods=["GET"]) +#@cards_bp.route("", methods=["GET"]) # Update enpoint with board id at a later date # "/" +""" def get_all_cards(): all_cards = Card.query.all() output_dicts_list = [] @@ -36,19 +32,8 @@ def get_all_cards(): }) return jsonify(output_dicts_list), 201 +""" -#copy similar import statements as the ones used in video store - -#import and load dotenv -#i believe this gets our key-value pairs from .env - -#write the blueprint -# example_bp = Blueprint('example_bp', __name__) - -#head to init to register the blueprint - - -#then, start writing the routes diff --git a/app/models/card.py b/app/models/card.py index baa806e9..d638f5f7 100644 --- a/app/models/card.py +++ b/app/models/card.py @@ -5,45 +5,4 @@ class Card(db.Model): card_id = db.Column(db.Integer, primary_key=True, autoincrement=True) message = db.Column(db.String) likes_count = db.Column(db.String) - board_id = db.Column(db.Integer, db.ForeignKey('board.board_id', ondelete='cascade')) - - - - #do we want to use back populate or backref? - #I think we want to do this: - - """ - One To Many -A one to many relationship places a foreign key on the child table referencing the parent. relationship() is then specified on the parent, as referencing a collection of items represented by the child: - -class Parent(Base): - __tablename__ = 'parent' - id = Column(Integer, primary_key=True) - children = relationship("Child") - -class Child(Base): - __tablename__ = 'child' - id = Column(Integer, primary_key=True) - parent_id = Column(Integer, ForeignKey('parent.id')) - - - -__________________________ - - - -To establish a bidirectional relationship in one-to-many, where the “reverse” side is a many to one, specify an additional relationship() and connect the two using the relationship.back_populates parameter: - -class Parent(Base): - __tablename__ = 'parent' - id = Column(Integer, primary_key=True) - children = relationship("Child", back_populates="parent") - -class Child(Base): - __tablename__ = 'child' - id = Column(Integer, primary_key=True) - parent_id = Column(Integer, ForeignKey('parent.id')) - parent = relationship("Parent", back_populates="children") - - - """ \ No newline at end of file + board_id = db.Column(db.Integer, db.ForeignKey('board.board_id', ondelete='cascade')) \ No newline at end of file From 1201f7d1d1d004c8a4da0ec3f0943163b3344163 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 21:38:29 -0800 Subject: [PATCH 08/25] Create board function now adds board id --- app/board_routes.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index 7861c254..9de569fc 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -28,18 +28,19 @@ def create_board(): #CREATE ONE CARD ON A SPECIFIC BOARD -@boards_bp.route("/", methods=["POST"]) -def create_card(board_id): +@boards_bp.route("/", methods=["POST"]) +def create_card(board_ID): request_body = request.get_json() new_card= Card( message = request_body["message"], - likes_count = 0 + likes_count = 0, + board_id = board_ID # Hardcoded likes, could set as default value. ) db.session.add(new_card) db.session.commit() - return jsonify({"message": new_card.message}), 201 + return jsonify({"message": new_card.message,"board_id": board_ID}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID @boards_bp.route("/", methods=["GET"]) From caf9742c9b244cf818dcb16e7e7d6459497c195c Mon Sep 17 00:00:00 2001 From: Vange Spracklin Date: Tue, 21 Dec 2021 22:58:03 -0800 Subject: [PATCH 09/25] adds routes for GET all boards and GET one board by id --- app/board_routes.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index 9de569fc..d537bcf2 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -55,4 +55,36 @@ def get_all_cards_from_a_board(board_id): }) #the route returns 201, but it's returning an empty list #not sure why & will revisit in the morning - reid - return jsonify(output_dicts_list), 201 \ No newline at end of file + return jsonify(output_dicts_list), 201 + +# GET ALL BOARDS +@boards_bp.route("", methods=["GET"]) +def get_all_boards(): + boards = Board.query.all() + + response_body = [] + + for board in boards: + response_body.append( + {"id" : board.board_id, + "title" : board.title, + "owner" : board.owner} + ) + + return jsonify(response_body), 200 + +# GET ONE BOARD BY SUPPLYING board_id +@boards_bp.route("/", methods=["GET"]) +def get_one_board(board_id): + board = Board.query.get(board_id) + + if board is None: + return jsonify(None),404 + + response_body = { + "id" : board.board_id, + "title" : board.title, + "owner" : board.owner + } + + return jsonify(response_body), 200 From cf9d94b7fb7fcbad975b907499a5e455dc2ab761 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 22:59:22 -0800 Subject: [PATCH 10/25] Decorator for board validation implemented --- app/board_routes.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index 9de569fc..c000008e 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -6,9 +6,28 @@ import requests from dotenv import load_dotenv load_dotenv() +from functools import wraps boards_bp=Blueprint("board", __name__, url_prefix="/board") +# Decorator for validation +# Can be used for any route that has +# Updated routes to use because was overlapping with model values. +# Challange someone to try something similar for GET by card_ID +# Will explain decorators, args/kwargs, wraps tomorrow. + +def validate_board(board_identity): + @wraps(board_identity) + def test_for_board (*args, board_ID, **kwargs): + board_check = Board.query.get(board_ID) + if board_check: + return board_identity (*args, board_ID, **kwargs) + else: + return ({"message":f"Board {board_ID} does not exist",}), 404 + return test_for_board + + + #CREATE ONE BOARD @boards_bp.route("", methods=["POST"]) def create_board(): @@ -23,12 +42,14 @@ def create_board(): return jsonify({ "title" : new_board.title, - "owner" : new_board.owner + "owner" : new_board.owner, + "id" : new_board.board_id }), 201 #CREATE ONE CARD ON A SPECIFIC BOARD @boards_bp.route("/", methods=["POST"]) +@validate_board def create_card(board_ID): request_body = request.get_json() new_card= Card( @@ -43,7 +64,8 @@ def create_card(board_ID): return jsonify({"message": new_card.message,"board_id": board_ID}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID -@boards_bp.route("/", methods=["GET"]) +@boards_bp.route("/", methods=["GET"]) +@validate_board def get_all_cards_from_a_board(board_id): #trying to get all cards with same board_id all_cards = Card.query.filter_by(board_id=board_id) From 1cd95fb54a67af0b4fbc56922197056bdcb36e88 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 23:05:34 -0800 Subject: [PATCH 11/25] Removed overlapping routes for / --- app/board_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index 2bd9df69..87089659 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -64,7 +64,7 @@ def create_card(board_ID): return jsonify({"message": new_card.message,"board_id": board_ID}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID -@boards_bp.route("/", methods=["GET"]) +@boards_bp.route("//cards", methods=["GET"]) @validate_board def get_all_cards_from_a_board(board_id): #trying to get all cards with same board_id From c31c86edae2a9413a62af5744a6916ad894222a4 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 23:17:15 -0800 Subject: [PATCH 12/25] Added route for delete_one_whole_entire_board --- app/board_routes.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index 87089659..4824aafb 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -96,9 +96,10 @@ def get_all_boards(): return jsonify(response_body), 200 # GET ONE BOARD BY SUPPLYING board_id -@boards_bp.route("/", methods=["GET"]) -def get_one_board(board_id): - board = Board.query.get(board_id) +@boards_bp.route("/", methods=["GET"]) +@validate_board +def get_one_board(board_ID): + board = Board.query.get(board_ID) if board is None: return jsonify(None),404 @@ -110,3 +111,12 @@ def get_one_board(board_id): } return jsonify(response_body), 200 + +@boards_bp.route("/", methods=["DELETE"]) +@validate_board +def delete_one_whole_entire_board(board_ID): + board = Board.query.get(board_ID) + db.session.delete(board) + db.session.commit() + response = {"message": f"Board {board.title} was deleted"} + return response, 200 From 32ee3248e62b545b8c486ed711da0f413e6a1275 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 21 Dec 2021 23:29:53 -0800 Subject: [PATCH 13/25] Delete teeny tiny card added. --- app/board_routes.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/board_routes.py b/app/board_routes.py index 4824aafb..6da71179 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -120,3 +120,15 @@ def delete_one_whole_entire_board(board_ID): db.session.commit() response = {"message": f"Board {board.title} was deleted"} return response, 200 + + +@boards_bp.route("//", methods=["DELETE"]) +@validate_board +def delete_one_teeny_tiny_card(board_ID, card_ID): + card = Card.query.get(card_ID) + if card: + db.session.delete(card) + db.session.commit() + response = {"message": f"Card {card.card_id} was deleted"} + return response, 200 + return {"message": f"Card id {card_ID} isn't real."},400 From b66e1fb2421fac1d759d17c0edd74ed1b5f3bd42 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Wed, 22 Dec 2021 10:40:03 -0500 Subject: [PATCH 14/25] Added guard clauses to the create endpoints --- app/board_routes.py | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index 6da71179..c223699e 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -19,6 +19,9 @@ def validate_board(board_identity): @wraps(board_identity) def test_for_board (*args, board_ID, **kwargs): + if not board_ID.isnumeric(): + return ({"message":f"Board {board_ID} does not exist.",}), 404 + board_check = Board.query.get(board_ID) if board_check: return board_identity (*args, board_ID, **kwargs) @@ -27,11 +30,15 @@ def test_for_board (*args, board_ID, **kwargs): return test_for_board - #CREATE ONE BOARD @boards_bp.route("", methods=["POST"]) def create_board(): request_body = request.get_json() + + if (("title" not in request_body.keys()) or + ("owner" not in request_body.keys())): + return jsonify("Board not created. Must supply title and owner."), 404 + new_board = Board( title = request_body["title"], owner = request_body["owner"] @@ -52,31 +59,34 @@ def create_board(): @validate_board def create_card(board_ID): request_body = request.get_json() + + if ("message" not in request_body.keys()): + return jsonify () + new_card= Card( message = request_body["message"], likes_count = 0, board_id = board_ID # Hardcoded likes, could set as default value. + #I researched this and couldn't find a way to do so - Reid ) db.session.add(new_card) db.session.commit() - return jsonify({"message": new_card.message,"board_id": board_ID}), 201 + return jsonify({"message": new_card.message,"board_id": new_card.board_id}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID @boards_bp.route("//cards", methods=["GET"]) @validate_board def get_all_cards_from_a_board(board_id): - #trying to get all cards with same board_id all_cards = Card.query.filter_by(board_id=board_id) output_dicts_list = [] for card in all_cards: - output_dicts_list.append( - {"id":card.card_id, - "message":card.message + output_dicts_list.append({ + "id":card.card_id, + "message":card.message, + "board_id":card.board_id #i just did this for testing we can take out }) -#the route returns 201, but it's returning an empty list -#not sure why & will revisit in the morning - reid return jsonify(output_dicts_list), 201 # GET ALL BOARDS @@ -118,17 +128,24 @@ def delete_one_whole_entire_board(board_ID): board = Board.query.get(board_ID) db.session.delete(board) db.session.commit() - response = {"message": f"Board {board.title} was deleted"} + + #not sure if we need this? + all_cards = Card.query.filter_by(board_id=board_ID) + for card in all_cards: + db.session.delete(card) + db.session.commit() + + response = {"message": f"Board {board.title} was deleted."} return response, 200 -@boards_bp.route("//", methods=["DELETE"]) +@boards_bp.route("//cards/", methods=["DELETE"]) @validate_board def delete_one_teeny_tiny_card(board_ID, card_ID): card = Card.query.get(card_ID) if card: db.session.delete(card) db.session.commit() - response = {"message": f"Card {card.card_id} was deleted"} + response = {"message": f"Card {card.card_id} was deleted."} return response, 200 return {"message": f"Card id {card_ID} isn't real."},400 From a88b770c0284ca74dc94c1974077f5d71fecf340 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Wed, 22 Dec 2021 11:13:08 -0500 Subject: [PATCH 15/25] Wrote get_one_card_from_a_board endpoint. --- app/board_routes.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index c223699e..e1a8ecbd 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -29,6 +29,19 @@ def test_for_board (*args, board_ID, **kwargs): return ({"message":f"Board {board_ID} does not exist",}), 404 return test_for_board +def validate_card(card_identity): + @wraps(card_identity) + def test_for_card (*args, card_ID, **kwargs): + if not card_ID.isnumeric(): + return ({"message":f"Card {card_ID} does not exist.",}), 404 + + card_check = Card.query.get(card_ID) + if card_check: + return card_identity (*args, card_ID, **kwargs) + else: + return ({"message":f"Card {card_ID} does not exist",}), 404 + return test_for_card + #CREATE ONE BOARD @boards_bp.route("", methods=["POST"]) @@ -57,6 +70,7 @@ def create_board(): #CREATE ONE CARD ON A SPECIFIC BOARD @boards_bp.route("/", methods=["POST"]) @validate_board +@validate_card def create_card(board_ID): request_body = request.get_json() @@ -83,12 +97,27 @@ def get_all_cards_from_a_board(board_id): output_dicts_list = [] for card in all_cards: output_dicts_list.append({ - "id":card.card_id, + "card_id":card.card_id, "message":card.message, "board_id":card.board_id #i just did this for testing we can take out }) return jsonify(output_dicts_list), 201 + +#GET ONE CARD FOR SPECIFIC BOARD BY ID +@boards_bp.route("//cards/", methods=["GET"]) +@validate_board +@validate_card +def get_one_card_from_a_board(board_ID, card_ID): + #should we actually fetch this by board_ID and card_ID? Does it matter? + card = Card.query.get(card_ID) + + return jsonify({ + "card_id":card.card_id, + "message":card.message, + "board_id":card.board_id #i just did this for testing we can take out + }), 201 + # GET ALL BOARDS @boards_bp.route("", methods=["GET"]) def get_all_boards(): @@ -138,7 +167,6 @@ def delete_one_whole_entire_board(board_ID): response = {"message": f"Board {board.title} was deleted."} return response, 200 - @boards_bp.route("//cards/", methods=["DELETE"]) @validate_board def delete_one_teeny_tiny_card(board_ID, card_ID): From d6ba012537b5a7c761e13599180b7cc08d7ff3dd Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 28 Dec 2021 01:01:22 -0800 Subject: [PATCH 16/25] Removed card validator on create new card --- app/board_routes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index e1a8ecbd..e17c1f81 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -70,7 +70,6 @@ def create_board(): #CREATE ONE CARD ON A SPECIFIC BOARD @boards_bp.route("/", methods=["POST"]) @validate_board -@validate_card def create_card(board_ID): request_body = request.get_json() From 2ede819c43268ef123f60f2bb60664f9027b6996 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:12:50 -0500 Subject: [PATCH 17/25] Added some notes about a patch request I need to write for card.likes_count. --- app/board_routes.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index e1a8ecbd..2814498e 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -81,8 +81,6 @@ def create_card(board_ID): message = request_body["message"], likes_count = 0, board_id = board_ID - # Hardcoded likes, could set as default value. - #I researched this and couldn't find a way to do so - Reid ) db.session.add(new_card) db.session.commit() @@ -99,7 +97,8 @@ def get_all_cards_from_a_board(board_id): output_dicts_list.append({ "card_id":card.card_id, "message":card.message, - "board_id":card.board_id #i just did this for testing we can take out + "board_id":card.board_id + #we want to return the likes_count in this dictionary here so that each card like count renders correctly }) return jsonify(output_dicts_list), 201 @@ -116,6 +115,7 @@ def get_one_card_from_a_board(board_ID, card_ID): "card_id":card.card_id, "message":card.message, "board_id":card.board_id #i just did this for testing we can take out + #return likes-count here too }), 201 # GET ALL BOARDS @@ -177,3 +177,21 @@ def delete_one_teeny_tiny_card(board_ID, card_ID): response = {"message": f"Card {card.card_id} was deleted."} return response, 200 return {"message": f"Card id {card_ID} isn't real."},400 + + +#PATCH REQUEST TO INCREMENT CARD.LIKES_COUNT BY 1 +@boards_bp.route("//cards/", methods=["DELETE"]) +@validate_board +def add_one_to_likes_count(board_ID, card_ID): + card = Card.query.get(card_ID) + if card: + card = { + + } + + + db.session.add(card) + db.session.commit() + response = {"message": f"Card {card.card_id} was deleted."} + return response, 200 + return {"message": f"Card id {card_ID} isn't real."},400 \ No newline at end of file From 46a98435994fa7a224f71ada5d4bfebdfbbc773e Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:18:40 -0500 Subject: [PATCH 18/25] Commented out patch request (because it is in progress). Added likes_count to the card GET requests. --- app/board_routes.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index 7bad374f..e2e6eaf9 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -96,7 +96,8 @@ def get_all_cards_from_a_board(board_id): output_dicts_list.append({ "card_id":card.card_id, "message":card.message, - "board_id":card.board_id + "board_id":card.board_id, + "likes_count":card.likes_count #we want to return the likes_count in this dictionary here so that each card like count renders correctly }) return jsonify(output_dicts_list), 201 @@ -113,8 +114,8 @@ def get_one_card_from_a_board(board_ID, card_ID): return jsonify({ "card_id":card.card_id, "message":card.message, - "board_id":card.board_id #i just did this for testing we can take out - #return likes-count here too + "board_id":card.board_id, + "likes_count":card.likes_count }), 201 # GET ALL BOARDS @@ -179,18 +180,18 @@ def delete_one_teeny_tiny_card(board_ID, card_ID): #PATCH REQUEST TO INCREMENT CARD.LIKES_COUNT BY 1 -@boards_bp.route("//cards/", methods=["DELETE"]) -@validate_board -def add_one_to_likes_count(board_ID, card_ID): - card = Card.query.get(card_ID) - if card: - card = { +# @boards_bp.route("//cards/", methods=["PATCH"]) +# @validate_board +# def add_one_to_likes_count(board_ID, card_ID): +# card = Card.query.get(card_ID) +# if card: +# card = { - } +# } - db.session.add(card) - db.session.commit() - response = {"message": f"Card {card.card_id} was deleted."} - return response, 200 - return {"message": f"Card id {card_ID} isn't real."},400 \ No newline at end of file +# db.session.add(card) +# db.session.commit() +# response = {"message": f"Card {card.card_id} was deleted."} +# return response, 200 +# return {"message": f"Card id {card_ID} isn't real."},400 \ No newline at end of file From 419e88250875c65b862e7efb08f5a86c8b9af042 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:28:32 -0500 Subject: [PATCH 19/25] Finished PATCH request to update card.likes_count. Tested in Postman. --- app/board_routes.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/board_routes.py b/app/board_routes.py index e2e6eaf9..4f1ba4ca 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -180,18 +180,13 @@ def delete_one_teeny_tiny_card(board_ID, card_ID): #PATCH REQUEST TO INCREMENT CARD.LIKES_COUNT BY 1 -# @boards_bp.route("//cards/", methods=["PATCH"]) -# @validate_board -# def add_one_to_likes_count(board_ID, card_ID): -# card = Card.query.get(card_ID) -# if card: -# card = { - -# } - - -# db.session.add(card) -# db.session.commit() -# response = {"message": f"Card {card.card_id} was deleted."} -# return response, 200 -# return {"message": f"Card id {card_ID} isn't real."},400 \ No newline at end of file +@boards_bp.route("//cards/", methods=["PATCH"]) +@validate_board +def add_one_to_likes_count(board_ID, card_ID): + card = Card.query.get(card_ID) + if card: + card.likes_count = int(card.likes_count) + 1 + db.session.commit() + response = {"message": f"Card {card.card_id} likes count was updated to {card.likes_count}"} + return response, 200 + return {"message": f"Card id {card_ID} isn't real."},400 \ No newline at end of file From 5da7194d107da59e0194745d88ce390570c9d0a8 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:38:04 -0800 Subject: [PATCH 20/25] Edited add a like endpoint. --- app/board_routes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index 4f1ba4ca..2cbbf74f 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -84,7 +84,9 @@ def create_card(board_ID): db.session.add(new_card) db.session.commit() - return jsonify({"message": new_card.message,"board_id": new_card.board_id}), 201 + return jsonify({"message": new_card.message, + "board_id": new_card.board_id, + "likes_count":new_card.likes_count}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID @boards_bp.route("//cards", methods=["GET"]) From 91b84510bec2f949dbc541f9a7103702d4733552 Mon Sep 17 00:00:00 2001 From: Cassie Date: Tue, 4 Jan 2022 08:21:45 -0800 Subject: [PATCH 21/25] Added Slack-bot integration --- app/board_routes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/board_routes.py b/app/board_routes.py index 2cbbf74f..8fcc7a2d 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -7,6 +7,7 @@ from dotenv import load_dotenv load_dotenv() from functools import wraps +import os boards_bp=Blueprint("board", __name__, url_prefix="/board") @@ -81,6 +82,12 @@ def create_card(board_ID): likes_count = 0, board_id = board_ID ) + url= 'https://slack.com/api/chat.postMessage' + header_values = {'AUTHORIZATION': os.environ.get("AUTHORIZATION")} + slack_values = {"text" : f"Something inspirational posted on board {new_card.board_id}", + "channel" : "winspo-board" + } + requests.post(url, headers=header_values, params=slack_values) db.session.add(new_card) db.session.commit() From cb9aa93ac93779dfc22f820d944e9a150f984b27 Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:55:04 -0800 Subject: [PATCH 22/25] create_card() now returns card_id of new_card. --- app/board_routes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index 8fcc7a2d..5cf3836e 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -93,7 +93,8 @@ def create_card(board_ID): return jsonify({"message": new_card.message, "board_id": new_card.board_id, - "likes_count":new_card.likes_count}), 201 + "likes_count":new_card.likes_count + "card_id":new_card.card_id}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID @boards_bp.route("//cards", methods=["GET"]) From c0bef2f1677b177a53fc880dada63654a2f441fc Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Tue, 4 Jan 2022 09:55:39 -0800 Subject: [PATCH 23/25] Added a missing comma. Oops git push ' --- app/board_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/board_routes.py b/app/board_routes.py index 5cf3836e..b8884385 100644 --- a/app/board_routes.py +++ b/app/board_routes.py @@ -93,7 +93,7 @@ def create_card(board_ID): return jsonify({"message": new_card.message, "board_id": new_card.board_id, - "likes_count":new_card.likes_count + "likes_count":new_card.likes_count, "card_id":new_card.card_id}), 201 #GET ALL CARDS FOR SPECIFIC BOARD BY ID From e5abceb8940ffd40751e9ada9b4f67f34df24b8e Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Thu, 6 Jan 2022 16:40:55 -0800 Subject: [PATCH 24/25] Misc changes --- app/models/card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/card.py b/app/models/card.py index d638f5f7..b93c1456 100644 --- a/app/models/card.py +++ b/app/models/card.py @@ -4,5 +4,5 @@ class Card(db.Model): card_id = db.Column(db.Integer, primary_key=True, autoincrement=True) message = db.Column(db.String) - likes_count = db.Column(db.String) + likes_count = db.Column(db.Integer) board_id = db.Column(db.Integer, db.ForeignKey('board.board_id', ondelete='cascade')) \ No newline at end of file From 35883808240db84264209b71f56e3c37b6a906aa Mon Sep 17 00:00:00 2001 From: reidhowdy <87451286+reidhowdy@users.noreply.github.com> Date: Thu, 6 Jan 2022 16:51:20 -0800 Subject: [PATCH 25/25] Deleted old Procfile because we are re-deploying. Created new Procfile. --- Procfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Procfile b/Procfile index 62e430ac..066ed31d 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: gunicorn 'app:create_app()' \ No newline at end of file +web: gunicorn 'app:create_app()'