Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
WIMMA Lab 2019
Overflow
ehasa-backend
Commits
c81bae60
Commit
c81bae60
authored
5 years ago
by
Samuli Virtapohja
Browse files
Options
Downloads
Plain Diff
Merge branch 'Score' into HEAD
parents
983c618c
06ae9f3b
No related branches found
No related tags found
3 merge requests
!59
Development to master
,
!44
Development to testing
,
!37
Can list games according to one or more statuses
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/game/game.controller.ts
+7
-2
7 additions, 2 deletions
src/game/game.controller.ts
src/game/game.dto.ts
+1
-1
1 addition, 1 deletion
src/game/game.dto.ts
src/game/game.service.ts
+25
-5
25 additions, 5 deletions
src/game/game.service.ts
with
33 additions
and
8 deletions
src/game/game.controller.ts
+
7
−
2
View file @
c81bae60
...
@@ -55,8 +55,13 @@ export class GameController {
...
@@ -55,8 +55,13 @@ export class GameController {
}
}
@
Get
(
'
listgames
'
)
@
Get
(
'
listgames
'
)
async
listGames
()
{
async
listGames
(
state
)
{
return
this
.
gameservice
.
listGames
();
return
this
.
gameservice
.
listGames
(
state
);
}
@
Get
(
'
listgames/:state
'
)
async
listGamesState
(@
Param
(
'
state
'
)
state
:
string
)
{
return
this
.
gameservice
.
listGames
(
state
);
}
}
// ClassSerializerInterceptor removes excluded columns set in Entities
// ClassSerializerInterceptor removes excluded columns set in Entities
...
...
This diff is collapsed.
Click to expand it.
src/game/game.dto.ts
+
1
−
1
View file @
c81bae60
...
@@ -76,7 +76,7 @@ export class newGameDTO {
...
@@ -76,7 +76,7 @@ export class newGameDTO {
export
class
GameStateDTO
{
export
class
GameStateDTO
{
@
IsUUID
(
'
4
'
)
@
IsUUID
(
'
4
'
)
id
:
string
;
id
:
string
;
@
IsIn
([
'
CREATED
'
,
'
STARTED
'
,
'
PAUSED
'
,
'
ENDED
'
])
@
IsIn
([
'
CREATED
'
,
'
STARTED
'
,
'
PAUSED
'
,
'
ENDED
'
,
'
ONGOING
'
])
state
:
string
;
state
:
string
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/game/game.service.ts
+
25
−
5
View file @
c81bae60
...
@@ -170,11 +170,31 @@ export class GameService {
...
@@ -170,11 +170,31 @@ export class GameService {
}
}
// returns name and id of each game
// returns name and id of each game
async
listGames
()
{
async
listGames
(
state
)
{
const
games
=
await
this
.
gameRepository
.
find
();
if
(
state
==
null
){
return
games
.
map
(
game
=>
{
const
games
=
await
this
.
gameRepository
.
find
();
return
game
.
gameObject
();
return
games
.
map
(
game
=>
{
});
return
game
.
gameObject
();
});
}
else
if
(
state
==
'
ONGOING
'
){
const
games
=
await
this
.
gameRepository
.
find
({
where
:
[
{
state
:
'
CREATED
'
},
{
state
:
'
STARTED
'
},
{
state
:
'
PAUSED
'
},
]
});
return
games
.
map
(
game
=>
{
return
game
.
gameObject
();
});
}
else
{
const
games
=
await
this
.
gameRepository
.
find
({
where
:
{
state
:
state
}
});
return
games
.
map
(
game
=>
{
return
game
.
gameObject
();
});
}
}
}
// returns information about a game identified by id
// returns information about a game identified by id
...
...
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