Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
form-creator-api
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
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
simmctic
form-creator
form-creator-api
Commits
c4b19b21
Commit
c4b19b21
authored
5 years ago
by
Gianfranco Harres
Browse files
Options
Downloads
Plain Diff
Merge branch 'issue/60-Assign-route' into 'develop'
Issue
#60
: Add route to assign users to forms See merge request
!58
parents
7d002c61
61727fb2
Branches
Branches containing commit
No related tags found
2 merge requests
!65
Stable version 1.2
,
!58
Issue #60: Add route to assign users to forms
Pipeline
#22703
passed
5 years ago
Stage: test
Stage: build
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+7
-0
7 additions, 0 deletions
CHANGELOG.md
package.json
+1
-1
1 addition, 1 deletion
package.json
src/api/controllers/form.spec.ts
+35
-32
35 additions, 32 deletions
src/api/controllers/form.spec.ts
src/api/controllers/form.ts
+22
-5
22 additions, 5 deletions
src/api/controllers/form.ts
with
65 additions
and
38 deletions
CHANGELOG.md
+
7
−
0
View file @
c4b19b21
...
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
...
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on
[
Keep a Changelog
](
https://keepachangelog.com/en/1.0.0/
)
,
The format is based on
[
Keep a Changelog
](
https://keepachangelog.com/en/1.0.0/
)
,
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
and this project adheres to
[
Semantic Versioning
](
https://semver.org/spec/v2.0.0.html
)
.
## 1.1.8 - 30-01-2020
### Added
-
Route to assign users to forms #60 (Richard Heise)
## Changed
-
Route to write a form now has an extra stage in the waterfall
-
THis stage assigns the user to a form by ID
## 1.1.7 - 29-01-2020
## 1.1.7 - 29-01-2020
### Added
### Added
-
Function to assign users to forms #54 (Gianfranco)
-
Function to assign users to forms #54 (Gianfranco)
...
...
This diff is collapsed.
Click to expand it.
package.json
+
1
−
1
View file @
c4b19b21
{
{
"name"
:
"form-creator-api"
,
"name"
:
"form-creator-api"
,
"version"
:
"1.1.
7
"
,
"version"
:
"1.1.
8
"
,
"description"
:
"RESTful API used to manage and answer forms."
,
"description"
:
"RESTful API used to manage and answer forms."
,
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
This diff is collapsed.
Click to expand it.
src/api/controllers/form.spec.ts
+
35
−
32
View file @
c4b19b21
...
@@ -55,6 +55,7 @@ before(function (done): void {
...
@@ -55,6 +55,7 @@ before(function (done): void {
export
let
testToken
:
string
;
export
let
testToken
:
string
;
describe
(
"
Initial test User
"
,
()
=>
{
it
(
"
Should respond 200 when signing up a valid user
"
,
(
done
)
=>
{
it
(
"
Should respond 200 when signing up a valid user
"
,
(
done
)
=>
{
request
(
server
)
request
(
server
)
.
post
(
"
/user/signUp
"
)
.
post
(
"
/user/signUp
"
)
...
@@ -88,6 +89,8 @@ it("Should respond 200 when validating an user signIn", (done) => {
...
@@ -88,6 +89,8 @@ it("Should respond 200 when validating an user signIn", (done) => {
})
})
.
end
(
done
);
.
end
(
done
);
});
});
})
describe
(
"
API data controller - form
"
,
()
=>
{
describe
(
"
API data controller - form
"
,
()
=>
{
it
(
"
should respond 200 when getting a list of forms
"
,
(
done
)
=>
{
it
(
"
should respond 200 when getting a list of forms
"
,
(
done
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/api/controllers/form.ts
+
22
−
5
View file @
c4b19b21
...
@@ -96,12 +96,30 @@ export class FormCtrl {
...
@@ -96,12 +96,30 @@ export class FormCtrl {
callback
(
null
,
formUpdate
);
callback
(
null
,
formUpdate
);
});
});
},
},
(
formUpdate
:
FormUpdate
,
callback
:
(
err
:
Error
,
formId
:
number
)
=>
void
)
=>
{
(
formUpdate
:
FormUpdate
,
callback
:
(
err
:
Error
,
formId
?
:
number
)
=>
void
)
=>
{
req
.
db
.
form
.
update
(
formUpdate
,
(
err
:
Error
)
=>
{
req
.
db
.
form
.
update
(
formUpdate
,
(
err
:
Error
)
=>
{
callback
(
err
,
formUpdate
.
form
.
id
);
if
(
err
)
{
callback
(
err
);
return
;
}
callback
(
null
,
formUpdate
.
form
.
id
);
});
});
},
(
formId
:
number
,
callback
:
(
err
:
Error
)
=>
void
)
=>
{
/** req.userData has to be parsed into an object so we can get its ID */
req
.
db
.
user
.
assign
(
Object
(
req
.
userData
).
id
,
formId
,
(
err
:
Error
)
=>
{
if
(
err
)
{
callback
(
err
);
return
;
}
}
],
(
err
,
resultId
)
=>
{
callback
(
null
);
});
}
],
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
res
.
status
(
500
).
json
({
res
.
status
(
500
).
json
({
message
:
"
Could not insert form. Some error has occurred. Check error property for details.
"
message
:
"
Could not insert form. Some error has occurred. Check error property for details.
"
...
@@ -111,8 +129,7 @@ export class FormCtrl {
...
@@ -111,8 +129,7 @@ export class FormCtrl {
}
}
res
.
json
({
res
.
json
({
id
:
resultId
message
:
"
Form added.
"
,
message
:
"
Form added. Id on key 'id'
"
});
});
return
;
return
;
});
});
...
...
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