forked from kompetenzinventar/ki-backend
add availability
This commit is contained in:
parent
61bf24eab2
commit
a401c6d4a7
@ -65,6 +65,7 @@ def seed(dev: bool):
|
||||
peters_profile = Profile(nickname="peternichtlustig",
|
||||
pronouns="Herr Dr. Dr.",
|
||||
volunteerwork="Gartenverein",
|
||||
availability="Immer",
|
||||
freetext="Ich mag Kaffee",
|
||||
user=peter)
|
||||
db.session.add(peters_profile)
|
||||
|
@ -110,6 +110,7 @@ def update_profile(user_id: int):
|
||||
|
||||
profile.pronouns = request.json.get("pronouns", "")
|
||||
profile.volunteerwork = request.json.get("volunteerwork", "")
|
||||
profile.availability = request.json.get("availability", "")
|
||||
profile.freetext = request.json.get("freetext", "")
|
||||
profile.visible = request.json.get("visible", False)
|
||||
|
||||
|
@ -32,6 +32,7 @@ class Profile(db.Model):
|
||||
pronouns = Column(String(25), default="")
|
||||
volunteerwork = Column(String(4000), default="")
|
||||
freetext = Column(String(4000), default="")
|
||||
availability = Column(String(4000), default="")
|
||||
visible = Column(Boolean, nullable=False, default=False)
|
||||
created = Column(DateTime, 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,
|
||||
"pronouns": self.pronouns,
|
||||
"volunteerwork": self.volunteerwork,
|
||||
"availability": self.availability,
|
||||
"freetext": self.freetext,
|
||||
"visible": self.visible,
|
||||
"address": self.address.to_dict(),
|
||||
|
@ -33,6 +33,7 @@ class TestProfileEndpoint(ApiTest):
|
||||
data = {
|
||||
"pronouns": "Monsieur",
|
||||
"volunteerwork": "ja",
|
||||
"availability": "Nie",
|
||||
"freetext": "Hallo",
|
||||
"visible": True,
|
||||
"address": {
|
||||
@ -96,6 +97,7 @@ class TestProfileEndpoint(ApiTest):
|
||||
profile = user.profile
|
||||
self.assertEqual("Monsieur", profile.pronouns)
|
||||
self.assertEqual("ja", profile.volunteerwork)
|
||||
self.assertEqual("Nie", profile.availability)
|
||||
self.assertEqual("Hallo", profile.freetext)
|
||||
self.assertTrue(profile.visible)
|
||||
|
||||
@ -165,6 +167,7 @@ class TestProfileEndpoint(ApiTest):
|
||||
"user_id": 1,
|
||||
"nickname": "peternichtlustig",
|
||||
"pronouns": "Herr Dr. Dr.",
|
||||
"availability": "Immer",
|
||||
"freetext": "Ich mag Kaffee",
|
||||
"volunteerwork": "Gartenverein",
|
||||
"visible": False,
|
||||
|
1
migrations/README
Normal file
1
migrations/README
Normal file
@ -0,0 +1 @@
|
||||
Generic single-database configuration.
|
@ -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.
|
||||
|
||||
[alembic]
|
||||
|
@ -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
|
||||
|
||||
import logging
|
||||
|
@ -1,12 +1,8 @@
|
||||
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
"""Initial migration.
|
||||
|
||||
Revision ID: ebb2dd1fb371
|
||||
Revision ID: 808fe55111df
|
||||
Revises:
|
||||
Create Date: 2021-07-02 16:20:18.160228
|
||||
Create Date: 2021-07-05 20:13:50.560579
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
@ -14,7 +10,7 @@ import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ebb2dd1fb371'
|
||||
revision = '808fe55111df'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
@ -38,6 +34,7 @@ def upgrade():
|
||||
sa.Column('pronouns', sa.String(length=25), nullable=True),
|
||||
sa.Column('volunteerwork', 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('created', sa.DateTime(), nullable=False),
|
||||
sa.Column('updated', sa.DateTime(), nullable=False),
|
Loading…
Reference in New Issue
Block a user