View | Details | Raw Unified | Return to bug 17387
Collapse All | Expand All

(-)a/Koha/REST/V1/DeletedBiblios.pm (+26 lines)
Lines 165-168 sub list { Link Here
165
    };
165
    };
166
}
166
}
167
167
168
=head3 restore
169
170
Controller function that handles restoring a single deleted biblio object
171
172
=cut
173
174
sub restore {
175
    my $c = shift->openapi->valid_input or return;
176
177
    my $deleted_biblio = Koha::Old::Biblios->find( $c->param('biblio_id') );
178
179
    return $c->render_resource_not_found("Bibliographic record")
180
        unless $deleted_biblio;
181
182
    return try {
183
        my $biblio = $deleted_biblio->restore;
184
185
        return $c->render(
186
            status  => 200,
187
            openapi => { biblio_id => $biblio->biblionumber }
188
        );
189
    } catch {
190
        $c->unhandled_exception($_);
191
    };
192
}
193
168
1;
194
1;
(-)a/api/v1/swagger/paths/deleted_biblios.yaml (-1 / +45 lines)
Lines 118-120 Link Here
118
    x-koha-authorization:
118
    x-koha-authorization:
119
      permissions:
119
      permissions:
120
        catalogue: "1"
120
        catalogue: "1"
121
- 
121
  put:
122
    x-mojo-to: DeletedBiblios#restore
123
    operationId: restoreDeletedBiblio
124
    tags:
125
      - biblios
126
    summary: Restore deleted biblio
127
    parameters:
128
      - $ref: "../swagger.yaml#/parameters/biblio_id_pp"
129
    produces:
130
      - application/json
131
    responses:
132
      "200":
133
        description: Biblio restored successfully
134
        schema:
135
          type: object
136
      "400":
137
        description: Bad request
138
        schema:
139
          $ref: "../swagger.yaml#/definitions/error"
140
      "401":
141
        description: Authentication required
142
        schema:
143
          $ref: "../swagger.yaml#/definitions/error"
144
      "403":
145
        description: Access forbidden
146
        schema:
147
          $ref: "../swagger.yaml#/definitions/error"
148
      "404":
149
        description: Deleted bibliographic record not found
150
        schema:
151
          $ref: "../swagger.yaml#/definitions/error"
152
      "500":
153
        description: |
154
          Internal server error. Possible `error_code` attribute values:
155
156
          * `internal_server_error`
157
        schema:
158
          $ref: "../swagger.yaml#/definitions/error"
159
      "503":
160
        description: Under maintenance
161
        schema:
162
          $ref: "../swagger.yaml#/definitions/error"
163
    x-koha-authorization:
164
      permissions:
165
        editcatalogue: edit_catalogue

Return to bug 17387