|
Lines 84-90
sub get {
Link Here
|
| 84 |
}); |
84 |
}); |
| 85 |
} |
85 |
} |
| 86 |
|
86 |
|
| 87 |
return $c->render( status => 200, openapi => $macro->to_api ); |
87 |
return $c->render( status => 200, openapi => $c->objects->to_api($macro) ); |
| 88 |
} |
88 |
} |
| 89 |
|
89 |
|
| 90 |
=head3 get_shared |
90 |
=head3 get_shared |
|
Lines 108-114
sub get_shared {
Link Here
|
| 108 |
error => "This macro is not shared, you must access it via advanced_editor/macros" |
108 |
error => "This macro is not shared, you must access it via advanced_editor/macros" |
| 109 |
}); |
109 |
}); |
| 110 |
} |
110 |
} |
| 111 |
return $c->render( status => 200, openapi => $macro->to_api ); |
111 |
return $c->render( status => 200, openapi => $c->objects->to_api($macro) ); |
| 112 |
} |
112 |
} |
| 113 |
|
113 |
|
| 114 |
=head3 add |
114 |
=head3 add |
|
Lines 133-139
sub add {
Link Here
|
| 133 |
$c->res->headers->location( $c->req->url->to_string . '/' . $macro->id ); |
133 |
$c->res->headers->location( $c->req->url->to_string . '/' . $macro->id ); |
| 134 |
return $c->render( |
134 |
return $c->render( |
| 135 |
status => 201, |
135 |
status => 201, |
| 136 |
openapi => $macro->to_api |
136 |
openapi => $c->objects->to_api($macro), |
| 137 |
); |
137 |
); |
| 138 |
} |
138 |
} |
| 139 |
catch { |
139 |
catch { |
|
Lines 162-168
sub add_shared {
Link Here
|
| 162 |
$c->res->headers->location( $c->req->url->to_string . '/' . $macro->id ); |
162 |
$c->res->headers->location( $c->req->url->to_string . '/' . $macro->id ); |
| 163 |
return $c->render( |
163 |
return $c->render( |
| 164 |
status => 201, |
164 |
status => 201, |
| 165 |
openapi => $macro->to_api |
165 |
openapi => $c->objects->to_api($macro), |
| 166 |
); |
166 |
); |
| 167 |
} |
167 |
} |
| 168 |
catch { |
168 |
catch { |
|
Lines 202-208
sub update {
Link Here
|
| 202 |
return try { |
202 |
return try { |
| 203 |
$macro->set_from_api( $body ); |
203 |
$macro->set_from_api( $body ); |
| 204 |
$macro->store->discard_changes; |
204 |
$macro->store->discard_changes; |
| 205 |
return $c->render( status => 200, openapi => $macro->to_api ); |
205 |
return $c->render( status => 200, openapi => $c->objects->to_api($macro), ); |
| 206 |
} |
206 |
} |
| 207 |
catch { |
207 |
catch { |
| 208 |
$c->unhandled_exception($_); |
208 |
$c->unhandled_exception($_); |
|
Lines 235-241
sub update_shared {
Link Here
|
| 235 |
return try { |
235 |
return try { |
| 236 |
$macro->set_from_api( $body ); |
236 |
$macro->set_from_api( $body ); |
| 237 |
$macro->store->discard_changes; |
237 |
$macro->store->discard_changes; |
| 238 |
return $c->render( status => 200, openapi => $macro->to_api ); |
238 |
return $c->render( status => 200, openapi => $c->objects->to_api($macro), ); |
| 239 |
} |
239 |
} |
| 240 |
catch { |
240 |
catch { |
| 241 |
$c->unhandled_exception($_); |
241 |
$c->unhandled_exception($_); |