To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 74220165 authored by Alexander Dietmüller's avatar Alexander Dietmüller Committed by adietmue
Browse files

Backend: Selections are now the same format as signups for easier handling.

parent 8d9feeb7
...@@ -190,7 +190,7 @@ DOMAIN = { ...@@ -190,7 +190,7 @@ DOMAIN = {
'selections': { 'selections': {
# Easy way for users to safe their selections before signup is open # Easy way for users to safe their selections before signup is open
# List of selected courses per user # exactly like singups, but without status
'user_methods': ['GET', 'POST', 'PATCH', 'DELETE'], 'user_methods': ['GET', 'POST', 'PATCH', 'DELETE'],
...@@ -202,20 +202,18 @@ DOMAIN = { ...@@ -202,20 +202,18 @@ DOMAIN = {
'nullable': False, 'nullable': False,
'required': True, 'required': True,
'only_own_nethz': True, 'only_own_nethz': True,
'unique': True, 'not_patchable': True, # Signup is tied to user
}, },
'courses': { 'course': {
'type': 'list', 'type': 'objectid',
'schema': { 'data_relation': {
'type': 'objectid', 'resource': 'courses',
'data_relation': { 'field': '_id',
'resource': 'courses', 'embeddable': True
'field': '_id',
'embeddable': True
},
# TODO: No duplicate entries
# TODO: No entries that are already reserved
}, },
'unique_combination': ['nethz'],
'required': True,
# TODO: No overlapping courses
}, },
}, },
}, },
......
...@@ -37,7 +37,7 @@ def test_create(app): ...@@ -37,7 +37,7 @@ def test_create(app):
selection = { selection = {
'nethz': 'Pablito', 'nethz': 'Pablito',
'courses': [course_response['_id']] 'course': course_response['_id']
} }
app.client.post('selections', data=selection, assert_status=201) app.client.post('selections', data=selection, assert_status=201)
......
...@@ -101,7 +101,7 @@ def test_selection_own_nethz(app): ...@@ -101,7 +101,7 @@ def test_selection_own_nethz(app):
# Try with other nethz # Try with other nethz
bad_selection = { bad_selection = {
'nethz': 'Notthenethz', 'nethz': 'Notthenethz',
'courses': [course], 'course': course,
} }
app.client.post('/selections', app.client.post('/selections',
data=bad_selection, data=bad_selection,
...@@ -110,7 +110,7 @@ def test_selection_own_nethz(app): ...@@ -110,7 +110,7 @@ def test_selection_own_nethz(app):
# Try with own nethz # Try with own nethz
good_selection = { good_selection = {
'nethz': nethz, 'nethz': nethz,
'courses': [course], 'course': course,
} }
app.client.post('/selections', app.client.post('/selections',
data=good_selection, data=good_selection,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment