mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-21 22:29:39 +02:00
feat(backend): ✨ refactor/fix group management for admins (#838)
* fix(frontend): 🐛 update dialog implementation to simplify state management * test(backend): ✅ refactor test fixtures + admin group tests * chore(backend): 🔨 add launcher.json for python debugging (tests) * fix typing * feat(backend): ✨ refactor/fix group management for admins * feat(frontend): ✨ add/fix admin group management * add LDAP checker Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
0db8a58963
commit
791aa8c610
52 changed files with 881 additions and 331 deletions
54
frontend/api/admin/admin-groups.ts
Normal file
54
frontend/api/admin/admin-groups.ts
Normal file
|
@ -0,0 +1,54 @@
|
|||
import { BaseCRUDAPI } from "../_base";
|
||||
import { UserRead } from "./admin-users";
|
||||
const prefix = "/api";
|
||||
|
||||
export interface Token {
|
||||
name: string;
|
||||
id: number;
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface Preferences {
|
||||
privateGroup: boolean;
|
||||
firstDayOfWeek: number;
|
||||
recipePublic: boolean;
|
||||
recipeShowNutrition: boolean;
|
||||
recipeShowAssets: boolean;
|
||||
recipeLandscapeView: boolean;
|
||||
recipeDisableComments: boolean;
|
||||
recipeDisableAmount: boolean;
|
||||
groupId: number;
|
||||
id: number;
|
||||
}
|
||||
|
||||
export interface GroupCreate {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface GroupRead extends GroupCreate {
|
||||
id: number;
|
||||
categories: any[];
|
||||
webhooks: any[];
|
||||
users: UserRead[];
|
||||
preferences: Preferences;
|
||||
}
|
||||
|
||||
export interface AdminGroupUpdate {
|
||||
name: string;
|
||||
id: number;
|
||||
preferences: Preferences;
|
||||
}
|
||||
|
||||
const routes = {
|
||||
adminUsers: `${prefix}/admin/groups`,
|
||||
adminUsersId: (id: number) => `${prefix}/admin/groups/${id}`,
|
||||
};
|
||||
|
||||
export class AdminGroupsApi extends BaseCRUDAPI<GroupRead, GroupCreate> {
|
||||
baseRoute: string = routes.adminUsers;
|
||||
itemRoute = routes.adminUsersId;
|
||||
|
||||
async updateOne(id: number, payload: AdminGroupUpdate) {
|
||||
return await this.requests.put<GroupRead>(this.itemRoute(id), payload);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue