Skip to content

Commit

Permalink
add language attribute to projet
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Aug 31, 2023
1 parent 33dc86c commit 5e76ce5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/db_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def migrate_add_validated_tree(engine):
with engine.connect() as connection:
connection.execute('ALTER TABLE projects RENAME COLUMN exercise_mode To blind_annotation_mode')
connection.execute('ALTER TABLE projects ADD config STRING')
connection.execute('ALTER TABLE projects ADD language STRING')
connection.execute('ALTER TABLE projects DROP show_all_trees')
connection.execute('ALTER TABLE exerciselevel RENAME COLUMN exercise_level TO blind_annotation_level')
connection.execute('ALTER TABLE exerciselevel RENAME TO blindannotationlevel')
Expand Down
2 changes: 2 additions & 0 deletions app/projects/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def post(self) -> Project:
parser.add_argument(name="blindAnnotationMode", type=bool)
parser.add_argument(name="visibility", type=int)
parser.add_argument(name="config", type=str)
parser.add_argument(name="language", type=str)
args = parser.parse_args()

# Sanitize the project name to correspond to Grew folders requirements
Expand All @@ -117,6 +118,7 @@ def post(self) -> Project:
"visibility": args.visibility,
"freezed": False,
"config": args.config,
"language": args.language
}

# KK : TODO : put all grew request in a seperated file and add error catching
Expand Down
1 change: 1 addition & 0 deletions app/projects/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ProjectInterface(TypedDict, total=False):
blind_annotation_mode: bool
freezed: bool
config: str
language: str


class ProjectExtendedInterface(ProjectInterface, total=False):
Expand Down
1 change: 1 addition & 0 deletions app/projects/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Project(db.Model, BaseM):
diff_user_id = Column(String(256), nullable=True)
freezed = Column(Boolean, default=False)
config = Column(String(256), nullable=True)
language = Column(String(256), nullable=True)

feature = db.relationship("ProjectFeature", cascade="all,delete", backref="projects")
meta_feature = db.relationship("ProjectMetaFeature", cascade="all,delete", backref="projects")
Expand Down
4 changes: 3 additions & 1 deletion app/projects/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ProjectSchema(Schema):
visibility = fields.Integer(attribute="visibility")
blindAnnotationMode = fields.Boolean(attribute="blind_annotation_mode")
freezed = fields.Boolean(attribute="freezed")
config = fields.Boolean(attribute="config")
config = fields.String(attribute="config")
language = fields.String(attribute="language")


class ProjectExtendedSchema(ProjectSchema):
Expand Down Expand Up @@ -61,6 +62,7 @@ class ProjectSchemaCamel(Schema):
blindAnnotationMode = fields.Boolean(attribute="blind_annotation_mode")
freezed = fields.Boolean(attribute="freezed")
config = fields.String(attribute="config")
language = fields.String(attribute="language")
diffMode = fields.Boolean(attribute="diff_mode")
diffUserId = fields.String(attribute="diff_user_id")

Expand Down

0 comments on commit 5e76ce5

Please sign in to comment.