mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
refactor(frontend): 🚧 Migrate Dashboard to Nuxt
Add API and Functinality for Admin Dashboard. Stills needs to clean-up. See // TODO's
This commit is contained in:
parent
41a6916771
commit
9386cc320b
32 changed files with 671 additions and 113 deletions
49
frontend/api/class-interfaces/events.ts
Normal file
49
frontend/api/class-interfaces/events.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { BaseAPI } from "./_base";
|
||||
|
||||
export type EventCategory = "general" | "recipe" | "backup" | "scheduled" | "migration" | "group" | "user";
|
||||
|
||||
export interface Event {
|
||||
id?: number;
|
||||
title: string;
|
||||
text: string;
|
||||
timeStamp?: string;
|
||||
category?: EventCategory & string;
|
||||
}
|
||||
|
||||
export interface EventsOut {
|
||||
total: number;
|
||||
events: Event[];
|
||||
}
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
const routes = {
|
||||
aboutEvents: `${prefix}/about/events`,
|
||||
aboutEventsNotifications: `${prefix}/about/events/notifications`,
|
||||
aboutEventsNotificationsTest: `${prefix}/about/events/notifications/test`,
|
||||
|
||||
aboutEventsId: (id: number) => `${prefix}/about/events/${id}`,
|
||||
aboutEventsNotificationsId: (id: number) => `${prefix}/about/events/notifications/${id}`,
|
||||
};
|
||||
|
||||
export class EventsAPI extends BaseAPI {
|
||||
/** Get event from the Database
|
||||
*/
|
||||
async getEvents() {
|
||||
return await this.requests.get<EventsOut>(routes.aboutEvents);
|
||||
}
|
||||
|
||||
/** Get event from the Database
|
||||
*/
|
||||
async deleteEvents() {
|
||||
return await this.requests.delete(routes.aboutEvents);
|
||||
}
|
||||
|
||||
/** Delete event from the Database
|
||||
*/
|
||||
async deleteEvent(id: number) {
|
||||
return await this.requests.delete(routes.aboutEventsId(id));
|
||||
}
|
||||
/** Get all event_notification from the Database
|
||||
*/
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue