The Open Event Server enables organizers to manage events from concerts to conferences and meetups. It offers features for events with several tracks and venues. Event managers can create invitation forms for speakers and build schedules in a drag and drop interface. The event information is stored in a database. The system provides API endpoints to fetch the data, and to modify and update it.
The Open Event Server is based on JSON 1.0 Specification and hence build on top of Flask Rest Json API (for building Rest APIs) and Marshmallow (for Schema).
In this blog, we will talk about how to add API for accessing the System Messages on Open Event Server. The focus is on its Model updation and it’s Schema creation.
Model Updation
For the System Messages, we’ll make update model as follows
Now, let’s try to understand this Schema.
In this feature, we are providing Admin the rights to read email and notification formats used in Open Event application.
- First of all, there is the need to know that it has three columns notification_status, user_control_status and mail_status of type boolean.
- Next it has action attribute which is of type String.
- At last, we have hybrid properties email_message and notification_message which will return the format of email and notification respective to the action string.
- The hybrid properties depends on _email_message method and _notification_message method. These methods reads the MAILS and NOTIFS dictionaries and return there values corresponding to string of action key of corresponding record.
Schema Creation
For the System Messages, we’ll make our Schema as follows
Now, let’s try to understand this Schema.
In this feature, we are providing Admin the rights to read email and notification formats used in Open Event application.
- First of all, there is the need to know that it has three boolean properties notification_status, user_control_status and mail_status
- Next it has action attribute which is of type String and it’s value can be validated to have any one of the list provided in choices.
- At last, it has the String attributes email_message and notification_message which will return the action formats of email and notification concerning the action string provided.
So, we saw how System Messages Schema and Model is created / updated to allow Admin users to read it’s values.
Resources
- Documentation | Marshmallow : https://marshmallow-jsonapi.readthedocs.io/en/latest/
- Documentation | Flask Rest JSONAPI : http://flask-rest-jsonapi.readthedocs.io/en/latest/