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
import * as jwt from 'jsonwebtoken';
import { identifier } from '@babel/types';
@Entity('Powerup')
@Entity('MapMarker')
export class MapMarkerEntity {
@PrimaryGeneratedColumn('uuid') id: string;
@Column({type: 'text'}) name: string;
@Column({type: 'text'}) cooldown: string;
@Column({type: 'text'}) latitude: string;
@Column({type: 'text'}) longitude: string;
}
\ No newline at end of file
......@@ -12,15 +12,18 @@ export class MapMarkerService {
// insert markers
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;
//let location = await this.mapmarkerRepository.create(data);
//await this.mapmarkerRepository.save(location);
}
let location = await this.mapmarkerRepository.create(data);
await this.mapmarkerRepository.save(location);
}
// get all markers
async getAllMarkers(): Promise<string>{
//this.mapmarkerRepository.findByIds();
return 'all markers';
async getAllMarkers(): Promise<MapMarkerEntity[]>{
// 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';
export class MapMarkersController {
constructor(private mapmarkerservice: MapMarkerService){}
// update user 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);
}
// Insert figure location
@Put('insertLocation')
insertLocation(@Body() data: MapMarkerDTO){
async insertLocation(@Body() data: MapMarkerDTO){
this.mapmarkerservice.insertLocation(data);
}
@Get('getall')
getAll(){
async getAll(){
// hakee kaikki
// palauttaa vain halutut
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