ajout error + offre obsolète
This commit is contained in:
parent
63f40fc940
commit
3d4b903acf
@ -88,6 +88,15 @@ class EntrepriseOffre(db.Model):
|
|||||||
missions = db.Column(db.Text)
|
missions = db.Column(db.Text)
|
||||||
duree = db.Column(db.Text)
|
duree = db.Column(db.Text)
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
"intitule": self.intitule,
|
||||||
|
"description": self.description,
|
||||||
|
"type_offre": self.type_offre,
|
||||||
|
"missions": self.missions,
|
||||||
|
"duree": self.duree,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class EntrepriseLog(db.Model):
|
class EntrepriseLog(db.Model):
|
||||||
__tablename__ = "entreprise_log"
|
__tablename__ = "entreprise_log"
|
||||||
@ -117,3 +126,12 @@ class EntrepriseEnvoiOffre(db.Model):
|
|||||||
receiver_id = db.Column(db.Integer, db.ForeignKey("user.id"))
|
receiver_id = db.Column(db.Integer, db.ForeignKey("user.id"))
|
||||||
offre_id = db.Column(db.Integer, db.ForeignKey("entreprise_offre.id"))
|
offre_id = db.Column(db.Integer, db.ForeignKey("entreprise_offre.id"))
|
||||||
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||||
|
|
||||||
|
|
||||||
|
class EntrepriseEnvoiOffreEtudiant(db.Model):
|
||||||
|
__tablename__ = "entreprise_envoi_offre_etudiant"
|
||||||
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
sender_id = db.Column(db.Integer, db.ForeignKey("user.id"))
|
||||||
|
receiver_id = db.Column(db.Integer, db.ForeignKey("identite.id"))
|
||||||
|
offre_id = db.Column(db.Integer, db.ForeignKey("entreprise_offre.id"))
|
||||||
|
date_envoi = db.Column(db.DateTime(timezone=True), server_default=db.func.now())
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
from config import Config
|
from config import Config
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@ -123,6 +123,10 @@ def fiche_entreprise(id):
|
|||||||
offres = entreprise.offres
|
offres = entreprise.offres
|
||||||
offres_with_files = []
|
offres_with_files = []
|
||||||
for offre in offres:
|
for offre in offres:
|
||||||
|
if datetime.now() - offre.date_ajout.replace(tzinfo=None) >= timedelta(
|
||||||
|
days=90
|
||||||
|
): # pour une date d'expiration ?
|
||||||
|
break
|
||||||
files = []
|
files = []
|
||||||
path = os.path.join(
|
path = os.path.join(
|
||||||
Config.SCODOC_VAR_DIR,
|
Config.SCODOC_VAR_DIR,
|
||||||
@ -626,6 +630,8 @@ def json_etudiants():
|
|||||||
Retourne:
|
Retourne:
|
||||||
le JSON de tous les étudiants (nom, prenom, formation actuelle?) correspondant au terme
|
le JSON de tous les étudiants (nom, prenom, formation actuelle?) correspondant au terme
|
||||||
"""
|
"""
|
||||||
|
if request.args.get("term") == None:
|
||||||
|
abort(400)
|
||||||
term = request.args.get("term").strip()
|
term = request.args.get("term").strip()
|
||||||
etudiants = Identite.query.filter(Identite.nom.ilike(f"%{term}%")).all()
|
etudiants = Identite.query.filter(Identite.nom.ilike(f"%{term}%")).all()
|
||||||
list = []
|
list = []
|
||||||
@ -657,6 +663,8 @@ def json_responsables():
|
|||||||
Retourne:
|
Retourne:
|
||||||
le JSON de tous les utilisateurs (nom, prenom, login) correspondant au terme
|
le JSON de tous les utilisateurs (nom, prenom, login) correspondant au terme
|
||||||
"""
|
"""
|
||||||
|
if request.args.get("term") == None:
|
||||||
|
abort(400)
|
||||||
term = request.args.get("term").strip()
|
term = request.args.get("term").strip()
|
||||||
responsables = User.query.filter(
|
responsables = User.query.filter(
|
||||||
User.nom.ilike(f"%{term}%"), User.nom.is_not(None), User.prenom.is_not(None)
|
User.nom.ilike(f"%{term}%"), User.nom.is_not(None), User.prenom.is_not(None)
|
||||||
|
@ -97,6 +97,33 @@ def upgrade():
|
|||||||
sa.PrimaryKeyConstraint("id"),
|
sa.PrimaryKeyConstraint("id"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
op.create_table(
|
||||||
|
"entreprise_envoi_offre_etudiant",
|
||||||
|
sa.Column("id", sa.Integer(), nullable=False),
|
||||||
|
sa.Column("sender_id", sa.Integer(), nullable=True),
|
||||||
|
sa.Column("receiver_id", sa.Integer(), nullable=True),
|
||||||
|
sa.Column("offre_id", sa.Integer(), nullable=True),
|
||||||
|
sa.Column(
|
||||||
|
"date_envoi",
|
||||||
|
sa.DateTime(timezone=True),
|
||||||
|
server_default=sa.text("now()"),
|
||||||
|
nullable=True,
|
||||||
|
),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["offre_id"],
|
||||||
|
["entreprise_offre.id"],
|
||||||
|
),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["sender_id"],
|
||||||
|
["user.id"],
|
||||||
|
),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["receiver_id"],
|
||||||
|
["identite.id"],
|
||||||
|
),
|
||||||
|
sa.PrimaryKeyConstraint("id"),
|
||||||
|
)
|
||||||
|
|
||||||
op.drop_constraint(
|
op.drop_constraint(
|
||||||
"entreprise_contact_entreprise_corresp_id_fkey",
|
"entreprise_contact_entreprise_corresp_id_fkey",
|
||||||
"entreprise_contact",
|
"entreprise_contact",
|
||||||
@ -249,6 +276,7 @@ def downgrade():
|
|||||||
op.drop_column("entreprise_contact", "nom")
|
op.drop_column("entreprise_contact", "nom")
|
||||||
|
|
||||||
op.drop_table("entreprise_envoi_offre")
|
op.drop_table("entreprise_envoi_offre")
|
||||||
|
op.drop_table("entreprise_envoi_offre_etudiant")
|
||||||
op.drop_table("entreprise_offre")
|
op.drop_table("entreprise_offre")
|
||||||
op.drop_table("entreprise_etudiant")
|
op.drop_table("entreprise_etudiant")
|
||||||
op.drop_table("entreprise_log")
|
op.drop_table("entreprise_log")
|
||||||
|
Loading…
Reference in New Issue
Block a user