Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
C4Ai_DR-P
public-service-provider
Commits
fb0a97d6
Commit
fb0a97d6
authored
Jul 09, 2020
by
Mahdi Sellami
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added case worker administration resource
parent
2265cbc9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
163 additions
and
3 deletions
+163
-3
api/openapi.yaml
api/openapi.yaml
+112
-2
controllers/Administration.js
controllers/Administration.js
+24
-0
index.js
index.js
+1
-1
service/AdministrationService.js
service/AdministrationService.js
+26
-0
No files found.
api/openapi.yaml
View file @
fb0a97d6
...
...
@@ -17,6 +17,8 @@ tags:
description
:
Decision of an administration case
-
name
:
verification
description
:
Verification of a decision of an administration case
-
name
:
administration
description
:
administration of the applications
paths
:
/leistungen
:
get
:
...
...
@@ -30,7 +32,7 @@ paths:
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/
inline_response_200
'
$ref
:
'
#/components/schemas/
Services
'
x-swagger-router-controller
:
Info
/leistungen/{leikaId}
:
get
:
...
...
@@ -166,6 +168,42 @@ paths:
schema
:
$ref
:
'
#/components/schemas/Verification'
x-swagger-router-controller
:
Verification
/admin/verfahren/all
:
get
:
tags
:
-
administration
summary
:
Find all applications
operationId
:
getAllApplications
responses
:
"
200"
:
description
:
Successful operation
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Applications'
x-swagger-router-controller
:
Administration
/admin/verfahren/{verfahrensId}/complete
:
put
:
tags
:
-
administration
summary
:
Set the status of an application to completed
operationId
:
setApplicationStatusToCompleted
parameters
:
-
name
:
verfahrensId
in
:
path
required
:
true
style
:
simple
explode
:
false
schema
:
type
:
string
responses
:
"
200"
:
description
:
Successful operation
content
:
application/json
:
schema
:
$ref
:
'
#/components/schemas/Verfahren'
x-swagger-router-controller
:
Administration
components
:
schemas
:
Service
:
...
...
@@ -341,7 +379,7 @@ components:
personId
:
personId
prename
:
prename
email
:
email
inline_response_200
:
Services
:
properties
:
services
:
type
:
array
...
...
@@ -361,6 +399,78 @@ components:
fullText
:
fullText
serviceDescription
:
serviceDescription
responsibleAuthority
:
responsibleAuthority
Applications
:
properties
:
services
:
type
:
array
items
:
$ref
:
'
#/components/schemas/Verfahren'
example
:
applications
:
-
dataObjects
:
-
dataObjectId
:
dataObjectId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
title
:
title
type
:
type
content
:
{}
-
dataObjectId
:
dataObjectId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
title
:
title
type
:
type
content
:
{}
statusDescription
:
statusDescription
statusLastChangeDate
:
2000-01-23T04:56:07.000+00:00
statusId
:
statusId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
decisionJustification
:
decisionJustification
responsibleAuthority
:
responsibleAuthority
decisionDate
:
2000-01-23T04:56:07.000+00:00
applicant
:
address
:
zip
:
zip
country
:
country
city
:
city
street
:
street
houseno
:
houseno
surname
:
surname
personId
:
personId
prename
:
prename
email
:
email
-
dataObjects
:
-
dataObjectId
:
dataObjectId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
title
:
title
type
:
type
content
:
{}
-
dataObjectId
:
dataObjectId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
title
:
title
type
:
type
content
:
{}
statusDescription
:
statusDescription
statusLastChangeDate
:
2000-01-23T04:56:07.000+00:00
statusId
:
statusId
leikaId
:
leikaId
verfahrensId
:
verfahrensId
decisionJustification
:
decisionJustification
responsibleAuthority
:
responsibleAuthority
decisionDate
:
2000-01-23T04:56:07.000+00:00
applicant
:
address
:
zip
:
zip
country
:
country
city
:
city
street
:
street
houseno
:
houseno
surname
:
surname
personId
:
personId
prename
:
prename
email
:
email
body
:
properties
:
type
:
...
...
controllers/Administration.js
0 → 100644
View file @
fb0a97d6
'
use strict
'
;
var
utils
=
require
(
'
../utils/writer.js
'
);
var
Administration
=
require
(
'
../service/AdministrationService
'
);
module
.
exports
.
getAllApplications
=
function
getAllApplications
(
req
,
res
,
next
)
{
Administration
.
getAllApplications
()
.
then
(
function
(
response
)
{
utils
.
writeJson
(
res
,
response
);
})
.
catch
(
function
(
response
)
{
utils
.
writeJson
(
res
,
response
);
});
};
module
.
exports
.
setApplicationStatusToCompleted
=
function
setApplicationStatusToCompleted
(
req
,
res
,
next
,
verfahrensId
)
{
Administration
.
setApplicationStatusToCompleted
(
verfahrensId
)
.
then
(
function
(
response
)
{
utils
.
writeJson
(
res
,
response
);
})
.
catch
(
function
(
response
)
{
utils
.
writeJson
(
res
,
response
);
});
};
index.js
View file @
fb0a97d6
...
...
@@ -26,7 +26,7 @@ http.createServer(app).listen(serverPort, function () {
//Set up mongoose connection
var
mongoose
=
require
(
'
mongoose
'
);
var
mongoDB
=
config
.
get
(
'
dbConfig.host
'
);
mongoose
.
connect
(
mongoDB
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
});
mongoose
.
connect
(
mongoDB
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
,
useFindAndModify
:
false
});
var
db
=
mongoose
.
connection
;
db
.
on
(
'
error
'
,
console
.
error
.
bind
(
console
,
'
MongoDB connection error:
'
));
...
...
service/AdministrationService.js
0 → 100644
View file @
fb0a97d6
'
use strict
'
;
const
Application
=
require
(
'
../models/application
'
);
/**
* Request all pending applications
*
* returns list of Verfahren
**/
exports
.
getAllApplications
=
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
const
applicationRecords
=
Application
.
find
({});
resolve
(
applicationRecords
);
});
}
exports
.
setApplicationStatusToCompleted
=
function
(
verfahrensId
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
const
filter
=
{
verfahrensId
:
verfahrensId
};
const
update
=
{
statusId
:
'
bearbeitet
'
,
statusDescription
:
'
Ihr Antrag wurde bearbeitet
'
,
statusLastChangeDate
:
new
Date
().
toLocaleDateString
(
'
de-DE
'
)};
const
applicationRecord
=
Application
.
findOneAndUpdate
(
filter
,
update
,
function
(
err
,
result
)
{
return
result
});
resolve
(
applicationRecord
);
});
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment