Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SQA Project Part1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ahmad Arslan
SQA Project Part1
Commits
6685ce05
Commit
6685ce05
authored
2 years ago
by
Emildeon Thevaraj
Browse files
Options
Downloads
Patches
Plain Diff
controller endpoints added
parent
f428cd4b
Branches
Ying
Branches containing commit
No related tags found
1 merge request
!2
Deon
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/rwth/swc/sqa/api/TicketController.java
+39
-0
39 additions, 0 deletions
src/main/java/de/rwth/swc/sqa/api/TicketController.java
with
39 additions
and
0 deletions
src/main/java/de/rwth/swc/sqa/api/TicketController.java
+
39
−
0
View file @
6685ce05
...
...
@@ -3,7 +3,46 @@ package de.rwth.swc.sqa.api;
import
de.rwth.swc.sqa.model.Customer
;
import
org.springframework.stereotype.Controller
;
import
de.rwth.swc.sqa.model.Ticket
;
import
de.rwth.swc.sqa.model.TicketRequest
;
import
de.rwth.swc.sqa.model.TicketValidationRequest
;
import
io.swagger.annotations.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.Valid
;
import
javax.validation.constraints.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
@Controller
public
class
TicketController
implements
TicketsApi
{
Customer
customer
;
@PostMapping
(
"/tickets"
)
public
ResponseEntity
<
Ticket
>
buyTicket
(
@ApiParam
(
value
=
"TicketRequest object"
,
required
=
true
)
@Valid
@RequestBody
TicketRequest
body
)
{
getRequest
().
ifPresent
(
request
->
{
for
(
MediaType
mediaType:
MediaType
.
parseMediaTypes
(
request
.
getHeader
(
"Accept"
)))
{
if
(
mediaType
.
isCompatibleWith
(
MediaType
.
valueOf
(
"application/json"
)))
{
String
exampleString
=
"{ \"birthdate\" : \"1992-01-01\", \"validFor\" : \"1h\", \"zone\" : \"A\", \"student\" : true, \"discountCard\" : true, \"disabled\" : true, \"id\" : 0, \"validFrom\" : \"2020-10-29T10:38:59\" }"
;
ApiUtil
.
setExampleResponse
(
request
,
"application/json"
,
exampleString
);
break
;
}
}
});
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
}
@PostMapping
(
"/tickets/validate"
)
public
ResponseEntity
<
Void
>
validateTicket
(
@ApiParam
(
value
=
"TicketValidationRequest object that needs to validated"
,
required
=
true
)
@Valid
@RequestBody
TicketValidationRequest
body
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_IMPLEMENTED
);
}
}
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