Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoBackendAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
Backend
DojoBackendAPI
Commits
33242331
Commit
33242331
authored
2 years ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Enonce => Modify the json values management
parent
70065774
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ExpressAPI/src/managers/EnonceManager.ts
+6
-1
6 additions, 1 deletion
ExpressAPI/src/managers/EnonceManager.ts
ExpressAPI/src/models/Enonce.ts
+42
-8
42 additions, 8 deletions
ExpressAPI/src/models/Enonce.ts
ExpressAPI/src/routes/EnonceRoutes.ts
+9
-8
9 additions, 8 deletions
ExpressAPI/src/routes/EnonceRoutes.ts
with
57 additions
and
17 deletions
ExpressAPI/src/managers/EnonceManager.ts
+
6
−
1
View file @
33242331
...
...
@@ -16,7 +16,12 @@ class EnonceManager {
}
createObjectFromRawSql
(
raw
:
any
):
Enonce
{
return
Enonce
.
createFromSql
(
raw
);
const
enonce
=
Enonce
.
createFromSql
(
raw
);
enonce
.
enonceGitlabCreationInfo
=
raw
.
enonceGitlabCreationInfo
;
enonce
.
enonceGitlabLastInfo
=
raw
.
enonceGitlabLastInfo
;
return
enonce
;
}
async
getByName
(
name
:
string
):
Promise
<
Enonce
|
undefined
>
{
...
...
This diff is collapsed.
Click to expand it.
ExpressAPI/src/models/Enonce.ts
+
42
−
8
View file @
33242331
import
Model
from
'
./Model
'
;
import
db
from
'
../helpers/DatabaseHelper
'
;
import
GitlabRepository
from
'
../shared/types/Gitlab/GitlabRepository
'
;
import
LazyVal
from
'
../shared/helpers/LazyVal
'
;
import
UserManager
from
'
../managers/UserManager
'
;
import
User
from
'
./User
'
;
class
Enonce
extends
Model
{
...
...
@@ -8,17 +12,47 @@ class Enonce extends Model {
enonceName
:
string
=
''
;
enonceGitlabId
:
number
=
null
;
enonceGitlabLink
:
string
=
''
;
enonceGitlabCreationInfo
:
string
=
''
;
enonceGitlabLastInfo
:
string
=
''
;
private
_
enonceGitlabCreationInfo
:
string
=
'
{}
'
;
private
_
enonceGitlabLastInfo
:
string
=
'
{}
'
;
enonceGitlabLastInfoTs
:
number
=
null
;
get
enonceGitlabCreationInfo
():
GitlabRepository
{
return
JSON
.
parse
(
this
.
_enonceGitlabCreationInfo
);
}
set
enonceGitlabCreationInfo
(
value
:
any
)
{
if
(
typeof
value
===
'
string
'
)
{
this
.
_enonceGitlabCreationInfo
=
value
;
return
;
}
this
.
_enonceGitlabCreationInfo
=
JSON
.
stringify
(
value
);
}
get
enonceGitlabLastInfo
():
GitlabRepository
{
return
JSON
.
parse
(
this
.
_enonceGitlabLastInfo
);
}
set
enonceGitlabLastInfo
(
value
:
any
)
{
if
(
typeof
value
===
'
string
'
)
{
this
.
_enonceGitlabLastInfo
=
value
;
return
;
}
this
.
_enonceGitlabLastInfo
=
JSON
.
stringify
(
value
);
}
staff
=
new
LazyVal
<
Array
<
User
>>
(()
=>
{
return
UserManager
.
getStaffOfEnonce
(
this
.
enonceName
);
});
public
async
toJsonObject
():
Promise
<
Object
>
{
const
result
=
{
'
name
'
:
this
.
enonceName
,
'
gitlabId
'
:
this
.
enonceGitlabId
,
'
gitlabLink
'
:
this
.
enonceGitlabLink
,
'
gitlabCreationInfo
'
:
JSON
.
parse
(
this
.
enonceGitlabCreationInfo
)
,
'
gitlabLastInfo
'
:
JSON
.
parse
(
this
.
enonceGitlabLastInfo
)
,
'
gitlabCreationInfo
'
:
this
.
enonceGitlabCreationInfo
,
'
gitlabLastInfo
'
:
this
.
enonceGitlabLastInfo
,
'
gitlabLastInfoTs
'
:
this
.
enonceGitlabLastInfoTs
};
...
...
@@ -39,8 +73,8 @@ class Enonce extends Model {
enonceName
:
this
.
enonceName
,
enonceGitlabId
:
this
.
enonceGitlabId
,
enonceGitlabLink
:
this
.
enonceGitlabLink
,
enonceGitlabCreationInfo
:
this
.
enonceGitlabCreationInfo
,
enonceGitlabLastInfo
:
this
.
enonceGitlabLastInfo
,
enonceGitlabCreationInfo
:
this
.
_
enonceGitlabCreationInfo
,
enonceGitlabLastInfo
:
this
.
_
enonceGitlabLastInfo
,
enonceGitlabLastInfoTs
:
this
.
enonceGitlabLastInfoTs
};
}
...
...
This diff is collapsed.
Click to expand it.
ExpressAPI/src/routes/EnonceRoutes.ts
+
9
−
8
View file @
33242331
...
...
@@ -20,6 +20,7 @@ import EnonceStaff from '../models/EnonceStaff';
import
{
AxiosError
}
from
'
axios
'
;
import
logger
from
'
../shared/logging/WinstonLogger
'
;
import
DojoValidators
from
'
../helpers/DojoValidators
'
;
import
EnonceManager
from
'
../managers/EnonceManager
'
;
class
EnonceRoutes
implements
RoutesManager
{
...
...
@@ -90,7 +91,7 @@ class EnonceRoutes implements RoutesManager {
}
}));
const
enonce
:
Enonce
=
await
Enonce
.
createFromSql
({
const
enonce
:
Enonce
=
await
Enonce
Manager
.
create
Object
From
Raw
Sql
({
enonceName
:
repository
.
name
,
enonceGitlabId
:
repository
.
id
,
enonceGitlabLink
:
repository
.
web_url
,
...
...
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