Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
simcaq
simcaq-node
Commits
3abfa1b8
Commit
3abfa1b8
authored
1 month ago
by
lgtg20
Browse files
Options
Downloads
Patches
Plain Diff
feat: add student revenue API endpoint
parent
00b7dbc2
No related branches found
No related tags found
3 merge requests
!449
Homologa
,
!444
dev -> hom
,
!443
Issue 975
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/routes_v1/api.js
+3
-0
3 additions, 0 deletions
src/libs/routes_v1/api.js
src/libs/routes_v1/studentRevenue.js
+132
-0
132 additions, 0 deletions
src/libs/routes_v1/studentRevenue.js
with
135 additions
and
0 deletions
src/libs/routes_v1/api.js
+
3
−
0
View file @
3abfa1b8
...
@@ -173,6 +173,8 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen
...
@@ -173,6 +173,8 @@ const adjustedLiquidFrequency = require(`${libs}/routes_v1/adjustedLiquidFrequen
const
iliteracyRate
=
require
(
`
${
libs
}
/routes_v1/iliteracyRate`
);
const
iliteracyRate
=
require
(
`
${
libs
}
/routes_v1/iliteracyRate`
);
const
studentRevenue
=
require
(
`
${
libs
}
/routes_v1/studentRevenue`
);
api
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
api
.
get
(
'
/
'
,
(
req
,
res
)
=>
{
res
.
json
({
msg
:
'
SimCAQ API v1 is running
'
});
res
.
json
({
msg
:
'
SimCAQ API v1 is running
'
});
});
});
...
@@ -247,6 +249,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax)
...
@@ -247,6 +249,7 @@ api.use('/superior_education_conclusion_tax', superiorEducationConclusionTax)
api
.
use
(
'
/basic_education_conclusion
'
,
basicEducationConclusion
);
api
.
use
(
'
/basic_education_conclusion
'
,
basicEducationConclusion
);
api
.
use
(
'
/adjusted_liquid_frequency
'
,
adjustedLiquidFrequency
);
api
.
use
(
'
/adjusted_liquid_frequency
'
,
adjustedLiquidFrequency
);
api
.
use
(
'
/iliteracy_rate
'
,
iliteracyRate
);
api
.
use
(
'
/iliteracy_rate
'
,
iliteracyRate
);
api
.
use
(
'
/student_revenue
'
,
studentRevenue
);
//Publication
//Publication
api
.
use
(
'
/publication
'
,
publication
);
api
.
use
(
'
/publication
'
,
publication
);
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes_v1/studentRevenue.js
0 → 100644
+
132
−
0
View file @
3abfa1b8
/*
Copyright (C) 2024 Centro de Computacao Cientifica e Software Livre
Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
This file is part of simcaq-node.
simcaq-node is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
simcaq-node is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
const
express
=
require
(
'
express
'
);
const
studentRevenueApp
=
express
.
Router
();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
const
squel
=
require
(
'
squel
'
);
const
query
=
require
(
`
${
libs
}
/middlewares/query`
).
query
;
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
const
config
=
require
(
`
${
libs
}
/config`
);
const
cache
=
require
(
'
apicache
'
).
options
({
debug
:
config
.
debug
,
statusCodes
:
{
include
:
[
200
]}
}).
middleware
;
let
rqf
=
new
ReqQueryFields
();
studentRevenueApp
.
use
(
cache
(
'
15 day
'
));
studentRevenueApp
.
get
(
'
/years
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
pnad_novo
'
)
.
field
(
'
DISTINCT receitas.ano
'
,
'
year
'
)
next
();
},
query
,
response
(
'
years
'
));
rqf
.
addField
({
name
:
'
filter
'
,
field
:
false
,
where
:
true
}).
addField
({
name
:
'
dims
'
,
field
:
true
,
where
:
false
}).
addValue
({
name
:
'
min_year
'
,
table
:
'
receitas
'
,
tableField
:
'
ano
'
,
resultField
:
'
year
'
,
where
:
{
relation
:
'
>=
'
,
type
:
'
integer
'
,
field
:
'
ano
'
}
}).
addValue
({
name
:
'
max_year
'
,
table
:
'
receitas
'
,
tableField
:
'
ano
'
,
resultField
:
'
year
'
,
where
:
{
relation
:
'
<=
'
,
type
:
'
integer
'
,
field
:
'
ano
'
}
}).
addValue
({
name
:
'
city
'
,
table
:
'
receitas
'
,
tableField
:
'
cod_ibge
'
,
resultField
:
'
city
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
cod_ibge
'
}
})
studentRevenueApp
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
receitas
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
receitas.receitas
'
,
'
total_receitas
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
matriculas_publicas
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
matriculas_publica
'
,
'
matriculas_publica_total
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
matriculas_publicas_mais_conveniada
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
matriculas_publicas_mais_conveniada
'
,
'
matriculas_publicas_mais_conveniada_total
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
receita_aluno_ano_publica
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
receuta_aluno_ano_publica
'
,
'
receita_aluno_ano_publica_total
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
receita_aluno_mes_publica
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
receita_aluno_mes_publica
'
,
'
receita_aluno_mes_publica_total
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
receita_aluno_ano_publica_mais_conveniada
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
receita_aluno_ano_publica_mais_conveniada
'
,
'
receita_aluno_ano_publica_mais_conveniada_total
'
)
}
if
(
req
.
query
.
dims
&&
req
.
query
.
dims
.
includes
(
'
receita_aluno_mes_publica_mais_conveniada
'
))
{
req
.
sql
.
from
(
'
receitas
'
)
.
field
(
'
receitas.ano
'
,
'
year
'
)
.
field
(
'
receita_aluno_mes_publica_mais_conveniada
'
,
'
receita_aluno_mes_publica_mais_conveniada_total
'
)
}
next
();
},
query
,
id2str
.
transform
(
false
),
response
(
'
student_revenue
'
));
module
.
exports
=
studentRevenueApp
;
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