mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-29 17:24:31 -04:00 
			
		
		
		
	* docs: 📝 general documentation + add FAQ page * fix(frontend): 🐛 readd missing upload button to backups. * feat(backend): ✨ add support for backup sizes to be displayed on frontend * feat(backend): ✨ add backend for administrator CRUD of users * add admin support for user * refactor(frontend): ♻️ rewrite admin CRUD interface for admins * fix build errors Co-authored-by: hay-kot <hay-kot@pm.me>
		
			
				
	
	
		
			40 lines
		
	
	
		
			771 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			771 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { BaseCRUDAPI } from "../_base";
 | |
| 
 | |
| const prefix = "/api";
 | |
| 
 | |
| interface UserCreate {
 | |
|   username: string;
 | |
|   fullName: string;
 | |
|   email: string;
 | |
|   admin: boolean;
 | |
|   group: string;
 | |
|   advanced: boolean;
 | |
|   canInvite: boolean;
 | |
|   canManage: boolean;
 | |
|   canOrganize: boolean;
 | |
|   password: string;
 | |
| }
 | |
| 
 | |
| export interface UserToken {
 | |
|   name: string;
 | |
|   id: number;
 | |
|   createdAt: Date;
 | |
| }
 | |
| 
 | |
| interface UserRead extends UserToken {
 | |
|   id: number;
 | |
|   groupId: number;
 | |
|   favoriteRecipes: any[];
 | |
|   tokens: UserToken[];
 | |
| }
 | |
| 
 | |
| const routes = {
 | |
|   adminUsers: `${prefix}/admin/users`,
 | |
|   adminUsersId: (tag: string) => `${prefix}/admin/users/${tag}`,
 | |
| };
 | |
| 
 | |
| export class AdminUsersApi extends BaseCRUDAPI<UserRead, UserCreate> {
 | |
|   baseRoute: string = routes.adminUsers;
 | |
|   itemRoute = routes.adminUsersId;
 | |
| }
 |