mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
refactor(frontend): ♻️ update API folder structure
This commit is contained in:
parent
9b79b82c4d
commit
a94b9d504f
25 changed files with 83 additions and 36 deletions
47
frontend/api/admin/admin-about.ts
Normal file
47
frontend/api/admin/admin-about.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { BaseAPI } from "../_base";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
about: `${prefix}/admin/about`,
|
||||
aboutStatistics: `${prefix}/admin/about/statistics`,
|
||||
check: `${prefix}/admin/about/check`,
|
||||
};
|
||||
|
||||
export interface AdminAboutInfo {
|
||||
production: boolean;
|
||||
version: string;
|
||||
demoStatus: boolean;
|
||||
apiPort: number;
|
||||
apiDocs: boolean;
|
||||
dbType: string;
|
||||
dbUrl: string;
|
||||
defaultGroup: string;
|
||||
}
|
||||
|
||||
export interface AdminStatistics {
|
||||
totalRecipes: number;
|
||||
totalUsers: number;
|
||||
totalGroups: number;
|
||||
uncategorizedRecipes: number;
|
||||
untaggedRecipes: number;
|
||||
}
|
||||
|
||||
export interface CheckAppConfig {
|
||||
emailReady: boolean;
|
||||
baseUrlSet: boolean;
|
||||
}
|
||||
|
||||
export class AdminAboutAPI extends BaseAPI {
|
||||
async about() {
|
||||
return await this.requests.get<AdminAboutInfo>(routes.about);
|
||||
}
|
||||
|
||||
async statistics() {
|
||||
return await this.requests.get(routes.aboutStatistics);
|
||||
}
|
||||
|
||||
async checkApp() {
|
||||
return await this.requests.get<CheckAppConfig>(routes.check);
|
||||
}
|
||||
}
|
18
frontend/api/admin/admin-tasks.ts
Normal file
18
frontend/api/admin/admin-tasks.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { BaseAPI } from "../_base";
|
||||
import { ServerTask } from "~/api/types/server-task";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
base: `${prefix}/admin/server-tasks`,
|
||||
};
|
||||
|
||||
export class AdminTaskAPI extends BaseAPI {
|
||||
async testTask() {
|
||||
return await this.requests.post<ServerTask>(`${routes.base}`, {});
|
||||
}
|
||||
|
||||
async getAll() {
|
||||
return await this.requests.get<ServerTask[]>(routes.base);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue