fix pack 1

This commit is contained in:
Rafał Piskorski 2021-01-19 17:56:28 +01:00
parent 77643a111c
commit b2ba30db92
8 changed files with 251 additions and 116 deletions

View File

@ -82,7 +82,16 @@ calculatorViewServer <- function(input, output, session) {
r = response r = response
if(r$status_code==200){ if(r$status_code==200){
z=-5.3718+0.0354*as.numeric(content(r)$prediction$parameterInts[[1]]$value)+1.6159*as.numeric(content(r)$prediction$parameterInts[[2]]$value)+1.1768*as.numeric(content(r)$prediction$parameterInts[[3]]$value)+0.0697*as.numeric(content(r)$prediction$parameterInts[[4]]$value)+0.9586*as.numeric(content(r)$prediction$parameterInts[[5]]$value)-2.9486*as.numeric(content(r)$prediction$parameterInts[[6]]$value) # print(content(r)$prediction$parameterInts)
p=0
if(as.numeric(content(r)$prediction$parameterInts[[4]]$value)>=50){
p=50
}
z=-5.3718+0.0354*as.numeric(content(r)$prediction$parameterInts[[1]]$value)+1.6159*as.numeric(content(r)$prediction$parameterInts[[2]]$value)+1.1768*as.numeric(content(r)$prediction$parameterInts[[3]]$value)+0.0697*p+0.9586*as.numeric(content(r)$prediction$parameterInts[[5]]$value)-2.9486*as.numeric(content(r)$prediction$parameterInts[[6]]$value)
x=seq(by=1,-8,8) x=seq(by=1,-8,8)
y=round(1/(1+exp(-x)),3) y=round(1/(1+exp(-x)),3)
d=data.frame(x,y) d=data.frame(x,y)
@ -117,6 +126,7 @@ calculatorViewServer <- function(input, output, session) {
disabled(sliderInput("vslider2", strong("Największa średnica elementu stałego (w mm):"),min = 0, max = 200, value =content(r)$prediction$parameterInts[[4]]$value)), disabled(sliderInput("vslider2", strong("Największa średnica elementu stałego (w mm):"),min = 0, max = 200, value =content(r)$prediction$parameterInts[[4]]$value)),
disabled(selectInput("vselect3",strong("Nieregularna wewnętrzna ściana torbieli:"),choices = list("Nie"=0,"Tak"=1),selected=content(r)$prediction$parameterInts[[5]]$value)), disabled(selectInput("vselect3",strong("Nieregularna wewnętrzna ściana torbieli:"),choices = list("Nie"=0,"Tak"=1),selected=content(r)$prediction$parameterInts[[5]]$value)),
disabled(selectInput("vselect4",strong("Obecność cieni akustycznych:"),choices = list("Nie"=0,"Tak"=1),selected=content(r)$prediction$parameterInts[[6]]$value)), disabled(selectInput("vselect4",strong("Obecność cieni akustycznych:"),choices = list("Nie"=0,"Tak"=1),selected=content(r)$prediction$parameterInts[[6]]$value)),
downloadButton("reportCalView", "Generuj raport")
))%>% tagAppendAttributes(id = 'column-content') ))%>% tagAppendAttributes(id = 'column-content')
) %>% tagAppendAttributes(id = 'row-content'), ) %>% tagAppendAttributes(id = 'row-content'),
@ -139,6 +149,31 @@ calculatorViewServer <- function(input, output, session) {
} }
) )
output$reportCalView <- downloadHandler(
filename = "raport.pdf",
content = function(file) {
tempReport <- file.path(tempdir(), "report.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
p=0
if(as.numeric(input$slider2)>=50){
p=50
}
z=-5.3718+0.0354*as.numeric(input$vslider1)+1.6159*as.numeric(input$vselect1)+1.1768*as.numeric(input$vselect2)+0.0697*p+0.9586*as.numeric(input$vselect3)-2.9486*as.numeric(input$vselect4)
x=round(1/(1+exp(-z)),3)
params <- list(n = input$vslider1,k=input$vslider2,l=input$vselect1,m=input$vselect2,p=input$vselect3,r=input$vselect4,z=x)
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(parent = globalenv())
)
}
)
} }

View File

@ -31,19 +31,7 @@ firmyUI <- function(id) {
)), )),
uiOutput("firms"), uiOutput("firms"),
# fluidRow(column(4,
# div(div("GlaxoSmithKline"),img(src="gsk.png", a("GlaxoSmithKline" ,href= "https://pl.gsk.com/pl/"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
# column(4,
# div(div("Bayer"),img(src="bayer.png", a("Bayer",href="https://www.bayer.com/pl/pl/poland-home"), height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile'),
# column(4,
# div(div("BioFarm"),img(src="biofarm.png", a("BioFarm",href= "https://www.biofarm.pl"),height = 150, width = 150)))%>% tagAppendAttributes(class = 'column-tile')
#
# ) %>% tagAppendAttributes(id = 'row-tiles'),
fluidRow( fluidRow(
column(12, column(12,
tags$span("© Copyright Wszystkie prawa zastrzeżone."))%>% tagAppendAttributes(id = 'column-copyright'), tags$span("© Copyright Wszystkie prawa zastrzeżone."))%>% tagAppendAttributes(id = 'column-copyright'),
@ -75,13 +63,16 @@ firmyServer <- function(input, output,session) {
output$firms<-renderUI({ output$firms<-renderUI({
r<-componentFirms() r<-componentFirms()
# if(length(input$currentPage)!=0 && input$currentPage=="firms"){
# r<-httr::GET("http://localhost:8080/api/companies/all",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
companies = content(r)$companies companies = content(r)$companies
# print(content(r))
for(i in companies){
print(i) if(is.null(companies) | length(companies)==0){
} fluidRow(
column(12,
wellPanel(h2("Brak firm do wyświetlenia"))%>% tagAppendAttributes(id = 'no-firms') ))
}else{
exampleMap1 = leaflet() %>% exampleMap1 = leaflet() %>%
setView(companies[[1]]$companyData$latitude, companies[[1]]$companyData$longitude, zoom = 16) %>% setView(companies[[1]]$companyData$latitude, companies[[1]]$companyData$longitude, zoom = 16) %>%
@ -125,7 +116,8 @@ firmyServer <- function(input, output,session) {
)%>% tagAppendAttributes(id = 'column-firms') )%>% tagAppendAttributes(id = 'column-firms')
) %>% tagAppendAttributes(id = 'row-firms') ) %>% tagAppendAttributes(id = 'row-firms')
# actionButton("asdasdasd","asd") }
# } # }

View File

@ -8,34 +8,70 @@ library(DT)
klasyui <- function(id){ klasyui <- function(id){
ns <- NS(id) ns <- NS(id)
fluidPage( fluidPage(
fluidRow(
column(3,
tags$div("Panel sterowania") %>% tagAppendAttributes(class="panel-title"),
wellPanel(
sliderInput("sliderKlas1",
"Wiek pacjenta",
min = 1,
max = 100,
value = 1),
selectInput("selectKlas1",strong("Zaburzenia polykania"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas2",strong("Bol przy polykaniu"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas3",strong("Kaszel"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas4",strong("Dusznosci i swiszczacy oddech"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas5",strong("Odkrztuszanie wydzieliny z krwia i chrypka"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas6",strong("Guz w obrebie gruczolu piersiowego"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas7",strong("Zmiany skorne wokol brodawki."),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("selectKlas8",strong("Wyciek z brodawki (zwlaszcza krwisty)"),choices = list("Nie"=0,"Tak"=1),selected=0)
)
)%>% tagAppendAttributes(id = 'column-panel'),
column(9,
tags$div("Klasyfikator zachorowalności na nowotwory") %>% tagAppendAttributes(class="panel-title"),
wellPanel(
plotlyOutput("distPlot")
)
)%>% tagAppendAttributes(id = 'column-content')
) %>% tagAppendAttributes(id = 'row-content'),
fluidRow(
column(12,
tags$span("© Copyright Wszystkie prawa zastrzeżone."))%>% tagAppendAttributes(id = 'column-copyright'),
)%>% tagAppendAttributes(id = 'row-footer')
# Application title # Application title
titlePanel("Klasyfikator"), # titlePanel("Klasyfikator"),
#
# Sidebar with a slider input for number of bins # # Sidebar with a slider input for number of bins
sidebarLayout( # sidebarLayout(
sidebarPanel( # sidebarPanel(
sliderInput("slider1", # sliderInput("sliderKlas1",
"Wiek pacjenta", # "Wiek pacjenta",
min = 1, # min = 1,
max = 100, # max = 100,
value = 1), # value = 1),
selectInput("select1",strong("Zaburzenia polykania"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas1",strong("Zaburzenia polykania"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select2",strong("Bol przy polykaniu"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas2",strong("Bol przy polykaniu"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select3",strong("Kaszel"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas3",strong("Kaszel"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select4",strong("Dusznosci i swiszczacy oddech"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas4",strong("Dusznosci i swiszczacy oddech"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select5",strong("Odkrztuszanie wydzieliny z krwia i chrypka"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas5",strong("Odkrztuszanie wydzieliny z krwia i chrypka"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select6",strong("Guz w obrebie gruczolu piersiowego"),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas6",strong("Guz w obrebie gruczolu piersiowego"),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select7",strong("Zmiany skorne wokol brodawki."),choices = list("Nie"=0,"Tak"=1),selected=0), # selectInput("selectKlas7",strong("Zmiany skorne wokol brodawki."),choices = list("Nie"=0,"Tak"=1),selected=0),
selectInput("select8",strong("Wyciek z brodawki (zwlaszcza krwisty)"),choices = list("Nie"=0,"Tak"=1),selected=0) # selectInput("selectKlas8",strong("Wyciek z brodawki (zwlaszcza krwisty)"),choices = list("Nie"=0,"Tak"=1),selected=0)
#
), # ),
#
# Show a plot of the generated distribution # # Show a plot of the generated distribution
mainPanel( # mainPanel(
plotlyOutput("distPlot") # plotlyOutput("distPlot")
) # )
) # )
) )
} }
@ -45,16 +81,16 @@ klasyui <- function(id){
klasyserver <- function(input, output,session) { klasyserver <- function(input, output,session) {
output$distPlot <- renderPlotly({ output$distPlot <- renderPlotly({
k=(0.01*as.numeric(input$slider1)+0.1*as.numeric(input$select1)+0.1*as.numeric(input$select2))*100 k=(0.01*as.numeric(input$sliderKlas1)+0.1*as.numeric(input$selectKlas1)+0.1*as.numeric(input$selectKlas2))*100
if(k>100){ if(k>100){
k=100 k=100
} }
p=(0.01*as.numeric(input$slider1)+0.1*as.numeric(input$select3)+0.1*as.numeric(input$select4)+0.1*as.numeric(input$select5))*100 p=(0.01*as.numeric(input$sliderKlas1)+0.1*as.numeric(input$selectKlas3)+0.1*as.numeric(input$selectKlas4)+0.1*as.numeric(input$selectKlas5))*100
if(p>100){ if(p>100){
p=100 p=100
} }
#print(p*100) #print(p*100)
pi=(0.01*as.numeric(input$slider1)+0.1*as.numeric(input$select6)+0.1*as.numeric(input$select7)+0.1*as.numeric(input$select8))*100 pi=(0.01*as.numeric(input$sliderKlas1)+0.1*as.numeric(input$selectKlas6)+0.1*as.numeric(input$selectKlas7)+0.1*as.numeric(input$selectKlas8))*100
if(pi>100){ if(pi>100){
pi=100 pi=100
} }

View File

@ -117,31 +117,82 @@ profilServer <- function(input, output,session) {
}) })
personalDataVector <- reactiveVal()
historyDataVector <- reactiveVal()
downloadPersonalData<-reactive({
r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" ")))
r
})
downloadHistoryData<-reactive({
r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
r
})
observe({ observe({
currPage = get_page() currPage = get_page()
if(currPage=="profile" | currPage=="calculator" | currPage=="iota"){ if(currPage=="profile" | currPage=="calculator" | currPage=="iota"){
# print("tokenHandler")
session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash) if(currPage=="profile"){
run = paste('Shiny.onInputChange("pagePROFILE","',timestamp(),'");',sep="")
shinyjs::runjs(run)
}
else{
shinyjs::runjs('Shiny.onInputChange("profileTabs", "");')
}
session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash)
} }
}) })
output$profileData<-renderUI({
activeTab=input$profileActiveTab
session$clientData$url_hash
if(length(activeTab)==0 || is.null(activeTab) || activeTab!=1){ observeEvent(input$profileTabs,{
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 1);') if(input$profileTabs=="data"){
}
else if(activeTab==1){
r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" "))) personalDataVector(downloadPersonalData())
}else if(input$profileTabs=="history"){
historyDataVector(downloadHistoryData())
}
})
personalDataReturn <-reactive({
personalDataVector$values
})
historyDataReturn <-reactive({
historyDataVector()
})
observeEvent(input$del_button,{
r<-httr::DELETE(paste("http://localhost:8080/api/prediction/delete/",input$del_button,sep = ""),add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
if(r$status_code==200){
rr<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
historyDataVector(rr)
}
})
output$profileData<-renderUI({
r <- personalDataVector()
if(length(r)!=0 & !is.null(r)){
if(r$status_code==200){ if(r$status_code==200){
@ -165,15 +216,18 @@ profilServer <- function(input, output,session) {
choices = list("Zenska" = 0, "meska" = 1), choices = list("Zenska" = 0, "meska" = 1),
selected = as.numeric(response$profil$personalDataDTO$gender)), selected = as.numeric(response$profil$personalDataDTO$gender)),
),
actionButton("editSubmit","Zapisz"), actionButton("editSubmit","Zapisz"),
uiOutput("btnEditProfile",style="color:red;") uiOutput("btnEditProfile",style="color:red;")
),
)) ))
} }
} }
@ -193,26 +247,17 @@ profilServer <- function(input, output,session) {
output$afterLogin<-renderUI({ output$afterLogin<-renderUI({
if(!is.null(input$auth) & length(input$auth)>0 ){ if(!is.null(input$auth) & length(input$auth)>0 ){
fluidRow( fluidRow(
column(3,
tags$div("Panel sterowania") %>% tagAppendAttributes(class="panel-title") column(12,
tabsetPanel(id="profileTabs",type = "tabs",
)%>% tagAppendAttributes(id = 'column-panel'), tabPanel("Dane profilowe",value="data", tags$div(uiOutput("profileData")
column(9, ) %>% tagAppendAttributes(id = 'content-personal')),
tabsetPanel(type = "tabs",
tabPanel("Dane profilowe", tags$div(uiOutput("profileData") tabPanel("Historia pomiarów",value='history', tags$div(DT::dataTableOutput("historyTable",height = "auto"))%>% tagAppendAttributes(id="profileTabs",class = 'content-wrapper'))
)%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Historia pomiarów",value='profileTabs', tags$div(DT::dataTableOutput("historyTable",height = "auto"))%>% tagAppendAttributes(id="profileTabs",class = 'content-wrapper'))
# tabPanel("Zakladka 3", tags$div(plotlyOutput("plot3",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
# tabPanel("Zakladka 4", tags$div(plotlyOutput("plot4",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
# tabPanel("Zakladka 5", tags$div(DT::dataTableOutput("table1",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper'))
))%>% tagAppendAttributes(id = 'column-content') ))%>% tagAppendAttributes(id = 'column-profile')
) %>% tagAppendAttributes(id = 'row-content') ) %>% tagAppendAttributes(id = 'row-content')
}else{ }else{
@ -221,8 +266,6 @@ profilServer <- function(input, output,session) {
}) })
observeEvent(input$profileTabs, {
shinyjs::runjs('window.location.reload();')})
output$plot1 <- renderPlotly({ output$plot1 <- renderPlotly({
@ -243,24 +286,10 @@ profilServer <- function(input, output,session) {
change_page(paste("?id=",input$view_button,"#!/iota",sep=""), session = session, mode = "push") change_page(paste("?id=",input$view_button,"#!/iota",sep=""), session = session, mode = "push")
}) })
observeEvent(input$del_button,{
r<-httr::DELETE(paste("http://localhost:8080/api/prediction/delete/",input$del_button,sep = ""),add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
# print(r$status_code)
if(r$status_code==200){
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", "");')
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 2);')
}
})
output$historyTable <- DT::renderDataTable({ output$historyTable <- DT::renderDataTable({
activeTab = input$profileActiveTab r <- historyDataVector()
session$clientData$url_hash
if(activeTab!=2){
shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 2);') }
else{
r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
if(is.null(content(r)$predictions)){ if(is.null(content(r)$predictions)){
DT::datatable(data.frame(Nazwa=character(),Wynik=numeric(),Data=character()),options = list(scrollX = TRUE,language=pl)) DT::datatable(data.frame(Nazwa=character(),Wynik=numeric(),Data=character()),options = list(scrollX = TRUE,language=pl))
}else{ }else{
@ -269,11 +298,11 @@ profilServer <- function(input, output,session) {
historyTableButtons = list() historyTableButtons = list()
for(r in 1:nrow(df_historyTable)){ for(rowNumber in 1:nrow(df_historyTable)){
# print(as.numeric(df_historyTable[r,]$id[1]))
historyTableButtons[[length(historyTableButtons)+1]] <- list(shinyInput(actionButton, 1, as.character(df_historyTable[r,]$id[1]), label = "Pokaż", onclick = 'Shiny.onInputChange(\"view_button\", this.id)' ), historyTableButtons[[rowNumber]] <-list(shinyInput(actionButton, 1, as.character(df_historyTable[rowNumber,]$id[1]), label = "Pokaż", onclick = 'Shiny.onInputChange(\"view_button\", this.id)' ),
shinyInput(actionButton, 1, as.character(df_historyTable[r,]$id[1]), label = "Usuń", onclick = 'Shiny.onInputChange(\"del_button\", this.id)')) shinyInput(actionButton, 1, as.character(df_historyTable[rowNumber,]$id[1]), label = "Usuń", onclick = 'Shiny.onInputChange(\"del_button\", this.id)'))
} }
df_historyTable<-df_historyTable %>% df_historyTable<-df_historyTable %>%
@ -290,8 +319,8 @@ profilServer <- function(input, output,session) {
df_historyTable$Data<-do.call(c, df_historyTable$Data) df_historyTable$Data<-do.call(c, df_historyTable$Data)
DT::datatable(df_historyTable,options = list(scrollX = TRUE,language=pl))} DT::datatable(df_historyTable,selection="none",options = list(scrollX = TRUE,language=pl))}
} # }
}) })

View File

@ -1,17 +1,22 @@
#profileData{ #profileData{
display:flex; display:flex;
justify-content:center; justify-content:center;
max-width:700px;
align-self:center;
} }
#profileData > .row,#profileData > .row > .well{ #profileData > .row,#profileData > .row > .well{
width:100%; width:100%;
#background-color:#00A896;
} }
#profileData > .row .well{ #profileData > .row .well{
#display:flex; display:flex;
justify-content:center;
flex-direction:column;
color:white; color:white;
background-color:#00A896; background-color:#00A896;
} }

View File

@ -158,6 +158,14 @@ background-color: #008375 !important;
} }
#column-profile{
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25), -2px -2px 4px rgba(0, 0, 0, 0.25);
background-color:white;
}
#column-title{ #column-title{
width:100%; width:100%;
display:flex; display:flex;
@ -272,6 +280,12 @@ text-align:center;
align-self:center; align-self:center;
} }
#content-personal{
display:flex;
justify-content:center;
}
#column-login > .well{ #column-login > .well{
display:flex; display:flex;
@ -371,12 +385,19 @@ table.dataTable{
} }
table.dataTable td{ table.dataTable td{
color: white; #color: white;
text-shadow: 1px 0 0.5px black, -1px 0 0.5px black, 0 1px 0.5px black, 0 -1px 0.5px black; #text-shadow: 1px 0 0.5px black, -1px 0 0.5px black, 0 1px 0.5px black, 0 -1px 0.5px black;
font-family: 'Fjalla One'; font-family: 'Fjalla One';
text-align:center!important; text-align:center!important;
} }
table.dataTable tr:nth-child(even)>td:last-child{
color:#00A896!important;
}
table.dataTable tr:nth-child(odd)>td:last-child{
color:#00c7b2!important;
}
table.dataTable tr:nth-child(even){ table.dataTable tr:nth-child(even){
background-color:#00A896!important; background-color:#00A896!important;
} }
@ -439,6 +460,11 @@ table.dataTable th{
} }
#no-firms{
background-color:#00A896;
color:white;
text-align:center;
}
@media only screen and (max-width: 767px) { @media only screen and (max-width: 767px) {
body >.container-fluid{ body >.container-fluid{
@ -462,14 +488,23 @@ min-height:100vh;
}
#column-profile{
min-height:500px;
} }
#row-title{ #row-title{
display:none; display:none;
} }
#profileData{
width:100%;
}
} }
@ -505,6 +540,10 @@ margin-left:auto;
} }
#profileData{
width:73%;
#min-height:900px;
}
} }

View File

@ -74,7 +74,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public static final String TOKEN_HEADER = "Authorization"; public static final String TOKEN_HEADER = "Authorization";
public static final String TOKEN_SCHEME = "Bearer "; public static final String TOKEN_SCHEME = "Bearer ";
public static final String TOKEN_KEY = "TakeCareApp"; public static final String TOKEN_KEY = "TakeCareApp";
public static final long TOKEN_VALIDITY = 5*60; public static final long TOKEN_VALIDITY = 30*60;

View File

@ -9,7 +9,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import project.DTO.PredictionDTO; import project.DTO.PredictionDTO;
import project.DTO.UserDTO;
import project.config.TokenHelper; import project.config.TokenHelper;
import project.model.CompanyProfile; import project.model.CompanyProfile;
import project.model.PersonalProfile; import project.model.PersonalProfile;
@ -207,7 +206,7 @@ public class PredictionController {
List<Prediction> predictions = this.predictionService.getAllPredictionsForUser(currentUser.getId()); List<Prediction> predictions = this.predictionService.getAllPredictionsForUser(currentUser.getId());
if (predictions!=null){ if (predictions!=null){
map.put("predictions", this.generatorDTO.generatePredictionsDTO(predictions)); map.put("predictions", this.generatorDTO.generatePredictionsDTO(predictions));
return new ResponseEntity<Map<String,Object>>(map, HttpStatus.ACCEPTED); return new ResponseEntity<Map<String,Object>>(map, HttpStatus.OK);
}else{ }else{
map.put("predictions", null); map.put("predictions", null);
return new ResponseEntity<Map<String,Object>>(map, HttpStatus.BAD_REQUEST); return new ResponseEntity<Map<String,Object>>(map, HttpStatus.BAD_REQUEST);