Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
fix(coordinates): add SRID when saving coordinates in DB (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
carolineBda authored Mar 17, 2022
1 parent fd26ec7 commit 253162b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/db/seeds/psychologist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const getOnePsychologist = (
parseFloat(faker.address.longitude(4, -4)),
parseFloat(faker.address.latitude(50, 40)),
],
// @ts-ignore
crs: { properties: { name: "EPSG:4326" }, type: "name" },
type: "POINT",
},
Expand Down
2 changes: 2 additions & 0 deletions src/services/demarchesSimplifiees/parse-psychologists.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Joi from "joi";
import pLimit from "p-limit";

import { SRID } from "../../types/const/geometry";
import { DSPsychologist, Psychologist } from "../../types/psychologist";
import config from "../config";
import getAddressCoordinates from "../getAddressCoordinates";
Expand Down Expand Up @@ -57,6 +58,7 @@ export const parseDossierMetadata = async (
if (coordinates) {
psychologist.coordinates = {
coordinates: [coordinates.longitude, coordinates.latitude],
crs: { properties: { name: "EPSG:" + SRID }, type: "name" },
type: "POINT",
};
}
Expand Down
6 changes: 5 additions & 1 deletion src/types/psychologist.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export interface Psychologist {
languages: string;
cdsmsp: string;
website: string;
coordinates: { type: string; coordinates: [number, number] };
coordinates: {
type: string;
coordinates: [number, number];
crs: { type: string; properties: { name: string } };
};
instructorId: string;
department: string;
state: string;
Expand Down

0 comments on commit 253162b

Please sign in to comment.