Spaces:
Runtime error
Runtime error
Create models.py
Browse files
models.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sqlalchemy import Column, Integer, String, ForeignKey, JSON, Text
|
| 2 |
+
from sqlalchemy.orm import relationship
|
| 3 |
+
from .database import Base
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class Job(Base):
|
| 7 |
+
__tablename__ = "jobs"
|
| 8 |
+
|
| 9 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 10 |
+
title = Column(String, nullable=False)
|
| 11 |
+
company = Column(String, nullable=False)
|
| 12 |
+
name = Column(String, nullable=True)
|
| 13 |
+
content = Column(Text, nullable=False)
|
| 14 |
+
requirements = Column(JSON, nullable=True)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class Resume(Base):
|
| 18 |
+
__tablename__ = "resumes"
|
| 19 |
+
|
| 20 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 21 |
+
name = Column(String, nullable=False)
|
| 22 |
+
content = Column(Text, nullable=False)
|
| 23 |
+
category = Column(String, nullable=True)
|
| 24 |
+
parsed_fields = Column(JSON, nullable=True)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class Education(Base):
|
| 28 |
+
__tablename__ = "educations"
|
| 29 |
+
|
| 30 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 31 |
+
name = Column(String, nullable=False)
|
| 32 |
+
degree = Column(String, nullable=True)
|
| 33 |
+
institution = Column(String, nullable=True)
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class Certificate(Base):
|
| 37 |
+
__tablename__ = "certificates"
|
| 38 |
+
|
| 39 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 40 |
+
name = Column(String, nullable=False)
|
| 41 |
+
issuer = Column(String, nullable=True)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class Experience(Base):
|
| 45 |
+
__tablename__ = "experiences"
|
| 46 |
+
|
| 47 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 48 |
+
name = Column(String, nullable=False)
|
| 49 |
+
company = Column(String, nullable=True)
|
| 50 |
+
years = Column(Integer, nullable=True)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
class Skill(Base):
|
| 54 |
+
__tablename__ = "skills"
|
| 55 |
+
|
| 56 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 57 |
+
name = Column(String, nullable=False)
|
| 58 |
+
level = Column(String, nullable=True)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class Candidate(Base):
|
| 62 |
+
__tablename__ = "candidates"
|
| 63 |
+
|
| 64 |
+
id = Column(Integer, primary_key=True, index=True)
|
| 65 |
+
name = Column(String, nullable=False)
|
| 66 |
+
|
| 67 |
+
education_id = Column(Integer, ForeignKey("educations.id"))
|
| 68 |
+
certificate_id = Column(Integer, ForeignKey("certificates.id"))
|
| 69 |
+
experience_id = Column(Integer, ForeignKey("experiences.id"))
|
| 70 |
+
skill_id = Column(Integer, ForeignKey("skills.id"))
|
| 71 |
+
resume_id = Column(Integer, ForeignKey("resumes.id"))
|
| 72 |
+
|
| 73 |
+
education = relationship("Education")
|
| 74 |
+
certificate = relationship("Certificate")
|
| 75 |
+
experience = relationship("Experience")
|
| 76 |
+
skill = relationship("Skill")
|
| 77 |
+
resume = relationship("Resume")
|