Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
d0ab5ea3
Commit
d0ab5ea3
authored
5 years ago
by
ivarnm
Browse files
Options
Downloads
Patches
Plain Diff
#88
Add game explanation
parent
be5e49cf
No related branches found
No related tags found
1 merge request
!87
Resolve "Game Explanation"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/api/games.js
+17
-9
17 additions, 9 deletions
backend/api/games.js
frontend/core/src/com/gameware/game/models/Game.java
+8
-2
8 additions, 2 deletions
frontend/core/src/com/gameware/game/models/Game.java
with
25 additions
and
11 deletions
backend/api/games.js
+
17
−
9
View file @
d0ab5ea3
...
@@ -66,7 +66,6 @@ router.get("/gamename/:gameId", (req, res) => {
...
@@ -66,7 +66,6 @@ router.get("/gamename/:gameId", (req, res) => {
.
find
({
.
find
({
_id
:
id
_id
:
id
})
})
.
project
({
name
:
1
})
.
toArray
((
err
,
result
)
=>
{
.
toArray
((
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
res
.
sendStatus
(
500
);
res
.
sendStatus
(
500
);
...
@@ -94,7 +93,8 @@ router.post("/", (req, res) => {
...
@@ -94,7 +93,8 @@ router.post("/", (req, res) => {
const
db
=
client
.
db
(
"
gameWare
"
);
const
db
=
client
.
db
(
"
gameWare
"
);
const
collection
=
"
games
"
;
const
collection
=
"
games
"
;
name
=
req
.
body
.
name
;
const
name
=
req
.
body
.
name
;
const
explanation
=
req
.
body
.
explanation
;
if
(
!
name
)
{
if
(
!
name
)
{
// Name not provided in body
// Name not provided in body
...
@@ -102,14 +102,22 @@ router.post("/", (req, res) => {
...
@@ -102,14 +102,22 @@ router.post("/", (req, res) => {
return
;
return
;
}
}
db
.
collection
(
collection
).
insertOne
({
name
},
(
err
,
result
)
=>
{
if
(
!
explanation
)
{
res
.
status
(
400
).
send
(
"
Explanation not provided
"
);
return
;
}
db
.
collection
(
collection
).
insertOne
(
{
name
,
explanation
},
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
res
.
sendStatus
(
500
);
// Internal server error
res
.
sendStatus
(
500
);
// Internal server error
return
;
return
;
}
}
res
.
json
(
result
.
ops
[
0
]);
res
.
json
(
result
.
ops
[
0
]);
client
.
close
();
client
.
close
();
});
}
);
}
}
);
);
});
});
...
...
This diff is collapsed.
Click to expand it.
frontend/core/src/com/gameware/game/models/Game.java
+
8
−
2
View file @
d0ab5ea3
...
@@ -5,10 +5,12 @@ import com.badlogic.gdx.utils.Json;
...
@@ -5,10 +5,12 @@ import com.badlogic.gdx.utils.Json;
public
class
Game
implements
ModelInterface
{
public
class
Game
implements
ModelInterface
{
private
String
_id
;
private
String
_id
;
private
String
name
;
private
String
name
;
private
String
explanation
;
public
Game
(
String
_id
,
String
name
)
{
public
Game
(
String
_id
,
String
name
,
String
explanation
)
{
this
.
_id
=
_id
;
this
.
_id
=
_id
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
explanation
=
explanation
;
}
}
public
Game
()
{
public
Game
()
{
...
@@ -22,9 +24,13 @@ public class Game implements ModelInterface {
...
@@ -22,9 +24,13 @@ public class Game implements ModelInterface {
return
name
;
return
name
;
}
}
public
String
getExplanation
()
{
return
explanation
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
this
.
name
;
return
report
()
;
}
}
public
void
reset
()
{
public
void
reset
()
{
...
...
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