Revize 8ca80c9a
Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)
- ID 8ca80c9a66e28fc1caecfea278568d514e98bcb2
- Rodič a49028dd
Backend/Backend/Controllers/DocumentController.cs | ||
---|---|---|
208 | 208 |
throw new BadRequestException(e.Message); |
209 | 209 |
} |
210 | 210 |
} |
211 |
|
|
212 |
[HttpPost("/documents/export")] |
|
213 |
[Authorize(Models.Enums.ERole.ADMINISTRATOR)] |
|
214 |
[ProducesResponseType((int)HttpStatusCode.OK)] |
|
215 |
[ProducesResponseType((int)HttpStatusCode.Forbidden)] |
|
216 |
public ActionResult<ExportResponse> ExportDocuments([FromServices] ClientInfo clientInfo, [FromBody] ExportRequest request) |
|
217 |
{ |
|
218 |
if (clientInfo.LoggedUser == null) |
|
219 |
{ |
|
220 |
logger.Warning("ClientInfo has null LoggerUser in [Authorized] controller"); |
|
221 |
return Problem(); |
|
222 |
} |
|
223 |
|
|
224 |
try |
|
225 |
{ |
|
226 |
var outputStream = annotationService.Export(request); |
|
227 |
|
|
228 |
var cd = new System.Net.Mime.ContentDisposition() |
|
229 |
{ |
|
230 |
FileName = "export.zip", |
|
231 |
Inline = false, |
|
232 |
}; |
|
233 |
|
|
234 |
Response.Headers.Add("Content-Disposition", cd.ToString()); |
|
235 |
return File(outputStream, "application/zip"); |
|
236 |
} |
|
237 |
catch (InvalidOperationException e) |
|
238 |
{ |
|
239 |
throw new BadRequestException(e.Message); |
|
240 |
} |
|
241 |
} |
|
211 | 242 |
} |
212 | 243 |
|
Také k dispozici: Unified diff
Export in BE