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 5c39c30 commit b2d709a
Show file tree
Hide file tree
Showing 2 changed files with 9 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
1 change: 1 addition & 0 deletions backend/gn_module_monitoring/monitoring/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class Meta:
model = TMonitoringObservations
include_fk = True
load_relationships = True
medias = MA.Nested(MediaSchema, many=True)


class MonitoringObservationsDetailsSchema(MA.SQLAlchemyAutoSchema):
Expand Down

0 comments on commit b2d709a

Please sign in to comment.