Skip to content
Snippets Groups Projects
Commit 10bf5295 authored by Samuli Virtapohja's avatar Samuli Virtapohja
Browse files

returns info from mapmarkers

parent 8c2205b2
No related branches found
No related tags found
1 merge request!2Geo json
...@@ -3,11 +3,11 @@ import { Entity, Column, PrimaryGeneratedColumn, BeforeInsert, PrimaryColumn } f ...@@ -3,11 +3,11 @@ import { Entity, Column, PrimaryGeneratedColumn, BeforeInsert, PrimaryColumn } f
import * as jwt from 'jsonwebtoken'; import * as jwt from 'jsonwebtoken';
import { identifier } from '@babel/types'; import { identifier } from '@babel/types';
@Entity('Powerup') @Entity('MapMarker')
export class MapMarkerEntity { export class MapMarkerEntity {
@PrimaryGeneratedColumn('uuid') id: string; @PrimaryGeneratedColumn('uuid') id: string;
@Column({type: 'text'}) name: string; @Column({type: 'text'}) latitude: string;
@Column({type: 'text'}) cooldown: string; @Column({type: 'text'}) longitude: string;
} }
\ No newline at end of file
...@@ -12,15 +12,18 @@ export class MapMarkerService { ...@@ -12,15 +12,18 @@ export class MapMarkerService {
// insert markers // insert markers
async insertLocation(data: MapMarkerDTO){ async insertLocation(data: MapMarkerDTO){
// check for token return if not set // check for token return if not set return null or something
const { latitude, longitude } = data; const { latitude, longitude } = data;
//let location = await this.mapmarkerRepository.create(data); let location = await this.mapmarkerRepository.create(data);
//await this.mapmarkerRepository.save(location); await this.mapmarkerRepository.save(location);
} }
// get all markers // get all markers
async getAllMarkers(): Promise<string>{ async getAllMarkers(): Promise<MapMarkerEntity[]>{
//this.mapmarkerRepository.findByIds();
return 'all markers'; // const users= this.mapmarkerRepository.find();
// users.map
// user.
return this.mapmarkerRepository.find();
} }
} }
\ No newline at end of file
...@@ -7,18 +7,24 @@ import { MapMarkerDTO } from './mapmarker.dto'; ...@@ -7,18 +7,24 @@ import { MapMarkerDTO } from './mapmarker.dto';
export class MapMarkersController { export class MapMarkersController {
constructor(private mapmarkerservice: MapMarkerService){} constructor(private mapmarkerservice: MapMarkerService){}
// update user location
@Post('location') @Post('location')
getLoctaion(@Body() data: MapMarkerDTO){ async getLoctaion(@Body() data: MapMarkerDTO){
// get user location && id
// update location to database
return this.mapmarkerservice.insertLocation(data); return this.mapmarkerservice.insertLocation(data);
} }
// Insert figure location
@Put('insertLocation') @Put('insertLocation')
insertLocation(@Body() data: MapMarkerDTO){ async insertLocation(@Body() data: MapMarkerDTO){
this.mapmarkerservice.insertLocation(data);
} }
@Get('getall') @Get('getall')
getAll(){ async getAll(){
// hakee kaikki
// palauttaa vain halutut
return this.mapmarkerservice.getAllMarkers(); return this.mapmarkerservice.getAllMarkers();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment