aboutsummaryrefslogtreecommitdiffstats
path: root/code/app/src/lib/api
diff options
context:
space:
mode:
Diffstat (limited to 'code/app/src/lib/api')
-rw-r--r--code/app/src/lib/api/time-entry.ts30
-rw-r--r--code/app/src/lib/api/user.ts14
2 files changed, 22 insertions, 22 deletions
diff --git a/code/app/src/lib/api/time-entry.ts b/code/app/src/lib/api/time-entry.ts
index a40b0c2..faedb48 100644
--- a/code/app/src/lib/api/time-entry.ts
+++ b/code/app/src/lib/api/time-entry.ts
@@ -1,16 +1,16 @@
-import {api_base} from "$lib/configuration";
-import {is_guid} from "$lib/helpers";
-import {http_delete, http_get, http_post} from "./internal-fetch";
-import type {TimeCategoryDto} from "$lib/models/TimeCategoryDto";
-import type {TimeLabelDto} from "$lib/models/TimeLabelDto";
-import type {TimeEntryDto} from "$lib/models/TimeEntryDto";
-import type {TimeEntryQuery} from "$lib/models/TimeEntryQuery";
-import type {IInternalFetchResponse} from "$lib/models/IInternalFetchResponse";
+import { api_base } from "$lib/configuration";
+import { is_guid } from "$lib/helpers";
+import { http_delete, http_get, http_post } from "./internal-fetch";
+import type { WorkCategory } from "$lib/models/work/WorkCategory";
+import type { WorkLabel } from "$lib/models/work/WorkLabel";
+import type { WorkEntry } from "$lib/models/work/WorkEntry";
+import type { WorkQuery } from "$lib/models/work/WorkQuery";
+import type { IInternalFetchResponse } from "$lib/models/internal/IInternalFetchResponse";
// ENTRIES
-export async function create_time_entry(payload: TimeEntryDto): Promise<IInternalFetchResponse> {
+export async function create_time_entry(payload: WorkEntry): Promise<IInternalFetchResponse> {
return http_post(api_base("v1/entries/create"), payload);
}
@@ -21,7 +21,7 @@ export async function get_time_entry(entryId: string): Promise<IInternalFetchRes
throw new Error("entryId is not a valid guid.");
}
-export async function get_time_entries(entryQuery: TimeEntryQuery): Promise<IInternalFetchResponse> {
+export async function get_time_entries(entryQuery: WorkQuery): Promise<IInternalFetchResponse> {
return http_post(api_base("v1/entries/query"), entryQuery);
}
@@ -30,7 +30,7 @@ export async function delete_time_entry(id: string): Promise<IInternalFetchRespo
return http_delete(api_base("v1/entries/" + id + "/delete"));
}
-export async function update_time_entry(entryDto: TimeEntryDto): Promise<IInternalFetchResponse> {
+export async function update_time_entry(entryDto: WorkEntry): Promise<IInternalFetchResponse> {
if (!is_guid(entryDto.id ?? "")) throw new Error("id is not a valid guid");
if (!entryDto.category) throw new Error("category is empty");
if (!entryDto.stop) throw new Error("stop is empty");
@@ -39,7 +39,7 @@ export async function update_time_entry(entryDto: TimeEntryDto): Promise<IIntern
}
// LABELS
-export async function create_time_label(labelDto: TimeLabelDto): Promise<IInternalFetchResponse> {
+export async function create_time_label(labelDto: WorkLabel): Promise<IInternalFetchResponse> {
return http_post(api_base("v1/labels/create"), labelDto);
}
@@ -52,7 +52,7 @@ export async function delete_time_label(id: string): Promise<IInternalFetchRespo
return http_delete(api_base("v1/labels/" + id + "/delete"));
}
-export async function update_time_label(labelDto: TimeLabelDto): Promise<IInternalFetchResponse> {
+export async function update_time_label(labelDto: WorkLabel): Promise<IInternalFetchResponse> {
if (!is_guid(labelDto.id ?? "")) throw new Error("id is not a valid guid");
if (!labelDto.name) throw new Error("name is empty");
if (!labelDto.color) throw new Error("color is empty");
@@ -60,7 +60,7 @@ export async function update_time_label(labelDto: TimeLabelDto): Promise<IIntern
}
// CATEGORIES
-export async function create_time_category(category: TimeCategoryDto): Promise<IInternalFetchResponse> {
+export async function create_time_category(category: WorkCategory): Promise<IInternalFetchResponse> {
if (!category.name) throw new Error("name is empty");
if (!category.color) throw new Error("color is empty");
return http_post(api_base("v1/categories/create"), category);
@@ -75,7 +75,7 @@ export async function delete_time_category(id: string): Promise<IInternalFetchRe
return http_delete(api_base("v1/categories/" + id + "/delete"));
}
-export async function update_time_category(category: TimeCategoryDto): Promise<IInternalFetchResponse> {
+export async function update_time_category(category: WorkCategory): Promise<IInternalFetchResponse> {
if (!is_guid(category.id ?? "")) throw new Error("id is not a valid guid");
if (!category.name) throw new Error("name is empty");
if (!category.color) throw new Error("color is empty");
diff --git a/code/app/src/lib/api/user.ts b/code/app/src/lib/api/user.ts
index f0dc932..f08fb6d 100644
--- a/code/app/src/lib/api/user.ts
+++ b/code/app/src/lib/api/user.ts
@@ -1,9 +1,9 @@
-import {api_base} from "$lib/configuration";
-import {http_delete, http_get, http_post} from "./internal-fetch";
-import type {LoginPayload} from "$lib/models/LoginPayload";
-import type {UpdateProfilePayload} from "$lib/models/UpdateProfilePayload";
-import type {CreateAccountPayload} from "$lib/models/CreateAccountPayload";
-import type {IInternalFetchResponse} from "$lib/models/IInternalFetchResponse";
+import { api_base } from "$lib/configuration";
+import { http_delete, http_get, http_post } from "./internal-fetch";
+import type { LoginPayload } from "$lib/models/internal/LoginPayload";
+import type { UpdateProfilePayload } from "$lib/models/internal/UpdateProfilePayload";
+import type { CreateAccountPayload } from "$lib/models/internal/CreateAccountPayload";
+import type { IInternalFetchResponse } from "$lib/models/internal/IInternalFetchResponse";
export async function login(payload: LoginPayload): Promise<IInternalFetchResponse> {
return http_post(api_base("_/account/login"), payload);
@@ -25,7 +25,7 @@ export async function check_forgot_password_request(public_id: string): Promise<
export async function fulfill_forgot_password_request(public_id: string, newPassword: string): Promise<IInternalFetchResponse> {
if (!public_id) throw new Error("Id is empty");
- return http_post(api_base("_/forgot-password-requests/fulfill"), {id: public_id, newPassword});
+ return http_post(api_base("_/forgot-password-requests/fulfill"), { id: public_id, newPassword });
}
export async function delete_account(): Promise<IInternalFetchResponse> {