(cmdOptions: Record<string, any>)
| 11 | constructor(private syncService: SyncService) {} |
| 12 | |
| 13 | async run(cmdOptions: Record<string, any>): Promise<Response> { |
| 14 | const normalizedOptions = new Options(cmdOptions); |
| 15 | if (normalizedOptions.last) { |
| 16 | return await this.getLastSync(); |
| 17 | } |
| 18 | |
| 19 | try { |
| 20 | await this.syncService.fullSync(normalizedOptions.force, true); |
| 21 | const res = new MessageResponse("Syncing complete.", null); |
| 22 | return Response.success(res); |
| 23 | } catch (e) { |
| 24 | const response = Response.error(e); |
| 25 | response.message = "Syncing failed: " + response.message; |
| 26 | return response; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | private async getLastSync() { |
| 31 | const lastSyncDate = await this.syncService.getLastSync(); |
no test coverage detected