Compare commits

..

4 Commits

Author SHA1 Message Date
e60b708ea6 Add preliminary jobs tables into database model 2024-03-05 22:37:43 +00:00
776803fc96 Merge pull request 'Add catalan flag' (!77) from HerHde/ki-backend:add-ca-flag into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #77

> Anything else to consider?

I didn't know myself, but it was interesting to find out. No, this should work as soon as deployed. Catalan already exists in the language DB, and the existance of ca.svg is already tested whenever a catalan icon is requested.
2023-12-10 19:08:48 +01:00
702f4968f6 Merge pull request 'Use Gitea registry' (!76) from gitea-registry into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #76
2023-12-10 18:46:35 +01:00
c1285153ef Add catalan flag
All checks were successful
continuous-integration/drone/pr Build is passing
2023-12-09 21:36:24 +01:00
2 changed files with 74 additions and 0 deletions

5
data/imgs/flags/ca.svg Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="810" height="540">
<rect width="810" height="540" fill="#FCDD09"/>
<path stroke="#DA121A" stroke-width="60" d="M0,90H810m0,120H0m0,120H810m0,120H0"/>
</svg>

After

Width:  |  Height:  |  Size: 242 B

View File

@ -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
}