first commit1
This commit is contained in:
parent
bfd6ff7f71
commit
c3197fe54d
|
@ -22,7 +22,7 @@ WORKDIR /app
|
||||||
RUN uv sync --frozen
|
RUN uv sync --frozen
|
||||||
|
|
||||||
# Expose port 8000
|
# Expose port 8000
|
||||||
EXPOSE 8024
|
EXPOSE 8000
|
||||||
|
|
||||||
|
|
||||||
# Presuming there is a `my_app` command provided by the project uvicorn main:app --reload
|
# Presuming there is a `my_app` command provided by the project uvicorn main:app --reload
|
||||||
|
|
|
@ -5,7 +5,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env
|
env_file: .env
|
||||||
ports:
|
ports:
|
||||||
- "8024:8024"
|
- "8000:8000"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
command: ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8025"]
|
command: ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8025"]
|
||||||
|
|
177
logs/app.log
177
logs/app.log
|
@ -11552,3 +11552,180 @@ WHERE users.username = %s
|
||||||
FROM jobs
|
FROM jobs
|
||||||
2025-02-17 18:14:21,132 - INFO - [cached since 54.59s ago] ()
|
2025-02-17 18:14:21,132 - INFO - [cached since 54.59s ago] ()
|
||||||
2025-02-17 18:14:21,350 - INFO - ROLLBACK
|
2025-02-17 18:14:21,350 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:45:56,753 - INFO - SELECT DATABASE()
|
||||||
|
2025-02-17 20:45:56,754 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:56,883 - INFO - SELECT @@sql_mode
|
||||||
|
2025-02-17 20:45:56,884 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:56,949 - INFO - SELECT @@lower_case_table_names
|
||||||
|
2025-02-17 20:45:56,949 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,082 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:45:57,082 - INFO - DESCRIBE `ch7a461e0f_link`.`users`
|
||||||
|
2025-02-17 20:45:57,083 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,150 - INFO - DESCRIBE `ch7a461e0f_link`.`profile`
|
||||||
|
2025-02-17 20:45:57,150 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,217 - INFO - DESCRIBE `ch7a461e0f_link`.`jobs`
|
||||||
|
2025-02-17 20:45:57,218 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,285 - INFO - DESCRIBE `ch7a461e0f_link`.`client`
|
||||||
|
2025-02-17 20:45:57,285 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,353 - INFO - DESCRIBE `ch7a461e0f_link`.`applied_jobs`
|
||||||
|
2025-02-17 20:45:57,354 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:45:57,420 - INFO - COMMIT
|
||||||
|
2025-02-17 20:45:57,552 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:45:57,565 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
LIMIT %s
|
||||||
|
2025-02-17 20:45:57,565 - INFO - [generated in 0.00042s] (1,)
|
||||||
|
2025-02-17 20:45:57,632 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:06,945 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:06,947 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:46:06,947 - INFO - [generated in 0.00032s] ('admin',)
|
||||||
|
2025-02-17 20:46:07,020 - WARNING - (trapped) error reading bcrypt version
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/home/blues/Nextcloud/2025/admins/.venv/lib/python3.12/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
|
||||||
|
version = _bcrypt.__about__.__version__
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
AttributeError: module 'bcrypt' has no attribute '__about__'
|
||||||
|
2025-02-17 20:46:07,325 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:07,461 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:07,461 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:46:07,461 - INFO - [cached since 0.5144s ago] ('admin',)
|
||||||
|
2025-02-17 20:46:07,535 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:08,999 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:09,001 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:46:09,001 - INFO - [cached since 2.054s ago] ('admin',)
|
||||||
|
2025-02-17 20:46:09,069 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:38,833 - INFO - SELECT DATABASE()
|
||||||
|
2025-02-17 20:46:38,834 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:38,964 - INFO - SELECT @@sql_mode
|
||||||
|
2025-02-17 20:46:38,964 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,030 - INFO - SELECT @@lower_case_table_names
|
||||||
|
2025-02-17 20:46:39,031 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,163 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:39,163 - INFO - DESCRIBE `ch7a461e0f_link`.`users`
|
||||||
|
2025-02-17 20:46:39,163 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,230 - INFO - DESCRIBE `ch7a461e0f_link`.`profile`
|
||||||
|
2025-02-17 20:46:39,231 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,298 - INFO - DESCRIBE `ch7a461e0f_link`.`jobs`
|
||||||
|
2025-02-17 20:46:39,299 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,365 - INFO - DESCRIBE `ch7a461e0f_link`.`client`
|
||||||
|
2025-02-17 20:46:39,365 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,431 - INFO - DESCRIBE `ch7a461e0f_link`.`applied_jobs`
|
||||||
|
2025-02-17 20:46:39,431 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:39,497 - INFO - COMMIT
|
||||||
|
2025-02-17 20:46:39,628 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:39,643 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
LIMIT %s
|
||||||
|
2025-02-17 20:46:39,643 - INFO - [generated in 0.00035s] (1,)
|
||||||
|
2025-02-17 20:46:39,710 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:39,844 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:39,845 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:46:39,845 - INFO - [generated in 0.00023s] ('admin',)
|
||||||
|
2025-02-17 20:46:39,911 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:57,886 - INFO - SELECT DATABASE()
|
||||||
|
2025-02-17 20:46:57,887 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,018 - INFO - SELECT @@sql_mode
|
||||||
|
2025-02-17 20:46:58,019 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,085 - INFO - SELECT @@lower_case_table_names
|
||||||
|
2025-02-17 20:46:58,086 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,217 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:58,218 - INFO - DESCRIBE `ch7a461e0f_link`.`users`
|
||||||
|
2025-02-17 20:46:58,218 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,283 - INFO - DESCRIBE `ch7a461e0f_link`.`profile`
|
||||||
|
2025-02-17 20:46:58,283 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,350 - INFO - DESCRIBE `ch7a461e0f_link`.`jobs`
|
||||||
|
2025-02-17 20:46:58,351 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,419 - INFO - DESCRIBE `ch7a461e0f_link`.`client`
|
||||||
|
2025-02-17 20:46:58,419 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,494 - INFO - DESCRIBE `ch7a461e0f_link`.`applied_jobs`
|
||||||
|
2025-02-17 20:46:58,494 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:46:58,561 - INFO - COMMIT
|
||||||
|
2025-02-17 20:46:58,692 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:58,703 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
LIMIT %s
|
||||||
|
2025-02-17 20:46:58,703 - INFO - [generated in 0.00046s] (1,)
|
||||||
|
2025-02-17 20:46:58,769 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:46:58,901 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:46:58,902 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:46:58,902 - INFO - [generated in 0.00021s] ('admin',)
|
||||||
|
2025-02-17 20:46:58,974 - INFO - SELECT applied_jobs.id, applied_jobs.client_id, applied_jobs.job_id, applied_jobs.applied_on, applied_jobs.status, applied_jobs.assignee, applied_jobs.priority, client_1.id AS id_1, client_1.username, client_1.phone, client_1.email, client_1.link, client_1.is_active, jobs_1.job_id AS job_id_1, jobs_1.job_title, jobs_1.job_company, jobs_1.minimum_annual_salary, jobs_1.salary_currency, jobs_1.location_type, jobs_1.location, jobs_1.job_level, jobs_1.job_type, jobs_1.days_posted, jobs_1.hourly_rate, jobs_1.link AS link_1, jobs_1.link_company, jobs_1.active, users_1.id AS id_2, users_1.username AS username_1, users_1.hashed_password, users_1.`role`, users_1.is_active AS is_active_1
|
||||||
|
FROM applied_jobs LEFT OUTER JOIN client AS client_1 ON client_1.id = applied_jobs.client_id LEFT OUTER JOIN jobs AS jobs_1 ON jobs_1.job_id = applied_jobs.job_id LEFT OUTER JOIN users AS users_1 ON users_1.id = applied_jobs.assignee
|
||||||
|
2025-02-17 20:46:58,975 - INFO - [generated in 0.00035s] ()
|
||||||
|
2025-02-17 20:46:59,051 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:48:16,890 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:48:16,891 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:48:16,891 - INFO - [cached since 77.99s ago] ('admin',)
|
||||||
|
2025-02-17 20:48:16,958 - INFO - SELECT applied_jobs.id, applied_jobs.client_id, applied_jobs.job_id, applied_jobs.applied_on, applied_jobs.status, applied_jobs.assignee, applied_jobs.priority, client_1.id AS id_1, client_1.username, client_1.phone, client_1.email, client_1.link, client_1.is_active, jobs_1.job_id AS job_id_1, jobs_1.job_title, jobs_1.job_company, jobs_1.minimum_annual_salary, jobs_1.salary_currency, jobs_1.location_type, jobs_1.location, jobs_1.job_level, jobs_1.job_type, jobs_1.days_posted, jobs_1.hourly_rate, jobs_1.link AS link_1, jobs_1.link_company, jobs_1.active, users_1.id AS id_2, users_1.username AS username_1, users_1.hashed_password, users_1.`role`, users_1.is_active AS is_active_1
|
||||||
|
FROM applied_jobs LEFT OUTER JOIN client AS client_1 ON client_1.id = applied_jobs.client_id LEFT OUTER JOIN jobs AS jobs_1 ON jobs_1.job_id = applied_jobs.job_id LEFT OUTER JOIN users AS users_1 ON users_1.id = applied_jobs.assignee
|
||||||
|
2025-02-17 20:48:16,958 - INFO - [cached since 77.98s ago] ()
|
||||||
|
2025-02-17 20:48:17,030 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:56:45,083 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:56:45,083 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
WHERE users.username = %s
|
||||||
|
2025-02-17 20:56:45,084 - INFO - [cached since 586.2s ago] ('admin',)
|
||||||
|
2025-02-17 20:56:45,150 - INFO - SELECT applied_jobs.id, applied_jobs.client_id, applied_jobs.job_id, applied_jobs.applied_on, applied_jobs.status, applied_jobs.assignee, applied_jobs.priority, client_1.id AS id_1, client_1.username, client_1.phone, client_1.email, client_1.link, client_1.is_active, jobs_1.job_id AS job_id_1, jobs_1.job_title, jobs_1.job_company, jobs_1.minimum_annual_salary, jobs_1.salary_currency, jobs_1.location_type, jobs_1.location, jobs_1.job_level, jobs_1.job_type, jobs_1.days_posted, jobs_1.hourly_rate, jobs_1.link AS link_1, jobs_1.link_company, jobs_1.active, users_1.id AS id_2, users_1.username AS username_1, users_1.hashed_password, users_1.`role`, users_1.is_active AS is_active_1
|
||||||
|
FROM applied_jobs LEFT OUTER JOIN client AS client_1 ON client_1.id = applied_jobs.client_id LEFT OUTER JOIN jobs AS jobs_1 ON jobs_1.job_id = applied_jobs.job_id LEFT OUTER JOIN users AS users_1 ON users_1.id = applied_jobs.assignee
|
||||||
|
2025-02-17 20:56:45,150 - INFO - [cached since 586.2s ago] ()
|
||||||
|
2025-02-17 20:56:45,221 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:58:53,838 - INFO - SELECT DATABASE()
|
||||||
|
2025-02-17 20:58:53,839 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:53,972 - INFO - SELECT @@sql_mode
|
||||||
|
2025-02-17 20:58:53,972 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,040 - INFO - SELECT @@lower_case_table_names
|
||||||
|
2025-02-17 20:58:54,040 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,173 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:58:54,173 - INFO - DESCRIBE `ch7a461e0f_link`.`users`
|
||||||
|
2025-02-17 20:58:54,173 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,239 - INFO - DESCRIBE `ch7a461e0f_link`.`profile`
|
||||||
|
2025-02-17 20:58:54,240 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,305 - INFO - DESCRIBE `ch7a461e0f_link`.`jobs`
|
||||||
|
2025-02-17 20:58:54,305 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,371 - INFO - DESCRIBE `ch7a461e0f_link`.`client`
|
||||||
|
2025-02-17 20:58:54,371 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,437 - INFO - DESCRIBE `ch7a461e0f_link`.`applied_jobs`
|
||||||
|
2025-02-17 20:58:54,438 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:58:54,505 - INFO - COMMIT
|
||||||
|
2025-02-17 20:58:54,635 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:58:54,644 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
LIMIT %s
|
||||||
|
2025-02-17 20:58:54,644 - INFO - [generated in 0.00033s] (1,)
|
||||||
|
2025-02-17 20:58:54,710 - INFO - ROLLBACK
|
||||||
|
2025-02-17 20:59:14,183 - INFO - SELECT DATABASE()
|
||||||
|
2025-02-17 20:59:14,184 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,314 - INFO - SELECT @@sql_mode
|
||||||
|
2025-02-17 20:59:14,314 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,379 - INFO - SELECT @@lower_case_table_names
|
||||||
|
2025-02-17 20:59:14,379 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,509 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:59:14,510 - INFO - DESCRIBE `ch7a461e0f_link`.`users`
|
||||||
|
2025-02-17 20:59:14,510 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,576 - INFO - DESCRIBE `ch7a461e0f_link`.`profile`
|
||||||
|
2025-02-17 20:59:14,577 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,642 - INFO - DESCRIBE `ch7a461e0f_link`.`jobs`
|
||||||
|
2025-02-17 20:59:14,643 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,708 - INFO - DESCRIBE `ch7a461e0f_link`.`client`
|
||||||
|
2025-02-17 20:59:14,708 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,775 - INFO - DESCRIBE `ch7a461e0f_link`.`applied_jobs`
|
||||||
|
2025-02-17 20:59:14,775 - INFO - [raw sql] ()
|
||||||
|
2025-02-17 20:59:14,842 - INFO - COMMIT
|
||||||
|
2025-02-17 20:59:14,976 - INFO - BEGIN (implicit)
|
||||||
|
2025-02-17 20:59:14,986 - INFO - SELECT users.id, users.username, users.hashed_password, users.`role`, users.is_active
|
||||||
|
FROM users
|
||||||
|
LIMIT %s
|
||||||
|
2025-02-17 20:59:14,987 - INFO - [generated in 0.00036s] (1,)
|
||||||
|
2025-02-17 20:59:15,066 - INFO - ROLLBACK
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
from sqlalchemy import Column, Integer, String, Text, DateTime, Float, Boolean, BigInteger
|
from sqlalchemy import Column, Integer, String, Text, DateTime, Float, Boolean, BigInteger, ForeignKey, DateTime
|
||||||
from sqlalchemy.dialects.mysql import JSON
|
from sqlalchemy.dialects.mysql import JSON
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||||
|
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
from sqlalchemy.sql import func
|
||||||
from sqlalchemy.orm import sessionmaker, declarative_base
|
from sqlalchemy.orm import sessionmaker, declarative_base
|
||||||
from sqlalchemy.sql import func
|
from sqlalchemy.sql import func
|
||||||
from passlib.context import CryptContext
|
from passlib.context import CryptContext
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from sqlalchemy.future import select
|
from sqlalchemy.future import select
|
||||||
|
from datetime import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Загружаем переменные окружения
|
# Загружаем переменные окружения
|
||||||
|
@ -72,6 +76,9 @@ class User(Base):
|
||||||
role = Column(String(55), default="user")
|
role = Column(String(55), default="user")
|
||||||
is_active = Column(Boolean, default=True)
|
is_active = Column(Boolean, default=True)
|
||||||
|
|
||||||
|
|
||||||
|
applications = relationship("AppliedJob", back_populates="users")
|
||||||
|
|
||||||
# Модель профиля
|
# Модель профиля
|
||||||
class Profile(Base):
|
class Profile(Base):
|
||||||
__tablename__ = "profile"
|
__tablename__ = "profile"
|
||||||
|
@ -108,3 +115,39 @@ class Job(Base):
|
||||||
link = Column(String(2083), nullable=True) # URL вакансии
|
link = Column(String(2083), nullable=True) # URL вакансии
|
||||||
link_company = Column(String(2083), nullable=True) # URL компании
|
link_company = Column(String(2083), nullable=True) # URL компании
|
||||||
active = Column(Boolean, default=True) # Вакансия активна?
|
active = Column(Boolean, default=True) # Вакансия активна?
|
||||||
|
|
||||||
|
|
||||||
|
# Связь с AppliedJobs
|
||||||
|
applications = relationship("AppliedJob", back_populates="job")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Client(Base):
|
||||||
|
__tablename__ = "client"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
username = Column(String(55), unique=True, index=True, nullable=False) # ✅ Правильно
|
||||||
|
phone = Column(String(55), unique=True, index=True, nullable=True) # ✅ Правильно
|
||||||
|
email = Column(String(55), unique=True, index=True, nullable=True) # ✅ Правильно
|
||||||
|
link = Column(String(2083), nullable=True) # URL вакансии
|
||||||
|
is_active = Column(Boolean, default=True)
|
||||||
|
|
||||||
|
# Связь с AppliedJobs (заявки на вакансии)
|
||||||
|
applications = relationship("AppliedJob", back_populates="client")
|
||||||
|
|
||||||
|
|
||||||
|
class AppliedJob(Base):
|
||||||
|
__tablename__ = "applied_jobs"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
client_id = Column(Integer, ForeignKey("client.id"), nullable=False)
|
||||||
|
job_id = Column(BigInteger, ForeignKey("jobs.job_id"), nullable=False)
|
||||||
|
applied_on = Column(DateTime, nullable=True) # ✅ Теперь может быть NULL
|
||||||
|
status = Column(String(50), nullable=True) # ✅ Может быть NULL
|
||||||
|
assignee = Column(Integer, ForeignKey("users.id"), nullable=True) # ✅ Может быть NULL
|
||||||
|
priority = Column(String(50), nullable=True) # ✅ Может быть NULL
|
||||||
|
|
||||||
|
client = relationship("Client", back_populates="applications")
|
||||||
|
job = relationship("Job", back_populates="applications")
|
||||||
|
users = relationship("User", back_populates="applications")
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@ from fastapi.responses import JSONResponse
|
||||||
import jwt
|
import jwt
|
||||||
|
|
||||||
from sqlalchemy.future import select
|
from sqlalchemy.future import select
|
||||||
|
from sqlalchemy.orm import joinedload
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
|
|
||||||
from routers.auth import get_current_user
|
from routers.auth import get_current_user
|
||||||
from model.database import get_async_session, Job
|
from model.database import get_async_session, Job, Client, AppliedJob
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
@ -21,9 +22,21 @@ async def product(request: Request,
|
||||||
size = "Work"
|
size = "Work"
|
||||||
username = username
|
username = username
|
||||||
|
|
||||||
query = select(Job)
|
result = await session.execute(
|
||||||
result = await session.execute(query)
|
select(AppliedJob)
|
||||||
jobs = result.scalars().all()
|
.options(
|
||||||
|
joinedload(AppliedJob.client), # Подгружаем клиента
|
||||||
|
joinedload(AppliedJob.job), # Подгружаем работу
|
||||||
|
joinedload(AppliedJob.users) # Подгружаем пользователя
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
applied_jobs = result.scalars().all()
|
||||||
|
|
||||||
|
|
||||||
|
result1 = await session.select(AppliedJob)
|
||||||
|
|
||||||
|
assignee = result1.scalars().all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +44,6 @@ async def product(request: Request,
|
||||||
|
|
||||||
|
|
||||||
return templates.TemplateResponse("product.html", {"request": request, "size": size,
|
return templates.TemplateResponse("product.html", {"request": request, "size": size,
|
||||||
"jobs": jobs, "role": username["role"],
|
"jobs": applied_jobs, "role": username["role"],
|
||||||
"username": username['username'],
|
"username": username['username'], "assignee": assignee,
|
||||||
"current_path": request.url.path })#
|
"current_path": request.url.path })#
|
|
@ -31,20 +31,21 @@
|
||||||
{% for job in jobs %}
|
{% for job in jobs %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="border-b">
|
<td class="border-b">
|
||||||
<div class="font-medium whitespace-no-wrap">{{ job.job_title [:50] }}</div>
|
<div class="font-medium whitespace-no-wrap">{{ job.job.job_title [:50] }}</div>
|
||||||
<div class="text-gray-600 text-xs whitespace-no-wrap">{{ job.job_id }}</div>
|
<div class="text-gray-600 text-xs whitespace-no-wrap">{{ job.job.job_id }}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center border-b">Company</td>
|
<td class="text-center border-b">Company</td>
|
||||||
<td class="text-center border-b">CLIENT</td>
|
<td class="text-center border-b">{{job.client.username}}</td>
|
||||||
<td class="text-center border-b">Requested on</td>
|
<td class="text-center border-b">Requested on</td>
|
||||||
<td class="text-center border-b">Posted on</td>
|
<td class="text-center border-b">Posted on</td>
|
||||||
<td class="text-center border-b">
|
<td class="text-center border-b">
|
||||||
<select class="select2">
|
<select class="select2">
|
||||||
<option value="1">Leonardo DiCaprio</option>
|
<option value="Scheduled">Scheduled</option>
|
||||||
<option value="2">Johnny Deep</option>
|
<option value="Requested">Requested</option>
|
||||||
<option value="3">Robert Downey, Jr</option>
|
<option value="In-Progress">In-Progress</option>
|
||||||
<option value="4">Samuel L. Jackson</option>
|
<option value="Applied">Applied</option>
|
||||||
<option value="5">Morgan Freeman</option>
|
<option value="Issues Applying">Issues Applying</option>
|
||||||
|
<option value="Cancelled">Cancelled</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue