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

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

parent 8d9feeb7
......@@ -190,7 +190,7 @@ DOMAIN = {
'selections': {
# 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'],
......@@ -202,20 +202,18 @@ DOMAIN = {
'nullable': False,
'required': True,
'only_own_nethz': True,
'unique': True,
'not_patchable': True, # Signup is tied to user
},
'courses': {
'type': 'list',
'schema': {
'type': 'objectid',
'data_relation': {
'resource': 'courses',
'field': '_id',
'embeddable': True
},
# TODO: No duplicate entries
# TODO: No entries that are already reserved
'course': {
'type': 'objectid',
'data_relation': {
'resource': 'courses',
'field': '_id',
'embeddable': True
},
'unique_combination': ['nethz'],
'required': True,
# TODO: No overlapping courses
},
},
},
......
......@@ -37,7 +37,7 @@ def test_create(app):
selection = {
'nethz': 'Pablito',
'courses': [course_response['_id']]
'course': course_response['_id']
}
app.client.post('selections', data=selection, assert_status=201)
......
......@@ -101,7 +101,7 @@ def test_selection_own_nethz(app):
# Try with other nethz
bad_selection = {
'nethz': 'Notthenethz',
'courses': [course],
'course': course,
}
app.client.post('/selections',
data=bad_selection,
......@@ -110,7 +110,7 @@ def test_selection_own_nethz(app):
# Try with own nethz
good_selection = {
'nethz': nethz,
'courses': [course],
'course': course,
}
app.client.post('/selections',
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