-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
It is not safe to do this type of thing for "geo enabled" fields, because "enabled" means that latitude longitude might not be provided:
hooks: {
afterValidate: function (rep_surface, options) {
rep_surface.the_geom = sequelize.fn('ST_SetSRID', sequelize.fn('ST_MakePoint', rep_surface.longitude, rep_surface.latitude), '4326'); },
}Need to either include an if statement for all "geo enabled" tables, or include only for tables where "geo enabled" but not "geo required":
hooks: {
afterValidate: function (rep_surface, options) {
if (rep_surface.longitude && rep_surface.latitude) {
rep_surface.the_geom = sequelize.fn('ST_SetSRID', sequelize.fn('ST_MakePoint', rep_surface.longitude, rep_surface.latitude), '4326');
}
},
}Reactions are currently unavailable