Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
21_22-J 39 - backend service-plant-threat-identifier
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Imalka L.A.
21_22-J 39 - backend service-plant-threat-identifier
Commits
7dc6fa7b
Commit
7dc6fa7b
authored
Mar 08, 2022
by
Imalka L.A.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get solution list using image
parent
e4408473
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
9 deletions
+34
-9
src/main/java/com/ceyloneagro/ceyloneagrobackendservice/controller/DiseaseIdentifyController.java
...obackendservice/controller/DiseaseIdentifyController.java
+32
-4
src/main/java/com/ceyloneagro/ceyloneagrobackendservice/enumeration/ApplicationStatus.java
...loneagrobackendservice/enumeration/ApplicationStatus.java
+2
-5
No files found.
src/main/java/com/ceyloneagro/ceyloneagrobackendservice/controller/DiseaseIdentifyController.java
View file @
7dc6fa7b
package
com.ceyloneagro.ceyloneagrobackendservice.controller
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.ceyloneagro.ceyloneagrobackendservice.dto.response.BaseResponse
;
import
com.ceyloneagro.ceyloneagrobackendservice.dto.response.SolutionsResponse
;
import
com.ceyloneagro.ceyloneagrobackendservice.enumeration.ApplicationStatus
;
import
com.ceyloneagro.ceyloneagrobackendservice.service.SolutionService
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
@RestController
@CrossOrigin
(
origins
=
"*"
)
...
...
@@ -12,5 +21,24 @@ import org.springframework.web.bind.annotation.RestController;
public
class
DiseaseIdentifyController
{
private
final
SolutionService
solutionService
;
public
DiseaseIdentifyController
(
SolutionService
solutionService
)
{
this
.
solutionService
=
solutionService
;
}
@PostMapping
(
value
=
"/disease-solutions"
,
produces
=
{
MediaType
.
APPLICATION_JSON_VALUE
})
public
ResponseEntity
<
BaseResponse
<
SolutionsResponse
>>
getSolutionList
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"0"
)
int
page
,
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"25"
)
int
limit
,
@RequestBody
MultipartFile
file
)
{
SolutionsResponse
response
=
solutionService
.
getSolutionList
(
page
,
limit
,
"blight"
);
BaseResponse
<
SolutionsResponse
>
baseResponse
=
new
BaseResponse
<>(
ApplicationStatus
.
TOKEN_GENERATION_SUCCESS
,
response
);
return
new
ResponseEntity
<>(
baseResponse
,
HttpStatus
.
OK
);
}
}
src/main/java/com/ceyloneagro/ceyloneagrobackendservice/enumeration/ApplicationStatus.java
View file @
7dc6fa7b
...
...
@@ -6,11 +6,8 @@ import lombok.Getter;
public
enum
ApplicationStatus
{
TOKEN_GENERATION_SUCCESS
(
"S-000"
,
"New user token generated."
),
TOKEN_GENERATION_FAILED
(
"F-000"
,
"User token generation failed."
),
USER_REGISTRATION_SUCCESS
(
"S-001"
,
"New user has been successfully created."
),
USER_REGISTRATION_FAILED
(
"F-001"
,
"User registration failed."
);
TOKEN_GENERATION_SUCCESS
(
"S-000"
,
"Solution List Fetched Succesfully."
),
TOKEN_GENERATION_FAILED
(
"F-000"
,
"Solution List Fetched Failed."
);
private
String
code
;
private
String
message
;
...
...
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