|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
| 3 | +using System.Globalization; |
3 | 4 | using System.Threading;
|
4 | 5 | using System.Threading.Tasks;
|
5 | 6 | using EdjCase.JsonRpc.Router.Abstractions;
|
@@ -34,6 +35,44 @@ IUserAccessor userAccessor
|
34 | 35 | // Keep a reference in this class to prevent duplicate allocation (Warning CS9107)
|
35 | 36 | private readonly IExceptionHandler _exceptionHandler = exceptionHandler;
|
36 | 37 |
|
| 38 | + public IRpcMethodResult ApplyPreTranslationToProject( |
| 39 | + string projectId, |
| 40 | + string scriptureRange, |
| 41 | + string targetProjectId, |
| 42 | + DateTime timestamp |
| 43 | + ) |
| 44 | + { |
| 45 | + try |
| 46 | + { |
| 47 | + // Run the background job |
| 48 | + backgroundJobClient.Enqueue<IMachineApiService>(r => |
| 49 | + r.ApplyPreTranslationToProjectAsync( |
| 50 | + UserId, |
| 51 | + projectId, |
| 52 | + scriptureRange, |
| 53 | + targetProjectId, |
| 54 | + timestamp, |
| 55 | + CancellationToken.None |
| 56 | + ) |
| 57 | + ); |
| 58 | + return Ok(); |
| 59 | + } |
| 60 | + catch (Exception) |
| 61 | + { |
| 62 | + _exceptionHandler.RecordEndpointInfoForException( |
| 63 | + new Dictionary<string, string> |
| 64 | + { |
| 65 | + { "method", "ApplyPreTranslationToProject" }, |
| 66 | + { "projectId", projectId }, |
| 67 | + { "scriptureRange", scriptureRange }, |
| 68 | + { "targetProjectId", targetProjectId }, |
| 69 | + { "timestamp", timestamp.ToString(CultureInfo.InvariantCulture) }, |
| 70 | + } |
| 71 | + ); |
| 72 | + throw; |
| 73 | + } |
| 74 | + } |
| 75 | + |
37 | 76 | public async Task<IRpcMethodResult> Create(SFProjectCreateSettings settings)
|
38 | 77 | {
|
39 | 78 | try
|
|
0 commit comments