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

fix(coordinates): add SRID when saving coordinates in DB #100

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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