Skip to content

Commit

Permalink
SQL warning + ObservationSchema Media
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Jul 29, 2024
1 parent 154c4da commit 56c7f09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/gn_module_monitoring/monitoring/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class TMonitoringObservations(TObservations, PermissionModel, ObservationsQuery)
TMedias,
primaryjoin=(TMedias.uuid_attached_row == TObservations.uuid_observation),
foreign_keys=[TMedias.uuid_attached_row],
overlaps="medias",
)

observation_details = DB.relation(
Expand Down Expand Up @@ -152,7 +153,7 @@ def has_instance_permission(self, scope):
return True


TBaseVisits.dataset = DB.relationship(TDatasets)
# TBaseVisits.dataset = DB.relationship(TDatasets)


@serializable
Expand Down Expand Up @@ -355,7 +356,12 @@ class TMonitoringSitesGroups(DB.Model, PermissionModel, SitesGroupsQuery):
foreign_keys=[TMonitoringSites.id_sites_group],
lazy="select",
)
modules = DB.relationship("TMonitoringModules", secondary=cor_sites_group_module, uselist=True)
modules = DB.relationship(
"TMonitoringModules",
secondary=cor_sites_group_module,
uselist=True,
back_populates="sites_groups",
)

nb_sites = column_property(
select(func.count(TMonitoringSites.id_sites_group))
Expand Down
2 changes: 2 additions & 0 deletions backend/gn_module_monitoring/monitoring/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class Meta:
include_fk = True
load_relationships = True

medias = MA.Nested(MediaSchema, many=True)


class MonitoringObservationsDetailsSchema(MA.SQLAlchemyAutoSchema):
class Meta:
Expand Down

0 comments on commit 56c7f09

Please sign in to comment.