Merge pull request 'availability Feld' (#33) from feature-availability into main

Reviewed-on: kompetenzinventar/ki-backend#33
This commit is contained in:
weeman 2021-07-06 21:03:04 +02:00
commit 980415bd20
8 changed files with 12 additions and 15 deletions

View File

@ -65,6 +65,7 @@ def seed(dev: bool):
peters_profile = Profile(nickname="peternichtlustig", peters_profile = Profile(nickname="peternichtlustig",
pronouns="Herr Dr. Dr.", pronouns="Herr Dr. Dr.",
volunteerwork="Gartenverein", volunteerwork="Gartenverein",
availability="Immer",
freetext="Ich mag Kaffee", freetext="Ich mag Kaffee",
user=peter) user=peter)
db.session.add(peters_profile) db.session.add(peters_profile)

View File

@ -110,6 +110,7 @@ def update_profile(user_id: int):
profile.pronouns = request.json.get("pronouns", "") profile.pronouns = request.json.get("pronouns", "")
profile.volunteerwork = request.json.get("volunteerwork", "") profile.volunteerwork = request.json.get("volunteerwork", "")
profile.availability = request.json.get("availability", "")
profile.freetext = request.json.get("freetext", "") profile.freetext = request.json.get("freetext", "")
profile.visible = request.json.get("visible", False) profile.visible = request.json.get("visible", False)

View File

@ -32,6 +32,7 @@ class Profile(db.Model):
pronouns = Column(String(25), default="") pronouns = Column(String(25), default="")
volunteerwork = Column(String(4000), default="") volunteerwork = Column(String(4000), default="")
freetext = Column(String(4000), default="") freetext = Column(String(4000), default="")
availability = Column(String(4000), default="")
visible = Column(Boolean, nullable=False, default=False) visible = Column(Boolean, nullable=False, default=False)
created = Column(DateTime, nullable=False, default=datetime.now) created = Column(DateTime, nullable=False, default=datetime.now)
updated = Column(DateTime, onupdate=datetime.now, nullable=False, default=datetime.now) updated = Column(DateTime, onupdate=datetime.now, nullable=False, default=datetime.now)
@ -48,6 +49,7 @@ class Profile(db.Model):
"nickname": self.nickname, "nickname": self.nickname,
"pronouns": self.pronouns, "pronouns": self.pronouns,
"volunteerwork": self.volunteerwork, "volunteerwork": self.volunteerwork,
"availability": self.availability,
"freetext": self.freetext, "freetext": self.freetext,
"visible": self.visible, "visible": self.visible,
"address": self.address.to_dict(), "address": self.address.to_dict(),

View File

@ -33,6 +33,7 @@ class TestProfileEndpoint(ApiTest):
data = { data = {
"pronouns": "Monsieur", "pronouns": "Monsieur",
"volunteerwork": "ja", "volunteerwork": "ja",
"availability": "Nie",
"freetext": "Hallo", "freetext": "Hallo",
"visible": True, "visible": True,
"address": { "address": {
@ -96,6 +97,7 @@ class TestProfileEndpoint(ApiTest):
profile = user.profile profile = user.profile
self.assertEqual("Monsieur", profile.pronouns) self.assertEqual("Monsieur", profile.pronouns)
self.assertEqual("ja", profile.volunteerwork) self.assertEqual("ja", profile.volunteerwork)
self.assertEqual("Nie", profile.availability)
self.assertEqual("Hallo", profile.freetext) self.assertEqual("Hallo", profile.freetext)
self.assertTrue(profile.visible) self.assertTrue(profile.visible)
@ -165,6 +167,7 @@ class TestProfileEndpoint(ApiTest):
"user_id": 1, "user_id": 1,
"nickname": "peternichtlustig", "nickname": "peternichtlustig",
"pronouns": "Herr Dr. Dr.", "pronouns": "Herr Dr. Dr.",
"availability": "Immer",
"freetext": "Ich mag Kaffee", "freetext": "Ich mag Kaffee",
"volunteerwork": "Gartenverein", "volunteerwork": "Gartenverein",
"visible": False, "visible": False,

1
migrations/README Normal file
View File

@ -0,0 +1 @@
Generic single-database configuration.

View File

@ -1,7 +1,3 @@
; SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
;
; SPDX-License-Identifier: AGPL-3.0-or-later
# A generic, single database configuration. # A generic, single database configuration.
[alembic] [alembic]

View File

@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from __future__ import with_statement from __future__ import with_statement
import logging import logging

View File

@ -1,12 +1,8 @@
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Initial migration. """Initial migration.
Revision ID: ebb2dd1fb371 Revision ID: 808fe55111df
Revises: Revises:
Create Date: 2021-07-02 16:20:18.160228 Create Date: 2021-07-05 20:13:50.560579
""" """
from alembic import op from alembic import op
@ -14,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = 'ebb2dd1fb371' revision = '808fe55111df'
down_revision = None down_revision = None
branch_labels = None branch_labels = None
depends_on = None depends_on = None
@ -38,6 +34,7 @@ def upgrade():
sa.Column('pronouns', sa.String(length=25), nullable=True), sa.Column('pronouns', sa.String(length=25), nullable=True),
sa.Column('volunteerwork', sa.String(length=4000), nullable=True), sa.Column('volunteerwork', sa.String(length=4000), nullable=True),
sa.Column('freetext', sa.String(length=4000), nullable=True), sa.Column('freetext', sa.String(length=4000), nullable=True),
sa.Column('availability', sa.String(length=4000), nullable=True),
sa.Column('visible', sa.Boolean(), nullable=False), sa.Column('visible', sa.Boolean(), nullable=False),
sa.Column('created', sa.DateTime(), nullable=False), sa.Column('created', sa.DateTime(), nullable=False),
sa.Column('updated', sa.DateTime(), nullable=False), sa.Column('updated', sa.DateTime(), nullable=False),