Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
archiWEB-TP
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hepia_2022-2023
Web
archiWEB-TP
Commits
ac88b367
Commit
ac88b367
authored
2 years ago
by
alec.schmidt
Browse files
Options
Downloads
Patches
Plain Diff
fixed GET questions
parent
ce0d2afc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
API/db/app.db
+0
-0
0 additions, 0 deletions
API/db/app.db
API/src/database/Database.ts
+14
-4
14 additions, 4 deletions
API/src/database/Database.ts
with
14 additions
and
4 deletions
API/db/app.db
+
0
−
0
View file @
ac88b367
No preview for this file type
This diff is collapsed.
Click to expand it.
API/src/database/Database.ts
+
14
−
4
View file @
ac88b367
...
...
@@ -113,7 +113,7 @@ class DBHandler {
await
asyncdb
.
all
(
insert_question
);
const
id_json
=
await
asyncdb
.
get
(
get_id
)
const
id_json
=
await
asyncdb
.
get
(
get_id
)
;
const
id_obj
=
id_json
as
Question_t
;
const
insert_correct
=
"
INSERT INTO answer (text_answer, id_question, correct)
\
...
...
@@ -132,9 +132,19 @@ class DBHandler {
}
async
getQuestions
(
req
:
express
.
Request
,
res
:
express
.
Response
)
{
asyncdb
.
all
(
"
SELECT * FROM questions
"
)
.
then
(
result
=>
res
.
status
(
StatusCodes
.
OK
).
json
(
result
).
end
())
.
catch
(
e
=>
console
.
log
(
e
))
const
query
=
"
SELECT * FROM questions
"
;
const
query_answers
=
"
SELECT * FROM answer
"
;
let
questions
=
await
asyncdb
.
all
(
query
);
let
ans
=
await
asyncdb
.
all
(
query_answers
);
let
payload
=
{
QUESTIONS
:
questions
,
ANSWERS
:
ans
}
res
.
status
(
StatusCodes
.
OK
).
json
(
payload
)
}
async
updateQuestion
(
req
:
express
.
Request
,
res
:
express
.
Response
){
...
...
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