-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
๐ Description (In Simple Words)
We want to build a complete Folder Management System that developers can use in any project without writing it from scratch.
This folder system should let users:
-
โ Create folders (like Google Drive, Notion, etc.)
-
โ๏ธ Rename folders
-
๐ Organize folders inside folders (parent-child)
-
๐๏ธ Move folders to trash (soft delete)
-
โป๏ธ Restore deleted folders
-
โ Delete folders permanently
-
๐ Pin or hide folders
-
๐๏ธ Show only visible folders
-
๐ค Use folders per user (based on authId)
-
It should be created using modular and class-based structure so any developer can just import the controller/service and use it right away.
๐ Why This Is Useful
-
This feature is useful in so many types of apps:
-
โ Note-taking or document tools (like Notion, Evernote)
-
โ File upload systems (like Google Drive, Dropbox)
-
โ Task or project managers (like Trello, Todoist)
-
โ School or learning systems (for organizing materials)
-
โ Admin dashboards (organizing reports or files)
๐ง Key Features
โ Must-Have Features
-
Create folders
-
Rename folders
-
Delete folders (soft)
-
Restore folders
-
Permanently delete folders
-
Organize folders under other folders
-
Show folders per logged-in user
๐ Useful Flags
-
isPinned: To highlight important folders
-
isHidden: To hide folders from view
-
isDeleted: To mark folders in trash
-
isArchived: (optional)
-
isShared: To Allow account folder authentication user
๐ Security
-
Each folder belongs to one user via authId
-
No one else can access or edit it
๐๏ธ File Structure (Organized & Clean)
src/
โโโ features/
โโโ Folder/
โโโ v1/
โโโ Folder.controller.ts // Handle API calls
โโโ Folder.service.ts // Business logic
โโโ Folder.validators.ts // Validate data
โโโ Folder.model.ts // Folder schema/interface
โโโ Folder.constant.ts // Common messages/flags
โโโ Folder.middleware.ts // (Optional) Access control
โโโ Folder.demo.ts // Example usage
โโโ README.md // Guide for devs๐ฎ Controller Methods
router.post('/folders', folderController.create); // Create
router.get('/folders', folderController.getAll); // Get all folders
router.patch('/folders/:id/rename', folderController.rename);
router.patch('/folders/:id/restore', folderController.restore);
router.delete('/folders/:id', folderController.softDelete); // Soft delete
router.delete('/folders/:id/permanent', folderController.permanentDelete);๐ฆ Example Folder Schema (Folder.model.ts)
interface Folder {
id: string;
name: string;
parentId?: string;
Child_id?: [string]
authId: string;
isPinned: boolean;
isHidden: boolean;
isDeleted: boolean;
createdAt: Date;
updatedAt: Date;
}โ๏ธ Service Functions
class FolderService {
static async createFolder(data) { ... }
static async renameFolder(id, newName) { ... }
static async moveFolder(id, newParentId) { ... }
static async deleteFolder(id) { ... } // soft delete
static async restoreFolder(id) { ... }
static async permanentlyDeleteFolder(id) { ... }
static async getUserFolders(authId, filters?) { ... }
}๐งช Smart Additions You Can Include (Optional But Powerful)
- โ Folder Tree Generator โ get nested structure like:
[
{ id: 1, name: "Docs", children: [{ id: 2, name: "Projects" }] }
]
โ
Folder Sharing โ mark folders as shared (isShared = true)
โ
Sorting โ sort by createdAt, name, pinned first
โ
Recycle Bin View โ filter all folders with isDeleted = true
โ
Folder Activity Logs โ who renamed, deleted, restored, and when๐ README.md Should Include:
-
โ How to import controller/service
-
โ Sample API usage
-
โ Description of all flags
-
โ How to add your own logic (custom filters or roles)
-
โ How to integrate it into your app
๐ Final Usage Example
import { FolderController } from '@fastkit/folder';
const folderController = new FolderController();
router.post('/folders', verifyToken, folderController.create);
router.get('/folders', verifyToken, folderController.getAll);- You can even build your file management or note app folder tree using this module.
โ Expected Output
[x] Full-featured folder system that works in any project
[x] Flags like pinned/hidden/deleted
[x] Controller works out of the box
[x] Tree-ready folder support
[x] Scalable and modular
๐ Contributors Can Help Add:
-
๐ Tree view structure
-
๐ Folder sharing and permissions
-
๐ Sorting folders
-
๐ File upload inside folders (future)
๐งช Test Ideas
-
Create a folder
-
Move under another folder
-
Rename and restore
-
Filter only pinned folders
-
Show tree-like folder structure