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
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Commits
48a3726e
Commit
48a3726e
authored
4 years ago
by
Jérémie BRISON
Browse files
Options
Downloads
Patches
Plain Diff
fix(structure) : update coord when address structure change
parent
451e0041
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!38
Recette
,
!37
Dev
,
!31
fix(structure) : update coord when address structure change
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/structures/services/structures.service.ts
+5
-1
5 additions, 1 deletion
src/structures/services/structures.service.ts
with
5 additions
and
1 deletion
src/structures/services/structures.service.ts
+
5
−
1
View file @
48a3726e
...
@@ -11,7 +11,7 @@ import { User } from '../../users/schemas/user.schema';
...
@@ -11,7 +11,7 @@ import { User } from '../../users/schemas/user.schema';
import
{
MailerService
}
from
'
../../mailer/mailer.service
'
;
import
{
MailerService
}
from
'
../../mailer/mailer.service
'
;
import
{
Cron
,
CronExpression
}
from
'
@nestjs/schedule
'
;
import
{
Cron
,
CronExpression
}
from
'
@nestjs/schedule
'
;
import
{
DateTime
}
from
'
luxon
'
;
import
{
DateTime
}
from
'
luxon
'
;
import
*
as
_
from
'
lodash
'
;
@
Injectable
()
@
Injectable
()
export
class
StructuresService
{
export
class
StructuresService
{
constructor
(
constructor
(
...
@@ -104,6 +104,10 @@ export class StructuresService {
...
@@ -104,6 +104,10 @@ export class StructuresService {
}
}
public
async
update
(
idStructure
:
string
,
structure
:
structureDto
):
Promise
<
Structure
>
{
public
async
update
(
idStructure
:
string
,
structure
:
structureDto
):
Promise
<
Structure
>
{
const
oldStructure
=
await
this
.
findOne
(
idStructure
);
if
(
!
_
.
isEqual
(
oldStructure
.
address
,
structure
.
address
))
{
await
this
.
getStructurePosition
(
structure
).
then
();
}
const
result
=
await
this
.
structureModel
.
findByIdAndUpdate
(
Types
.
ObjectId
(
idStructure
),
structure
).
exec
();
const
result
=
await
this
.
structureModel
.
findByIdAndUpdate
(
Types
.
ObjectId
(
idStructure
),
structure
).
exec
();
if
(
!
result
)
{
if
(
!
result
)
{
throw
new
HttpException
(
'
Invalid structure id
'
,
HttpStatus
.
BAD_REQUEST
);
throw
new
HttpException
(
'
Invalid structure id
'
,
HttpStatus
.
BAD_REQUEST
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment