From ca9c1cdf1ec2988f14ac4ca788edac31153f735f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Fri, 25 Nov 2022 16:30:33 +0900 Subject: feat: WIP! Rework http calls into services --- .../lib/services/abstractions/IAccountService.ts | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 code/app/src/lib/services/abstractions/IAccountService.ts (limited to 'code/app/src/lib/services/abstractions/IAccountService.ts') diff --git a/code/app/src/lib/services/abstractions/IAccountService.ts b/code/app/src/lib/services/abstractions/IAccountService.ts new file mode 100644 index 0000000..736c3ae --- /dev/null +++ b/code/app/src/lib/services/abstractions/IAccountService.ts @@ -0,0 +1,53 @@ +import type { KnownProblem } from "$lib/models/internal/KnownProblem" + +export interface IAccountService { + session: Session, + 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 = { + profile: { + username: string, + displayName: string, + id: string, + }, + lastChecked: number, +} + +export type LoginPayload = { + username: string, + password: string, + persist: boolean +} + +export type LoginResponse = { + isLoggedIn: boolean +} + +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