Skip to content

Commit

Permalink
chore: Release v1.8.0 (#6612)
Browse files Browse the repository at this point in the history
chore: Release v1.8.0
  • Loading branch information
iamareebjamal committed Nov 24, 2019
2 parents 298ce5e + 9e2d53f commit 997edf3
Show file tree
Hide file tree
Showing 38 changed files with 337 additions and 90 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

##### v1.8.0 (Unreleased):

- No Changes
- Run `python manage.py fix_digit_identifier` to correct all digit identifiers

##### v1.7.0 (2019-10-19):

Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -51,9 +51,9 @@ The Open Event Server can be easily deployed on a variety of platforms. Detailed
1. [Deployment on Heroku](/docs/installation/heroku.md)


One-click Heroku and Docker deployments are also available:
One-click Heroku deployment is also available:

[![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/fossasia/open-event-server) [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)


## Technology Stack
Expand Down
2 changes: 1 addition & 1 deletion app/api/helpers/jwt.py
Expand Up @@ -39,7 +39,7 @@ def get_identity():
"""
token = None
try:
token = _decode_jwt_from_request('access')
token, header = _decode_jwt_from_request('access')
except (JWTExtendedException, PyJWTError):
token = getattr(ctx_stack.top, 'expired_jwt', None)

Expand Down
6 changes: 6 additions & 0 deletions app/api/schema/tickets.py
Expand Up @@ -67,6 +67,12 @@ def validate_quantity(self, data):
raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
"quantity should be greater than or equal to max-order")

@validates_schema
def validate_price(self, data):
if data['type'] == 'paid' and ('price' not in data or data['price'] <= 0):
raise UnprocessableEntity({'pointer': 'data/attributes/price'},
"paid ticket price should be greater than 0")

@validates_schema(pass_original=True)
def validate_discount_code(self, data, original_data):
if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']:
Expand Down
2 changes: 1 addition & 1 deletion app/api/server_version.py
@@ -1,6 +1,6 @@
from flask import jsonify, Blueprint

SERVER_VERSION = '1.7.0'
SERVER_VERSION = '1.8.0'

info_route = Blueprint('info', __name__)
_build = {'version': SERVER_VERSION}
Expand Down
12 changes: 6 additions & 6 deletions app/api/speakers.py
Expand Up @@ -47,10 +47,10 @@ def before_post(self, args, kwargs, data=None):
deleted_at=None)) > 0:
raise ForbiddenException({'pointer': ''}, 'Speaker with this Email ID already exists')

if data.get('is_email_overriden') and not has_access('is_organizer', event_id=data['event']):
raise ForbiddenException({'pointer': 'data/attributes/is_email_overriden'},
if data.get('is_email_overridden') and not has_access('is_organizer', event_id=data['event']):
raise ForbiddenException({'pointer': 'data/attributes/is_email_overridden'},
'Organizer access required to override email')
elif data.get('is_email_overriden') and has_access('is_organizer', event_id=data['event']) and \
elif data.get('is_email_overridden') and has_access('is_organizer', event_id=data['event']) and \
not data.get('email'):
data['email'] = current_user.email

Expand Down Expand Up @@ -135,10 +135,10 @@ def before_update_object(self, speaker, data, view_kwargs):
if data.get('photo_url') and data['photo_url'] != speaker.photo_url:
start_image_resizing_tasks(speaker, data['photo_url'])

if data.get('is_email_overriden') and not has_access('is_organizer', event_id=speaker.event_id):
raise ForbiddenException({'pointer': 'data/attributes/is_email_overriden'},
if data.get('is_email_overridden') and not has_access('is_organizer', event_id=speaker.event_id):
raise ForbiddenException({'pointer': 'data/attributes/is_email_overridden'},
'Organizer access required to override email')
elif data.get('is_email_overriden') and has_access('is_organizer', event_id=speaker.event_id) and \
elif data.get('is_email_overridden') and has_access('is_organizer', event_id=speaker.event_id) and \
not data.get('email'):
data['email'] = current_user.email

Expand Down
6 changes: 2 additions & 4 deletions app/models/event.py
Expand Up @@ -28,8 +28,7 @@

def get_new_event_identifier(length=8):
identifier = str(binascii.b2a_hex(os.urandom(int(length / 2))), 'utf-8')
count = get_count(Event.query.filter_by(identifier=identifier))
if count == 0:
if not identifier.isdigit() and get_count(Event.query.filter_by(identifier=identifier)) == 0:
return identifier
else:
return get_new_event_identifier(length)
Expand Down Expand Up @@ -364,7 +363,7 @@ def get_average_rating(self):

def is_payment_enabled(self):
return self.can_pay_by_paypal or self.can_pay_by_stripe or self.can_pay_by_omise or self.can_pay_by_alipay \
or self.can_pay_by_cheque or self.can_pay_by_bank or self.can_pay_onsite or self.can_pay_by_paytm
or self.can_pay_by_cheque or self.can_pay_by_bank or self.can_pay_onsite or self.can_pay_by_paytm

@property
def average_rating(self):
Expand Down Expand Up @@ -455,7 +454,6 @@ def has_speakers(self):
return Speaker.query.filter_by(event_id=self.id).count() > 0



@event.listens_for(Event, 'after_update')
@event.listens_for(Event, 'after_insert')
def receive_init(mapper, connection, target):
Expand Down
2 changes: 1 addition & 1 deletion app/models/ticket.py
Expand Up @@ -14,7 +14,7 @@
db.Column('ticket_id', db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE')),
db.PrimaryKeyConstraint('discount_code_id', 'ticket_id'))

ticket_tags_table = db.Table('association', db.Model.metadata,
ticket_tags_table = db.Table('ticket_tagging', db.Model.metadata,
db.Column('ticket_id', db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE')),
db.Column('ticket_tag_id', db.Integer, db.ForeignKey('ticket_tag.id', ondelete='CASCADE'))
)
Expand Down
194 changes: 194 additions & 0 deletions docs/api/blueprint/attendees.apib
Expand Up @@ -261,6 +261,200 @@ Get a list of attendees of an order.
"self": "/v1/orders/7201904e-c695-4251-a30a-61765a37ff24/attendees"
}
}

## List Attendees under an event [/v1/events/{event_id}/attendees]
+ Parameters
+ event_id: 1 (integer) - Identifier of the event

### List All Attendees under an event [GET]
Get a list of attendees of an event.

+ Request

+ Headers

Accept: application/vnd.api+json

Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

{
"meta": {
"count": 1
},
"data": [
{
"relationships": {
"ticket": {
"links": {
"self": "/v1/attendees/1/relationships/ticket",
"related": "/v1/attendees/1/ticket"
}
},
"order": {
"links": {
"self": "/v1/attendees/1/relationships/order",
"related": "/v1/attendees/1/order"
}
},
"event": {
"links": {
"self": "/v1/attendees/1/relationships/event",
"related": "/v1/attendees/1/event"
}
},
"user": {
"links": {
"self": "/v1/attendees/1/relationships/user",
"related": "/v1/attendees/1/user"
}
}
},
"attributes": {
"facebook": null,
"address": "address",
"ticket-id": "31",
"is-checked-out": null,
"checkout-times": null,
"job-title": null,
"deleted-at": null,
"work-address": null,
"checkin-times": null,
"state": "example",
"country": "IN",
"lastname": "UnDoe",
"city": "example",
"phone": null,
"company": null,
"is-checked-in": false,
"gender": null,
"shipping-address": null,
"blog": null,
"firstname": "John",
"website": null,
"billing-address": null,
"pdf-url": null,
"tax-business-info": null,
"home-address": null,
"work-phone": null,
"birth-date": null,
"github": null,
"twitter": null,
"email": "johndoe@example.com",
"attendee-notes": null
},
"type": "attendee",
"id": "1",
"links": {
"self": "/v1/attendees/1"
}
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "/v1/events/1/attendees"
}
}

## List Attendees under a ticket [/v1/tickets/{ticket_id}/attendees]
+ Parameters
+ ticket_id: 1 (integer) - Identifier of the event

### List All Attendees under a ticket [GET]
Get a list of attendees of a ticket.

+ Request

+ Headers

Accept: application/vnd.api+json

Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

{
"meta": {
"count": 1
},
"data": [
{
"relationships": {
"ticket": {
"links": {
"self": "/v1/attendees/1/relationships/ticket",
"related": "/v1/attendees/1/ticket"
}
},
"order": {
"links": {
"self": "/v1/attendees/1/relationships/order",
"related": "/v1/attendees/1/order"
}
},
"event": {
"links": {
"self": "/v1/attendees/1/relationships/event",
"related": "/v1/attendees/1/event"
}
},
"user": {
"links": {
"self": "/v1/attendees/1/relationships/user",
"related": "/v1/attendees/1/user"
}
}
},
"attributes": {
"facebook": null,
"address": "address",
"ticket-id": "1",
"is-checked-out": null,
"checkout-times": null,
"job-title": null,
"deleted-at": null,
"work-address": null,
"checkin-times": null,
"state": "example",
"country": "IN",
"lastname": "UnDoe",
"city": "example",
"phone": null,
"company": null,
"is-checked-in": false,
"gender": null,
"shipping-address": null,
"blog": null,
"firstname": "John",
"website": null,
"billing-address": null,
"pdf-url": null,
"tax-business-info": null,
"home-address": null,
"work-phone": null,
"birth-date": null,
"github": null,
"twitter": null,
"email": "johndoe@example.com",
"attendee-notes": null
},
"type": "attendee",
"id": "1",
"links": {
"self": "/v1/attendees/1"
}
}
],
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "/v1/tickets/1/attendees"
}
}

## Attendee Details [/v1/attendees/{attendee_id}]
+ Parameters
Expand Down
25 changes: 25 additions & 0 deletions docs/api/blueprint/auth/email_verification.apib
Expand Up @@ -27,3 +27,28 @@ Sends the token to verify the account associated with the provided email id via
{
"message": "Verification email resent"
}

## Verify Email [/v1/auth/verify-email]

### Verify the email via auth token [POST]
Verifies the user email via token.

+ Request

+ Headers

Content-Type: application/json

+ Body

{
"data": {
"token": "your token"
}
}

+ Response 200 (application/json)

{
"message": "Email Verified"
}
2 changes: 1 addition & 1 deletion docs/api/blueprint/order/orders.apib
Expand Up @@ -329,7 +329,7 @@ Update a single custom form with `id`.
"order-notes": "example"
},
"type": "order",
"id": "ab25a170-f36d-4dd6-b99c-9c202e693afc"
"id": "1"
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/installation/local.md
Expand Up @@ -93,7 +93,7 @@ pipenv shell
```


* **Step 2** - Create the database. For that we first open the psql shell. Go the directory where your postgres file is stored.
* **Step 2** - Create the database. For that we first open the psql shell. Go to the directory where your postgres file is stored.

```sh
# For linux users
Expand Down
11 changes: 10 additions & 1 deletion manage.py
Expand Up @@ -21,7 +21,7 @@ def list_routes():
output = []
for rule in app.url_map.iter_rules():
methods = ','.join(rule.methods)
line = urllib.unquote("{:50s} {:20s} {}".format(
line = urllib.parse.unquote("{:50s} {:20s} {}".format(
rule.endpoint, methods, rule))
output.append(line)

Expand All @@ -37,6 +37,15 @@ def add_event_identifier():
save_to_db(event)


@manager.command
def fix_digit_identifier():
events = Event.query.filter(Event.identifier.op('~')('^[0-9\.]+$')).all()
for event in events:
event.identifier = get_new_event_identifier()
db.session.add(event)
db.session.commit()


@manager.option('-n', '--name', dest='name', default='all')
@manager.option('-s', '--switch', dest='switch', default='off')
def module(name, switch):
Expand Down

0 comments on commit 997edf3

Please sign in to comment.