Repository: fossasia/open-event-server

Issue:
Adding "is_featured" field to event object 
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
To solve the enhancement request of adding a featured event section in the homepage, we will need a `is_featured` field (something along the lines of is_featured in speakers)

Front-end Issue : fossasia/open-event-frontend#1925 

**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
Working on it


Discussion:

Resolving patch:
diff --git a/app/api/schema/events.py b/app/api/schema/events.py
--- a/app/api/schema/events.py
+++ b/app/api/schema/events.py
@@ -100,6 +100,7 @@ def validate_timezone(self, data, original_data):
     paypal_email = fields.Str(allow_none=True)
     is_tax_enabled = fields.Bool(default=False)
     is_donation_enabled = fields.Bool(default=False)
+    is_featured = fields.Bool(default=False)
     can_pay_by_paypal = fields.Bool(default=False)
     can_pay_by_stripe = fields.Bool(default=False)
     can_pay_by_cheque = fields.Bool(default=False)
diff --git a/app/models/event.py b/app/models/event.py
--- a/app/models/event.py
+++ b/app/models/event.py
@@ -52,6 +52,7 @@ class Event(SoftDeletionModel):
     longitude = db.Column(db.Float)
     location_name = db.Column(db.String)
     searchable_location_name = db.Column(db.String)
+    is_featured = db.Column(db.Boolean, default=False)
     description = db.Column(db.Text)
     original_image_url = db.Column(db.String)
     thumbnail_image_url = db.Column(db.String)
@@ -194,6 +195,7 @@ def __init__(self,
                  is_donation_enabled=False,
                  is_map_shown=False,
                  has_organizer_info=False,
+                 is_featured=False,
                  searchable_location_name=None,
                  is_ticketing_enabled=None,
                  deleted_at=None,
@@ -258,6 +260,7 @@ def __init__(self,
         self.deleted_at = deleted_at
         self.payment_country = payment_country
         self.payment_currency = payment_currency
+        self.is_featured = is_featured
         self.paypal_email = paypal_email
         self.speakers_call = speakers_call
         self.can_pay_by_paypal = can_pay_by_paypal
diff --git a/migrations/versions/d6466bfab14b_.py b/migrations/versions/d6466bfab14b_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/d6466bfab14b_.py
@@ -0,0 +1,31 @@
+"""empty message
+
+Revision ID: d6466bfab14b
+Revises: e3caa0f2a16c
+Create Date: 2019-02-02 13:17:52.104761
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'd6466bfab14b'
+down_revision = 'e3caa0f2a16c'
+
+
+def upgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.add_column('events',
+                  sa.Column('is_featured',
+                            sa.Boolean(),
+                            server_default='False',
+                            nullable=False))
+    # ### end Alembic commands ###
+
+
+def downgrade():
+    # ### commands auto generated by Alembic - please adjust! ###
+    op.drop_column('events', 'is_featured')
+    # ### end Alembic commands ###


Test patch: