From 4dbef3fcd7a14437d55c555cf10d50de8e50d7d1 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Fri, 9 Dec 2022 11:57:12 +0900 Subject: feat: Move everything out of $lib --- .../src/services/abstractions/IAccountService.ts | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 code/app/src/services/abstractions/IAccountService.ts (limited to 'code/app/src/services/abstractions/IAccountService.ts') 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, + + login_async(payload: LoginPayload): Promise, + + logout_async(): Promise, + + create_account_async(payload: CreateAccountPayload): Promise, + + delete_current_async(): Promise, + + update_current_async(payload: UpdateAccountPayload): Promise, +} + +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 -- cgit v1.3