Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf-online-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
Container registry
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KS Pardubický kraj
cf-online-api
Commits
d2335c65
Verified
Commit
d2335c65
authored
4 years ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Dokonceny zakladni CRUD pro Events
parent
e98cd361
No related branches found
No related tags found
No related merge requests found
Pipeline
#3061
passed
4 years ago
Stage: build
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
lib/CF/Controller/Events.pm
+10
-10
10 additions, 10 deletions
lib/CF/Controller/Events.pm
lib/CF/Schema/ResultSet/Event.pm
+15
-0
15 additions, 0 deletions
lib/CF/Schema/ResultSet/Event.pm
openapi.yaml
+5
-1
5 additions, 1 deletion
openapi.yaml
with
31 additions
and
12 deletions
.gitlab-ci.yml
+
1
−
1
View file @
d2335c65
...
@@ -2,7 +2,7 @@ image: docker:19.03.12
...
@@ -2,7 +2,7 @@ image: docker:19.03.12
variables
:
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
DOCKER_TLS_CERTDIR
:
"
/certs"
IMAGE_VER
:
2.
0
.0
IMAGE_VER
:
2.
1
.0
services
:
services
:
-
docker:19.03.12-dind
-
docker:19.03.12-dind
...
...
This diff is collapsed.
Click to expand it.
lib/CF/Controller/Events.pm
+
10
−
10
View file @
d2335c65
...
@@ -30,8 +30,10 @@ sub create ($c) {
...
@@ -30,8 +30,10 @@ sub create ($c) {
sub
get
($c) {
sub
get
($c) {
$c
->
openapi
->
valid_input
or
return
;
$c
->
openapi
->
valid_input
or
return
;
my
$event
=
$c
->
schema
->
resultset
('
Event
')
->
find
(
$c
->
stash
->
{
id
});
my
$event
=
$c
->
schema
->
resultset
('
Event
')
->
find
({
return
$c
->
error
(
404
,
'
Event not found
')
if
!
$event
;
id
=>
$c
->
stash
->
{
id
},
});
return
$c
->
error
(
404
,
'
Event not found
')
if
!
$event
||
$event
->
deleted
;
my
$formatted
=
$event
->
format
();
my
$formatted
=
$event
->
format
();
$formatted
->
{
acl
}
=
[]
;
$formatted
->
{
acl
}
=
[]
;
...
@@ -49,7 +51,7 @@ sub get ($c) {
...
@@ -49,7 +51,7 @@ sub get ($c) {
return
$c
->
error
(
404
,
'
Event not found
');
return
$c
->
error
(
404
,
'
Event not found
');
}
}
$c
->
render
(
openapi
=>
$c
->
spec_filter
(
$formatted
,
'
Event
'));
$c
->
render
(
json
=>
$c
->
spec_filter
(
$formatted
,
'
Event
'));
# BUG: error if openpi
}
}
sub
list
($c) {
sub
list
($c) {
...
@@ -98,14 +100,11 @@ sub update ($c) {
...
@@ -98,14 +100,11 @@ sub update ($c) {
return
$c
->
error
(
404
,
'
Event not found
')
if
!
$event
;
return
$c
->
error
(
404
,
'
Event not found
')
if
!
$event
;
my
$update
=
$c
->
prepare_update_data
(
$event
,
$c
->
req
->
json
);
my
$update
=
$c
->
prepare_update_data
(
$event
,
$c
->
req
->
json
);
my
$guard
=
$c
->
schema
->
txn_scope_guard
;
$event
->
update
({
%
{
$update
},
changed
=>
\
'
now()
',
});
my
$guard
=
$c
->
schema
->
txn_scope_guard
;
$event
->
update
({
%
{
$update
},
});
$guard
->
commit
;
$guard
->
commit
;
$c
->
render
(
status
=>
204
,
text
=>
'');
$c
->
render
(
status
=>
204
,
text
=>
'');
}
}
...
@@ -117,8 +116,9 @@ sub delete ($c) {
...
@@ -117,8 +116,9 @@ sub delete ($c) {
my
$guard
=
$c
->
schema
->
txn_scope_guard
;
my
$guard
=
$c
->
schema
->
txn_scope_guard
;
$event
->
update
({
deleted
=>
\
'
now()
',
});
$event
->
update
({
deleted
=>
\
'
now()
',
});
$guard
->
commit
;
$guard
->
commit
;
$c
->
render
(
status
=>
204
,
text
=>
'');
$c
->
render
(
status
=>
204
,
text
=>
'');
}
}
1
;
1
;
This diff is collapsed.
Click to expand it.
lib/CF/Schema/ResultSet/Event.pm
0 → 100644
+
15
−
0
View file @
d2335c65
package
CF::Schema::ResultSet::
Event
;
use
strict
;
use
warnings
;
use
base
'
DBIx::Class::ResultSet
';
use
constant
PROTECTED_FIELDS
=>
[
qw(
id
uuid
owner_id
deleted
)
];
1
;
This diff is collapsed.
Click to expand it.
openapi.yaml
+
5
−
1
View file @
d2335c65
...
@@ -401,6 +401,8 @@ paths:
...
@@ -401,6 +401,8 @@ paths:
required
:
false
required
:
false
schema
:
schema
:
type
:
boolean
type
:
boolean
default
:
false
example
:
true
-
name
:
sort
-
name
:
sort
description
:
"
Razeni"
description
:
"
Razeni"
in
:
query
in
:
query
...
@@ -431,7 +433,7 @@ paths:
...
@@ -431,7 +433,7 @@ paths:
get
:
get
:
x-mojo-to
:
events#get
x-mojo-to
:
events#get
security
:
security
:
-
Bearer
:
[
'
optional'
]
-
Bearer
:
[
'
optional'
,
'
*'
]
tags
:
tags
:
-
events
-
events
summary
:
"
Detail
udalosti"
summary
:
"
Detail
udalosti"
...
@@ -440,6 +442,7 @@ paths:
...
@@ -440,6 +442,7 @@ paths:
-
name
:
id
-
name
:
id
in
:
path
in
:
path
required
:
true
required
:
true
example
:
100345
description
:
"
ID"
description
:
"
ID"
schema
:
schema
:
type
:
integer
type
:
integer
...
@@ -462,6 +465,7 @@ paths:
...
@@ -462,6 +465,7 @@ paths:
-
name
:
id
-
name
:
id
in
:
path
in
:
path
required
:
true
required
:
true
example
:
100345
description
:
"
ID"
description
:
"
ID"
schema
:
schema
:
type
:
integer
type
:
integer
...
...
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