Merge remote-tracking branch 'origin/dev' into feat/user-routes

# Conflicts:
#	frontend/src/controllers/base-controller.ts
#	frontend/src/controllers/controllers.ts
This commit is contained in:
Gabriellvl 2025-03-24 15:57:45 +01:00
commit c84964e719
27 changed files with 1644 additions and 177 deletions

View file

@ -1,10 +1,10 @@
import { API_BASE } from "../../config.ts";
import {apiConfig} from "@/config.ts";
export class BaseController {
protected baseUrl: string;
constructor(basePath: string) {
this.baseUrl = `${API_BASE}/${basePath}`;
this.baseUrl = `${apiConfig.baseUrl}/${basePath}`;
}
protected async get<T>(path: string, queryParams?: Record<string, any>): Promise<T> {

View file

@ -1,6 +1,8 @@
import { StudentController } from "@/controllers/student-controller.ts";
import { TeacherController } from "@/controllers/teacher-controller.ts";
import {ThemeController} from "@/controllers/themes.ts";
export function controllerGetter<T>(Factory: new () => T): () => T {
let instance: T | undefined;
@ -14,3 +16,4 @@ export function controllerGetter<T>(Factory: new () => T): () => T {
export const getStudentController = controllerGetter(StudentController);
export const getTeacherController = controllerGetter(TeacherController);
export const getThemeController = controllerGetter(ThemeController);

View file

@ -0,0 +1,16 @@
import {BaseController} from "@/controllers/base-controller.ts";
export class ThemeController extends BaseController {
constructor() {
super("theme");
}
getAll(language: string | null = null) {
const query = language ? { language } : undefined;
return this.get<any[]>("/", query);
}
getHruidsByKey(themeKey: string) {
return this.get<string[]>(`/${encodeURIComponent(themeKey)}`);
}
}