Skip to content

Commit

Permalink
feat: Add pos attribute in Projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain MATIAS committed Apr 23, 2024
1 parent 12e7090 commit 03887c0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ConfigDb(BaseConfig):
sql_execute(conn,"INSERT INTO base.users (firstname, lastname, authentication_id) VALUES ('Démo', 'Métropole', '" + str(uid) + "');", False)
conn.close()
else:
if not dbchecker(conn,"select exists(select email from base.authentications where email='" + args.email + "')"):
if args and args.email and args.password and not dbchecker(conn,"select exists(select email from base.authentications where email='" + args.email + "')"):
cmd = "INSERT INTO base.authentications (email, password, role, status) VALUES ('%s', '%s', 'SUPERADMIN', 'ACTIVE');" % (args.email, hashStringWithSaltB64(args.password))
sql_execute(conn,cmd, False)
uid = dbchecker(conn,"SELECT id FROM base.authentications WHERE email = '" + args.email + "'")
Expand Down
5 changes: 3 additions & 2 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __str__(self):
+ ">"
)


class Projects(db.Model):
__table_args__ = {"schema": schema}

Expand All @@ -104,6 +103,7 @@ class Projects(db.Model):
date_create = db.Column(db.Date)
name = db.Column(db.String)
bbox = db.Column(db.String)
pos = db.Column(db.String)
nb_plaques_h = db.Column(db.Integer)
nb_plaques_v = db.Column(db.Integer)
ratio = db.Column(db.Integer)
Expand All @@ -130,6 +130,8 @@ def __str__(self):
+ str(self.name)
+ '" bbox="'
+ str(self.bbox)
+ '" pos="'
+ str(self.pos)
+ '" nb_plaques_h="'
+ str(self.nb_plaques_h)
+ '" nb_plaques_v="'
Expand All @@ -147,7 +149,6 @@ def __str__(self):
+ '">'
)


class Datas(db.Model):
__table_args__ = {"schema": schema}

Expand Down
5 changes: 5 additions & 0 deletions app/modules/projects/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ def updateById(id):
bbox:
type: string
description: the BBox of that selected zone
pos:
type: string
description: the Pos of that selected zone in Slideshow
nb_plaques_h:
type: integer
description: the number of horizontal plates
Expand Down Expand Up @@ -246,6 +249,8 @@ def updateById(id):
project.name = form['name']
if 'bbox' in form:
project.bbox = form['bbox']
if 'pos' in form:
project.pos = form['pos']
if 'nb_plaques_h' in form:
project.nb_plaques_h = form['nb_plaques_h']
if 'nb_plaques_v' in form:
Expand Down
1 change: 1 addition & 0 deletions sql/create-tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ CREATE TABLE base.projects (
date_create timestamp without time zone NOT NULL DEFAULT now(),
name character varying(100) NOT NULL,
bbox character varying(1000) NOT NULL,
pos character varying(1000) NULL,
nb_plaques_h INT NOT NULL ,
nb_plaques_v INT NOT NULL ,
ratio INT NOT NULL,
Expand Down

0 comments on commit 03887c0

Please sign in to comment.