Repository: fossasia/open-event-server

Issue:
Add missing fields for Sessions
Add missing fields to Sessions api and database models.

https://github.com/fossasia/open-event-orga-server/issues/624



Discussion:
@shivamMg are you working on this ?

@aviaryan I'm working on other things right now. You can take this up if you like. There are four fields "slides", "video", "signup", "audio". Signup should be URL, rest others must either be uploadable media or urls.

@aviaryan are you making the changes in the session table as well? I have a similar issue https://github.com/fossasia/open-event-orga-server/issues/631 . So, if you are making changes to table I will wait for the table creation otherwise there will be merge conflicts.

@SaptakS Ok, I will try to send a PR soon. 

@aviaryan great..


Resolving patch:
diff --git a/migrations/versions/e385c8e1368a_.py b/migrations/versions/e385c8e1368a_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/e385c8e1368a_.py
@@ -0,0 +1,33 @@
+"""empty message
+
+Revision ID: e385c8e1368a
+Revises: 7a110ca7061b
+Create Date: 2016-06-15 14:55:39.007510
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'e385c8e1368a'
+down_revision = '7a110ca7061b'
+
+from alembic import op
+import sqlalchemy as sa
+import sqlalchemy_utils
+
+
+def upgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('session', sa.Column('audio', sa.String(), nullable=True))
+    op.add_column('session', sa.Column('signup_url', sa.String(), nullable=True))
+    op.add_column('session', sa.Column('slides', sa.String(), nullable=True))
+    op.add_column('session', sa.Column('video', sa.String(), nullable=True))
+    ### end Alembic commands ###
+
+
+def downgrade():
+    ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('session', 'video')
+    op.drop_column('session', 'slides')
+    op.drop_column('session', 'signup_url')
+    op.drop_column('session', 'audio')
+    ### end Alembic commands ###
diff --git a/open_event/api/sessions.py b/open_event/api/sessions.py
--- a/open_event/api/sessions.py
+++ b/open_event/api/sessions.py
@@ -62,6 +62,10 @@
     'language': fields.Nested(SESSION_LANGUAGE),
     'format': fields.Nested(SESSION_FORMAT),
     'microlocation': fields.Nested(SESSION_MICROLOCATION),
+    'slides': fields.String(),
+    'video': fields.String(),
+    'audio': fields.String(),
+    'signup_url': fields.Uri()
 })
 
 SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {
diff --git a/open_event/models/session.py b/open_event/models/session.py
--- a/open_event/models/session.py
+++ b/open_event/models/session.py
@@ -123,6 +123,11 @@ class Session(db.Model):
     language_id = db.Column(db.Integer, db.ForeignKey('language.id'))
     microlocation_id = db.Column(db.Integer, db.ForeignKey('microlocation.id'))
 
+    slides = db.Column(db.String)
+    video = db.Column(db.String)
+    audio = db.Column(db.String)
+    signup_url = db.Column(db.String)
+
     event_id = db.Column(
         db.Integer, db.ForeignKey('events.id', ondelete='CASCADE'))
     state = db.Column(db.String, default="pending")
@@ -141,7 +146,11 @@ def __init__(self,
                  microlocation=None,
                  speakers=[],
                  event_id=None,
-                 state="pending"):
+                 state="pending",
+                 slides=None,
+                 video=None,
+                 audio=None,
+                 signup_url=None):
         self.title = title
         self.subtitle = subtitle
         self.abstract = abstract
@@ -156,6 +165,10 @@ def __init__(self,
         self.speakers = speakers
         self.event_id = event_id
         self.state = state
+        self.slides = slides
+        self.video = video
+        self.audio = audio
+        self.signup_url = signup_url
 
     @property
     def is_accepted(self):


Test patch:
diff --git a/tests/api/utils_post_data.py b/tests/api/utils_post_data.py
--- a/tests/api/utils_post_data.py
+++ b/tests/api/utils_post_data.py
@@ -59,7 +59,11 @@
     "start_time": "2016-05-30 08:47:37",
     "subtitle": "TestSession",
     "title": "TestSession",
-    "track_id": None
+    "track_id": None,
+    "slides": "http://example.com/slides",
+    "video": "http://example.com/video",
+    "audio": "http://example.com/audio",
+    "signup_url": "http://example.com/signup"
 }
 
 POST_SPEAKER_DATA = {