Compare commits
1 Commits
main
...
feature/#6
Author | SHA1 | Date | |
---|---|---|---|
e60b708ea6 |
@ -1,13 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
*
|
|
||||||
!Pipfile
|
|
||||||
!Pipfile.lock
|
|
||||||
!data/
|
|
||||||
!ki/
|
|
||||||
!LICENSES/
|
|
||||||
!migrations/
|
|
||||||
!app.py
|
|
||||||
!run_prod.py
|
|
34
.drone.yml
34
.drone.yml
@ -15,28 +15,15 @@ trigger:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: install-lint-test
|
- name: install-lint-test
|
||||||
image: python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba
|
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
|
||||||
env:
|
|
||||||
PYROOT: '/pyroot'
|
|
||||||
PYTHONUSERBASE: '/pyroot'
|
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache gcc g++ musl-dev python3-dev
|
|
||||||
- pip3 install pipenv
|
|
||||||
- pipenv verify
|
|
||||||
- pipenv install --dev
|
- pipenv install --dev
|
||||||
- pipenv run flake8
|
- pipenv run flake8
|
||||||
- pipenv run reuse lint
|
- pipenv run reuse lint
|
||||||
- pipenv run python -m unittest discover ki
|
- pipenv run python -m unittest discover ki
|
||||||
- name: docker-dry-run
|
|
||||||
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
image_pull_secrets:
|
||||||
settings:
|
- dockerconfig
|
||||||
registry: git.wtf-eg.de
|
|
||||||
repo: git.wtf-eg.de/kompetenzinventar/backend
|
|
||||||
target: ki-backend
|
|
||||||
dry_run: true
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -54,7 +41,7 @@ depends_on:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: docker-publish
|
- name: docker-publish
|
||||||
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: git.wtf-eg.de
|
registry: git.wtf-eg.de
|
||||||
repo: git.wtf-eg.de/kompetenzinventar/backend
|
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||||
@ -81,7 +68,7 @@ depends_on:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: deploy-dev
|
- name: deploy-dev
|
||||||
image: appleboy/drone-ssh:1.7.5@sha256:995677e073454912f26d4c0fdd2f9df2e1f5a30d6603d3f2ece667311b6babb3
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
host:
|
host:
|
||||||
- dev01.wtf-eg.net
|
- dev01.wtf-eg.net
|
||||||
@ -104,19 +91,14 @@ trigger:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: install-lint-test
|
- name: install-lint-test
|
||||||
image: python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba
|
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
|
||||||
env:
|
|
||||||
PYROOT: '/pyroot'
|
|
||||||
PYTHONUSERBASE: '/pyroot'
|
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache gcc g++ musl-dev python3-dev
|
|
||||||
- pip3 install pipenv
|
|
||||||
- pipenv install --dev
|
- pipenv install --dev
|
||||||
- pipenv run flake8
|
- pipenv run flake8
|
||||||
- pipenv run reuse lint
|
- pipenv run reuse lint
|
||||||
- pipenv run python -m unittest discover ki
|
- pipenv run python -m unittest discover ki
|
||||||
- name: docker-publish
|
- name: docker-publish
|
||||||
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: git.wtf-eg.de
|
registry: git.wtf-eg.de
|
||||||
repo: git.wtf-eg.de/kompetenzinventar/backend
|
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||||
|
@ -1 +0,0 @@
|
|||||||
3.8.20
|
|
12
.reuse/dep5
Normal file
12
.reuse/dep5
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: Kompetenzinventar
|
||||||
|
Upstream-Contact: Michael Weimann <mail@michael-weimann.eu>
|
||||||
|
Source: https://git.wtf-eg.de/kompetenzinventar/ki-backend
|
||||||
|
|
||||||
|
Files: data/imgs/flags/*
|
||||||
|
Copyright: 2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
Files: Pipfile.lock migrations/*
|
||||||
|
Copyright: WTF Kooperative eG <https://wtf-eg.de/>
|
||||||
|
License: AGPL-3.0-or-later
|
@ -1,5 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
|
|
||||||
migrations/*.py
|
|
17
Dockerfile
17
Dockerfile
@ -2,17 +2,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
FROM python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba AS builder
|
FROM git.wtf-eg.de/kompetenzinventar/builder:1.0.2 as builder
|
||||||
|
|
||||||
ENV PYROOT=/pyroot
|
|
||||||
ENV PYTHONUSERBASE=$PYROOT
|
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
gcc \
|
|
||||||
g++ \
|
|
||||||
musl-dev \
|
|
||||||
python3-dev && \
|
|
||||||
pip3 install pipenv
|
|
||||||
|
|
||||||
COPY Pipfile* ./
|
COPY Pipfile* ./
|
||||||
|
|
||||||
@ -20,10 +10,7 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
|
|||||||
RUN pip3 uninstall --yes pipenv
|
RUN pip3 uninstall --yes pipenv
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba AS ki-backend
|
FROM git.wtf-eg.de/kompetenzinventar/base:1.0.2 as ki-backend
|
||||||
|
|
||||||
ENV PYROOT=/pyroot
|
|
||||||
ENV PYTHONUSERBASE=$PYROOT
|
|
||||||
|
|
||||||
# Install six explicitly. Otherwise Python complains about it missing.
|
# Install six explicitly. Otherwise Python complains about it missing.
|
||||||
RUN pip3 install six
|
RUN pip3 install six
|
||||||
|
29
Pipfile
29
Pipfile
@ -8,23 +8,22 @@ verify_ssl = true
|
|||||||
name = "pypi"
|
name = "pypi"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
flask = "==2.3.3"
|
flask = "~=2.0.1"
|
||||||
python-dotenv = "==1.0.1"
|
python-dotenv = "~=0.17.1"
|
||||||
flask-migrate = "==4.0.7"
|
flask-migrate = "~=3.0.1"
|
||||||
flask-sqlalchemy = "==2.5.1"
|
flask-sqlalchemy = "~=2.5.1"
|
||||||
sqlalchemy = "==1.4.54"
|
sqlalchemy = "~=1.4.18"
|
||||||
waitress = "==2.1.2"
|
waitress = "~=2.0.0"
|
||||||
pyyaml = "==6.0.2"
|
pyyaml = "~=6.0.1"
|
||||||
flask-cors = "==5.0.0"
|
flask-cors = "~=3.0.10"
|
||||||
ldap3 = "==2.9.1"
|
ldap3 = "~=2.9"
|
||||||
pymysql = "==1.1.1"
|
pymysql = "~=1.0.2"
|
||||||
werkzeug = "==2.3.8"
|
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
flake8 = "==7.1.1"
|
flake8 = "~=3.9.2"
|
||||||
yapf = "==0.40.2"
|
yapf = "~=0.31.0"
|
||||||
pre-commit = "==2.21.0"
|
pre-commit = "~=2.13.0"
|
||||||
reuse = "==4.0.3"
|
reuse = "~=0.13.0"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.8"
|
python_version = "3.8"
|
||||||
|
1043
Pipfile.lock
generated
1043
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
24
REUSE.toml
24
REUSE.toml
@ -1,24 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: NONE
|
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
|
||||||
|
|
||||||
version = 1
|
|
||||||
SPDX-PackageName = "Kompetenzinventar Backend"
|
|
||||||
SPDX-PackageDownloadLocation = "https://git.wtf-eg.de/kompetenzinventar/ki-backend"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = "data/imgs/flags/**"
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>"
|
|
||||||
SPDX-License-Identifier = "MIT"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["Pipfile.lock", "migrations/**"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "WTF Kooperative eG <https://wtf-eg.de/>"
|
|
||||||
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
|
||||||
|
|
||||||
[[annotations]]
|
|
||||||
path = ["renovate.json", ".python-version"]
|
|
||||||
precedence = "aggregate"
|
|
||||||
SPDX-FileCopyrightText = "WTF Kooperative eG <https://wtf-eg.de/>"
|
|
||||||
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
|
69
ki/models.py
69
ki/models.py
@ -19,6 +19,8 @@ class User(db.Model):
|
|||||||
|
|
||||||
tokens = relationship("Token", back_populates="user")
|
tokens = relationship("Token", back_populates="user")
|
||||||
profile = relationship("Profile", back_populates="user")
|
profile = relationship("Profile", back_populates="user")
|
||||||
|
jobs = relationship("Job", back_populates="owner")
|
||||||
|
job_responses = relationship("JobResponse",back_populates="user")
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {"id": self.id}
|
return {"id": self.id}
|
||||||
@ -146,6 +148,7 @@ class Skill(db.Model):
|
|||||||
|
|
||||||
profiles = relationship("ProfileSkill", back_populates="skill")
|
profiles = relationship("ProfileSkill", back_populates="skill")
|
||||||
searchtopics = relationship("ProfileSearchtopic", back_populates="skill")
|
searchtopics = relationship("ProfileSearchtopic", back_populates="skill")
|
||||||
|
jobs = relationship("JobSkill", back_populates="skill")
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {"id": self.id, "name": self.name, "icon_url": "/skills/{}/icon".format(self.id)}
|
return {"id": self.id, "name": self.name, "icon_url": "/skills/{}/icon".format(self.id)}
|
||||||
@ -228,3 +231,69 @@ class ProfileLanguage(db.Model):
|
|||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {"profile_id": self.profile_id, "language": self.language.to_dict(), "level": self.level}
|
return {"profile_id": self.profile_id, "language": self.language.to_dict(), "level": self.level}
|
||||||
|
|
||||||
|
|
||||||
|
class Job(db.Model):
|
||||||
|
__tablename__ = "job"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
|
||||||
|
description = Column(String(5000))
|
||||||
|
amount_of_people_needed = Column(Integer, nullable=False)
|
||||||
|
amount_of_weekhours_needed = Column(Integer)
|
||||||
|
amount_of_payment_hour = Column(Integer)
|
||||||
|
timeframeImprecise = Column(String(120))
|
||||||
|
remotePercent = Column(Integer)
|
||||||
|
location = Column(String(50))
|
||||||
|
beginDate = Column(DateTime)
|
||||||
|
endDate = Column(DateTime)
|
||||||
|
link = Column(String(500))
|
||||||
|
aidsLevel = Column(Integer) ## Stupid Shit one has to deal with like Teams or weird Apps, Datathrower Webportals...
|
||||||
|
created = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
updated = Column(DateTime, onupdate=datetime.now, nullable=False, default=datetime.now)
|
||||||
|
withdrawn = Column(DateTime, nullable=True)
|
||||||
|
|
||||||
|
owner = relationship("User", back_populates="jobs")
|
||||||
|
responses = relationship("JobResponse", back_populates="jobs")
|
||||||
|
skills = relationship("JobSkill", back_populates="job")
|
||||||
|
def to_dict(self):
|
||||||
|
return {"job_id": self.id, "owner_id": self.owner_id, "description": self.description,
|
||||||
|
"amount_of_people_needed": self.amount_of_people_needed, "amount_of_weekhours_needed": self.amount_of_weekhours_needed,
|
||||||
|
"amount_of_payment_hour": self.amount_of_payment_hour, "timeframeImprecise": self.timeframeImprecise,
|
||||||
|
"remotePercent": self.timeframeImprecise, "location": self.location, "beginDate": self.beginDate,
|
||||||
|
"endDate": self.endDate, "link": self.link, "aidsLevel": self.aidsLevel, "created": self.created,
|
||||||
|
"updated": self.updated, "withdrawn": self.withdrawn
|
||||||
|
}
|
||||||
|
|
||||||
|
class JobSkill(db.Model):
|
||||||
|
__tablename__ = "job_skill"
|
||||||
|
|
||||||
|
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
|
||||||
|
skill_id = Column(Integer, ForeignKey("skill.id"), primary_key=True)
|
||||||
|
level = Column(SmallInteger, nullable=False)
|
||||||
|
|
||||||
|
job = relationship("Job", back_populates="skills")
|
||||||
|
skill = relationship("Skill", back_populates="jobs")
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {"job_id": self.job_id, "skill": self.skill.to_dict(), "level": self.level}
|
||||||
|
|
||||||
|
|
||||||
|
class JobResponse(db.Model):
|
||||||
|
__tablename__ = "job_response"
|
||||||
|
|
||||||
|
job_id = Column(Integer, ForeignKey("job.id"), primary_key=True)
|
||||||
|
user_id = Column(Integer, ForeignKey("user.id"), primary_key=True)
|
||||||
|
created = Column(DateTime, nullable=False, default=datetime.now)
|
||||||
|
withdrawn = Column(DateTime, nullable=True) # no longer interested/available
|
||||||
|
|
||||||
|
job = relationship("Job", back_populates="responses")
|
||||||
|
user = relationship("User", back_populates="job_responses")
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
"job": self.job.to_dict(),
|
||||||
|
"user": self.user.to_dict(),
|
||||||
|
"created": self.created,
|
||||||
|
"withdrawn": self.withdrawn
|
||||||
|
}
|
||||||
|
@ -17,7 +17,6 @@ content_type_png = "image/png"
|
|||||||
|
|
||||||
|
|
||||||
def token_auth(func):
|
def token_auth(func):
|
||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def _token_auth(*args, **kwargs):
|
def _token_auth(*args, **kwargs):
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
|
@ -8,7 +8,6 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestContactTypesEndpoint(ApiTest):
|
class TestContactTypesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/contacttypes")
|
response = self.client.options("/contacttypes")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -8,7 +8,6 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestFindProfilesEndpoint(ApiTest):
|
class TestFindProfilesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_find_profiles_options(self):
|
def test_find_profiles_options(self):
|
||||||
response = self.client.options("/users/profiles")
|
response = self.client.options("/users/profiles")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -8,7 +8,6 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestLanguagesEndpoint(ApiTest):
|
class TestLanguagesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/languages")
|
response = self.client.options("/languages")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -10,7 +10,6 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestLoginEndpoint(ApiTest):
|
class TestLoginEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_login(self):
|
def test_login(self):
|
||||||
response1_data = self.login("peter", "geheim")
|
response1_data = self.login("peter", "geheim")
|
||||||
response2_data = self.login("peter", "geheim")
|
response2_data = self.login("peter", "geheim")
|
||||||
|
@ -8,7 +8,6 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestSkillsEndpoint(ApiTest):
|
class TestSkillsEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/skills")
|
response = self.client.options("/skills")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"config:best-practices",
|
|
||||||
":disableDependencyDashboard",
|
|
||||||
":maintainLockFilesMonthly",
|
|
||||||
":pinVersions",
|
|
||||||
":separateMultipleMajorReleases"
|
|
||||||
],
|
|
||||||
"packageRules": [
|
|
||||||
{
|
|
||||||
"matchDepNames": ["python"],
|
|
||||||
"groupName": "Python",
|
|
||||||
"separateMinorPatch": true,
|
|
||||||
"separateMultipleMinor": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user