diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-12-09 03:57:12 +0100 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-12-09 03:57:12 +0100 |
| commit | 4dbef3fcd7a14437d55c555cf10d50de8e50d7d1 (patch) | |
| tree | 632589ecfcfb4dfddeafb71d0077257584b5e7ec /code/app/src/services/abstractions/IAccountService.ts | |
| parent | 914c75e0ceeb3e11ddd55e94bb461c26b0db5b7a (diff) | |
| download | greatoffice-4dbef3fcd7a14437d55c555cf10d50de8e50d7d1.tar.xz greatoffice-4dbef3fcd7a14437d55c555cf10d50de8e50d7d1.zip | |
feat: Move everything out of $lib
Diffstat (limited to 'code/app/src/services/abstractions/IAccountService.ts')
| -rw-r--r-- | code/app/src/services/abstractions/IAccountService.ts | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/code/app/src/services/abstractions/IAccountService.ts b/code/app/src/services/abstractions/IAccountService.ts new file mode 100644 index 0000000..0645eb6 --- /dev/null +++ b/code/app/src/services/abstractions/IAccountService.ts @@ -0,0 +1,58 @@ +import type {KnownProblem} from "$models/internal/KnownProblem"; +import type {Writable} from "svelte/store"; + +export interface IAccountService { + session: Writable<Session>, + + login_async(payload: LoginPayload): Promise<LoginResponse>, + + logout_async(): Promise<void>, + + create_account_async(payload: CreateAccountPayload): Promise<CreateAccountResponse>, + + delete_current_async(): Promise<DeleteAccountResponse>, + + update_current_async(payload: UpdateAccountPayload): Promise<UpdateAccountResponse>, +} + +export type Session = { + username: string, + displayName: string, + id: string, + _lastUpdated: number +} + +export type LoginPayload = { + username: string, + password: string, + persist: boolean +} + +export type LoginResponse = { + isLoggedIn: boolean, + knownProblem?: KnownProblem +} + +export type CreateAccountPayload = { + username: string, + password: string, +} + +export type CreateAccountResponse = { + isCreated: boolean, + knownProblem?: KnownProblem +} + +export type DeleteAccountResponse = { + isDeleted: boolean +} + +export type UpdateAccountPayload = { + username: string, + password: string +} + +export type UpdateAccountResponse = { + isUpdated: boolean, + knownProblem?: KnownProblem +}
\ No newline at end of file |
