From 929651b2232a90588ca631d6411789da3df33a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Sat, 28 Apr 2018 12:04:18 +0200 Subject: [PATCH] Remove unnecessary video_id --- api/README.md | 5 ----- api/app.py | 4 ---- api/db.py | 1 - api/sync_with_twitch.py | 2 -- 4 files changed, 12 deletions(-) diff --git a/api/README.md b/api/README.md index 0d5d754..1db0103 100644 --- a/api/README.md +++ b/api/README.md @@ -15,7 +15,6 @@ Example response: ```JSON { "id": 28, - "video_id": 0, "date": "2018-01-01", "game": "IRL", "text": "Cheese?", @@ -42,7 +41,6 @@ Example response: [ { "id": 28, - "video_id": 0, "date": "2018-01-01", "game": "IRL", "text": "Cheese?", @@ -51,7 +49,6 @@ Example response: }, { "id": 42, - "video_id": 0, "date": "2018-02-02", "game": "IRL", "text": "Cheese!", @@ -87,7 +84,6 @@ Parameters: * `date` (required) - Date in ISO 8601 format * `game` (required) - Related game * `text` (required) - Text of the quote -* `video_id` (optional) - Twitch video ID ## Replace specific quote @@ -106,7 +102,6 @@ Parameters: * `date` (required) - Date in ISO 8601 format * `game` (required) - Related game * `text` (required) - Text of the quote -* `video_id` (optional) - Twitch video ID ## Delete specific quote diff --git a/api/app.py b/api/app.py index 4f61f01..3192b79 100644 --- a/api/app.py +++ b/api/app.py @@ -23,7 +23,6 @@ api = flask_restful.Api(app) quote_fields = { 'id': flask_restful.fields.Integer(), - 'video_id': flask_restful.fields.Integer(), 'date': flask_restful.fields.DateTime(dt_format='iso8601'), 'game': flask_restful.fields.String(), 'text': flask_restful.fields.String(), @@ -34,7 +33,6 @@ quote_fields = { quote_parser = flask_restful.reqparse.RequestParser() quote_parser.add_argument('id', type=int) -quote_parser.add_argument('video_id', type=int) quote_parser.add_argument('date', type=flask_restful.inputs.date, required=True) quote_parser.add_argument('game', type=str, required=True) quote_parser.add_argument('text', type=str, required=True) @@ -80,7 +78,6 @@ class QuoteResource(flask_restful.Resource): quote = q.first() if not quote: quote = Quote(id=id, created_at=now) - quote.video_id = args['video_id'] # FIXME: NULL quote.date = args['date'] quote.game = args['game'] quote.text = args['text'] @@ -135,7 +132,6 @@ class QuotesResource(flask_restful.Resource): quote = q.first() if not quote: quote = Quote(id=args['id'], created_at=now) - quote.video_id = args['video_id'] # FIXME: NULL quote.date = args['date'] quote.game = args['game'] quote.text = args['text'] diff --git a/api/db.py b/api/db.py index da416c3..e2b1a10 100644 --- a/api/db.py +++ b/api/db.py @@ -8,7 +8,6 @@ class Quote(db.Model): __tablename__ = 'quotes' id = db.Column(db.Integer, primary_key=True) - video_id = db.Column(db.Integer) date = db.Column(db.Date) game = db.Column(db.String) text = db.Column(db.String) diff --git a/api/sync_with_twitch.py b/api/sync_with_twitch.py index ae08de3..0b416a7 100644 --- a/api/sync_with_twitch.py +++ b/api/sync_with_twitch.py @@ -82,14 +82,12 @@ def main(): quote = m.groupdict() quote['id'] = int(quote['id']) + 10000 quote['date'] = dateutil.parser.parse(quote['date'], dayfirst=True) - quote['video_id'] = video['id'] quotes.append(quote) for quote in quotes: now = sqlalchemy.func.now() q = db.session.query(Quote).filter(Quote.id == quote['id']).first() if not q: q = Quote(id=quote['id'], created_at=now) - q.video_id = quote['video_id'] q.date = quote['date'] q.game = quote['game'] q.text = quote['text']