Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf-web-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
KS Pardubický kraj
cf-web-api
Commits
b45a79bf
Verified
Commit
b45a79bf
authored
3 years ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Existence objednavky a detail objednavky
parent
1c4ba17e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#6050
passed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
lib/CF2022/Controller/Orders.pm
+49
-0
49 additions, 0 deletions
lib/CF2022/Controller/Orders.pm
openapi.yaml
+48
-0
48 additions, 0 deletions
openapi.yaml
with
98 additions
and
1 deletion
.gitlab-ci.yml
+
1
−
1
View file @
b45a79bf
...
...
@@ -2,7 +2,7 @@ image: docker:20.10.9
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
IMAGE_VER
:
0.
7
.0
IMAGE_VER
:
0.
8
.0
services
:
-
docker:20.10.9-dind
...
...
This diff is collapsed.
Click to expand it.
lib/CF2022/Controller/Orders.pm
+
49
−
0
View file @
b45a79bf
...
...
@@ -157,4 +157,53 @@ sub create ($c ) {
);
}
sub
exists
($c ) {
$c
->
openapi
->
valid_input
or
return
;
my
$key
=
$c
->
param
('
key
');
my
$field
=
(
$key
=~
/\@/
)
?
'
email
'
:
'
sso_uuid
';
my
$exists
=
$c
->
schema
->
resultset
('
Order
')
->
search
({
deleted
=>
undef
,
$field
=>
$key
,
})
->
count
;
$c
->
render
(
status
=>
200
,
openapi
=>
{
exists
=>
$exists
},
);
}
sub
get
($c ) {
$c
->
openapi
->
valid_input
or
return
;
$c
->
oauth_token
(
$c
->
tx
->
req
->
content
->
headers
->
header
('
X-Token
'));
my
$claims
=
$c
->
oauth_claims
;
return
$c
->
error
(
403
,
'
Invalid token
')
if
!
$claims
;
my
$order
=
$c
->
schema
->
resultset
('
Order
')
->
search
({
deleted
=>
undef
,
sso_uuid
=>
$claims
->
{
sub
},
})
->
first
;
return
$c
->
error
(
404
,
'
NOT FOUND
')
if
!
$order
;
# datas z pretixu
$c
->
app
->
log
->
error
(
$order
->
api
.
$order
->
order_id
);
my
$ua
=
Mojo::
UserAgent
->
new
;
my
$rc
=
$ua
->
get
(
$order
->
api
.
$order
->
order_id
.
'
/
',
{
Authorization
=>
'
Token
'
.
$c
->
config
->
{
pretix_token
}
},
)
->
result
;
return
$c
->
error
(
400
,
$rc
->
body
)
if
!
$rc
->
is_success
;
$c
->
render
(
status
=>
200
,
openapi
=>
{
order
=>
$rc
->
json
},
);
}
1
;
This diff is collapsed.
Click to expand it.
openapi.yaml
+
48
−
0
View file @
b45a79bf
...
...
@@ -162,3 +162,51 @@ paths:
url
:
type
:
string
description
:
Tickets url
/orders/exists
:
get
:
x-mojo-to
:
orders#exists
tags
:
-
order
summary
:
"
Existence
objednavky"
operationId
:
checkOrder
parameters
:
-
name
:
key
in
:
query
required
:
true
example
:
andrej.ramaseuski@pirati.cz
description
:
"
Email
nebo
SSO
UUID"
schema
:
type
:
string
responses
:
200
:
description
:
Stav
content
:
application/json
:
schema
:
type
:
object
properties
:
exists
:
type
:
boolean
/orders/detail
:
get
:
x-mojo-to
:
orders#get
tags
:
-
order
summary
:
"
Objednavka"
operationId
:
getOrder
parameters
:
-
name
:
"
X-Token"
in
:
header
required
:
true
description
:
"
SSO
Token"
schema
:
type
:
string
responses
:
200
:
description
:
Objednavka
content
:
application/json
:
schema
:
type
:
object
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