chore: add option to transition your data - internal feature (#2449)

* chore: add option to transition your data - internal feature

* chore: fix spec typo
This commit is contained in:
Karol Sójko
2023-08-24 14:58:15 +02:00
committed by GitHub
parent e41f239cc5
commit 3dd9504a85
13 changed files with 249 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
import { HttpServiceInterface } from '@standardnotes/api'
import { HttpStatusCode } from '@standardnotes/responses'
export class GetTransitionStatus implements UseCaseInterface<'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED'> {
constructor(private httpService: HttpServiceInterface) {}
async execute(): Promise<Result<'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED'>> {
const response = await this.httpService.get('/v1/users/transition-status')
if (response.status !== HttpStatusCode.Success) {
return Result.fail('Failed to get transition status')
}
return Result.ok((response.data as { status: 'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED' }).status)
}
}