Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AGES-Adocoes
Adocoes
Commits
b262104b
Commit
b262104b
authored
7 years ago
by
Thiago Rocha
Browse files
Options
Download
Email Patches
Plain Diff
#76 add route and model for documentos
parent
9585c65d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
api/src/Interessado/Translator.js
+15
-0
api/src/Interessado/Translator.js
api/src/Model/interessado.js
+3
-2
api/src/Model/interessado.js
api/src/server.js
+14
-1
api/src/server.js
api/test/inicializacaoMongo.mongo
+9
-7
api/test/inicializacaoMongo.mongo
with
41 additions
and
10 deletions
+41
-10
api/src/Interessado/Translator.js
View file @
b262104b
...
...
@@ -233,4 +233,19 @@ export default class Translator {
response
.
send
(
200
,
message
);
})
}
postDocument
(
request
,
response
)
{
const
body
=
{
id
:
request
.
params
.
id_interessado
,
...
request
.
body
}
this
.
Interactor
.
postDocument
(
body
)
.
then
(
message
=>
{
response
.
send
(
200
,
message
);
})
.
catch
(
message
=>
{
})
}
}
This diff is collapsed.
Click to expand it.
api/src/Model/interessado.js
View file @
b262104b
...
...
@@ -34,7 +34,8 @@ const interessadoSchema = new Schema({
midiaSchema
],
outrosDocumentos
:
[
documentoSchema
type
:
mongoose
.
Schema
.
Type
.
ObjectId
,
ref
:
"
documentos
"
],
enderecos
:
[{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
...
...
@@ -59,4 +60,4 @@ const interessadoSchema = new Schema({
}
});
mongoose
.
model
(
"
Interessado
"
,
interessadoSchema
);
\ No newline at end of file
mongoose
.
model
(
"
Interessado
"
,
interessadoSchema
);
This diff is collapsed.
Click to expand it.
api/src/server.js
View file @
b262104b
...
...
@@ -312,7 +312,20 @@ server.del("/interessados/:id_interessado/menores/:id_menor", AuthManager.userAu
// RFI16 (2017-2): POST /interessados/:id_interessado/menores/:id_menor/compartilhamentos
// RFI17 (2017-2): GET /interessados/:id_interessado/mensagens
// RFI18 (2017-2): PUT /usuarios/:id_usuario/mensagens
// RFI19 (2017-2): POST /interessados/:id_interessado/documentos
// RFI19 (2017-2): POST /interessados/:id_interessado/documento
/**
* @api {post} /interessados/:id_interessado/documento Post User Document
* @apiGroup Interessado
* @apiSuccessExample {json} Success-Response
* HTTP/1.1 200 OK
* {
*
* }
*/
server
.
post
(
"
/interessados/:id_interessado/documento
"
,
AuthManager
.
userAuthenticated
,
(
req
,
res
)
=>
{
const
interessadoTranslator
=
new
InteressadoTranslator
();
interessadoTransalator
.
postDocument
(
req
,
res
);
});
// RFI20 (2017-2): GET /interessados/:id_interessado/documentos
/**
* @api {get} /interessados/:id_interessado/documentos Request User Documents
...
...
This diff is collapsed.
Click to expand it.
api/test/inicializacaoMongo.mongo
View file @
b262104b
...
...
@@ -29,13 +29,7 @@ interessado1 ={
dataNascimento: "1991-12-12T00:00:00.000Z",
renda: "10000",
comprovantesRenda: null,
outrosDocumentos: {
numero : "233837164",
dataEmissao: "1991-12-12T00:00:00.000Z",
orgaoEmissor: "SSP",
tipoDocumento: "RG",
imagem: null
},
outrosDocumentos: ,
enderecos: "rua das carmelias, 435",
telefones: "30257345",
interesses: null,
...
...
@@ -43,4 +37,12 @@ interessado1 ={
ativo: true
}
document1 = {
numero : "233837164",
dataEmissao: "1991-12-12T00:00:00.000Z",
orgaoEmissor: "SSP",
tipoDocumento: "RG",
imagem: null
}
db.interessados.update(interessado1, interessado1, {upsert:true})
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help