Skip to content

Commit 504d27e

Browse files
authored
Merge pull request #56 from rosscado/registration
Event registration
2 parents 4d796e9 + e3e2ac6 commit 504d27e

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

apps/api/models.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ def format_iso8601(self, dt):
8080
'contacts': fields.List(fields.Nested(a_contact, description='A list of persons to contact about the event'))
8181
})
8282

83+
registration_method = api.model('Registration Method', {
84+
'type': fields.String(description='The means of registration', enum=['online', 'ontheday'], default='ontheday'),
85+
'url': fields.String(description='Online registration URL or registration status change notification', example='http://www.signup.com/thebeggs18'),
86+
'state': fields.String(description='Can competitors register for the event?', enum=['open', 'limited', 'closed'], default='open')
87+
})
88+
89+
registration = api.model('Registration', {
90+
'methods': fields.List(fields.Nested(registration_method, description='A way to register for an event'))
91+
})
92+
8393
an_event = api.model('Base Event', {
8494
'id': fields.Integer(description='The unique identifier of an event (internal)', readonly=True),
8595
'title': fields.String(required=True, description='The name of the event as promoted publically', example='The John Beggs Memorial'),
@@ -90,7 +100,8 @@ def format_iso8601(self, dt):
90100
'event_type': fields.String(required=True,description='Is the event a road race, time trial, etc?', enum=['road race', 'time trial', 'hill climb', 'criterium', 'stage race'], default='road race'),
91101
'status': fields.Nested(event_status, description='Records any schedule changes. If absent assume event is still scheduled normally'),
92102
'organised_by': fields.Nested(organisers, description='Group (club and persons) organising the event'),
93-
'social_media': fields.Nested(social_media, description='Where to follow the event on social media')
103+
'social_media': fields.Nested(social_media, description='Where to follow the event on social media'),
104+
'registration': fields.Nested(registration, description='Event registration information')
94105
})
95106

96107
one_day_event = api.inherit('One Day Event', an_event, {

tests/fvt/test_events.tavern.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,41 @@ stages:
106106
response:
107107
status_code: 204
108108

109+
- name: Add registration method
110+
request:
111+
url: "{api.server}/api/events/{event_fixture_id}"
112+
json:
113+
title: Mondello GP
114+
date: "1970-01-02"
115+
event_type: criterium
116+
registration:
117+
methods:
118+
- type: ontheday
119+
state: open
120+
method: PUT
121+
headers:
122+
content-type: application/json
123+
response:
124+
status_code: 204
125+
126+
- name: Close registration (event full)
127+
request:
128+
url: "{api.server}/api/events/{event_fixture_id}"
129+
json:
130+
title: Mondello GP
131+
date: "1970-01-02"
132+
event_type: criterium
133+
registration:
134+
methods:
135+
- type: ontheday
136+
state: closed
137+
url: http://sorryaboutthat.com/eventfull
138+
method: PUT
139+
headers:
140+
content-type: application/json
141+
response:
142+
status_code: 204
143+
109144
- name: Cancel the event
110145
request:
111146
url: "{api.server}/api/events/{event_fixture_id}"

0 commit comments

Comments
 (0)