Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
Resin
Server
Merge requests
!53
feat: zoom on town
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat: zoom on town
feat/map-zoom-on-town
into
dev
Overview
0
Commits
2
Pipelines
0
Changes
1
Merged
Hugo SUBTIL
requested to merge
feat/map-zoom-on-town
into
dev
4 years ago
Overview
0
Commits
2
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
d7c15b64
2 commits,
4 years ago
1 file
+
18
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/structures/structures.controller.ts
+
18
−
0
Options
@@ -4,6 +4,7 @@ import {
Delete
,
Get
,
HttpException
,
HttpService
,
HttpStatus
,
Param
,
Post
,
@@ -29,11 +30,28 @@ import { StructuresService } from './services/structures.service';
@
Controller
(
'
structures
'
)
export
class
StructuresController
{
constructor
(
private
readonly
httpService
:
HttpService
,
private
readonly
structureService
:
StructuresService
,
private
readonly
userService
:
UsersService
,
private
readonly
tempUserService
:
TempUserService
)
{}
/**
* Return points of given town exist.
* @param zipcode
* @returns Array of points
*/
@
Get
(
'
coordinates/:zipcode
'
)
@
ApiParam
({
name
:
'
zipcode
'
,
type
:
String
,
required
:
true
})
public
async
getCoordinates
(@
Param
(
'
zipcode
'
)
city
:
string
):
Promise
<
any
>
{
return
await
this
.
httpService
.
get
(
encodeURI
(
'
https://download.data.grandlyon.com/geocoding/photon-bal/api?q=
'
+
city
))
.
toPromise
()
.
then
(
async
(
res
)
=>
res
.
data
.
features
)
.
then
((
data
)
=>
data
.
filter
((
cityPoint
)
=>
cityPoint
.
properties
.
city
.
toLowerCase
().
includes
(
city
.
toLowerCase
())))
.
then
((
data
)
=>
data
.
map
((
filteredCityPoint
)
=>
filteredCityPoint
.
geometry
.
coordinates
));
}
@
Post
()
public
async
create
(@
Body
()
createStructureDto
:
CreateStructureDto
):
Promise
<
Structure
>
{
return
this
.
structureService
.
create
(
createStructureDto
.
idUser
,
createStructureDto
.
structure
);
Loading