From be97636ed9e2c305c76d212439dce5f6e4182bf8 Mon Sep 17 00:00:00 2001 From: Samuli Virtapohja <l4721@student.jamk.fi> Date: Fri, 7 Jun 2019 10:47:27 +0300 Subject: [PATCH] GeoJSON data to database --- src/mapmarkers/mapmarker.dto.ts | 5 +++-- src/mapmarkers/mapmarker.entity.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mapmarkers/mapmarker.dto.ts b/src/mapmarkers/mapmarker.dto.ts index eab9dc6..d4a7f8c 100644 --- a/src/mapmarkers/mapmarker.dto.ts +++ b/src/mapmarkers/mapmarker.dto.ts @@ -1,5 +1,4 @@ -import { IsString, IsDateString } from 'class-validator'; -import { Timestamp } from 'typeorm'; +import { IsString, IsJSON } from 'class-validator'; export class MapMarkerDTO { @IsString() @@ -10,4 +9,6 @@ export class MapMarkerDTO { longitude: string; @IsString() timestamp: string; + @IsJSON() + features: JSON; } \ No newline at end of file diff --git a/src/mapmarkers/mapmarker.entity.ts b/src/mapmarkers/mapmarker.entity.ts index 39ff2b2..ffee47e 100644 --- a/src/mapmarkers/mapmarker.entity.ts +++ b/src/mapmarkers/mapmarker.entity.ts @@ -8,6 +8,7 @@ export class MapMarkerEntity { @Column({type: 'text'}) latitude: string; @Column({type: 'text'}) longitude: string; @Column({type: 'timestamp'}) timestamp: Timestamp; + @Column({type: 'json', nullable: true}) features: JSON; @ManyToOne(type => PersonEntity, player => player.markers) player: PersonEntity; } \ No newline at end of file -- GitLab